惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
M
MIT News - Artificial intelligence
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 BLOG
博客园 - 叶小钗
Jina AI
Jina AI
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 【当耐特】
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
博客园_首页
I
InfoQ
G
Google Developers Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
H
Help Net Security
U
Unit 42
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(acpx): bundle Codex ACP adapter · openclaw/openclaw@0...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -1,10 +1,13 @@

1+

import { execFile } from "node:child_process";

12

import fs from "node:fs/promises";

23

import os from "node:os";

34

import path from "node:path";

5+

import { promisify } from "node:util";

46

import { afterEach, describe, expect, it } from "vitest";

57

import { prepareAcpxCodexAuthConfig } from "./codex-auth-bridge.js";

68

import { resolveAcpxPluginConfig } from "./config.js";

7910+

const execFileAsync = promisify(execFile);

811

const tempDirs: string[] = [];

912

const previousEnv = {

1013

CODEX_HOME: process.env.CODEX_HOME,

@@ -59,6 +62,14 @@ describe("prepareAcpxCodexAuthConfig", () => {

5962

const agentDir = path.join(root, "agent");

6063

const stateDir = path.join(root, "state");

6164

const generated = generatedCodexPaths(stateDir);

65+

const installedBinPath = path.join(

66+

root,

67+

"node_modules",

68+

"@zed-industries",

69+

"codex-acp",

70+

"bin",

71+

"codex-acp.js",

72+

);

6273

process.env.OPENCLAW_AGENT_DIR = agentDir;

6374

delete process.env.PI_CODING_AGENT_DIR;

6475

@@ -69,17 +80,90 @@ describe("prepareAcpxCodexAuthConfig", () => {

6980

const resolved = await prepareAcpxCodexAuthConfig({

7081

pluginConfig,

7182

stateDir,

83+

resolveInstalledCodexAcpBinPath: async () => installedBinPath,

7284

});

73857486

expectCodexWrapperCommand(resolved.agents.codex, generated.wrapperPath);

7587

await expect(fs.access(generated.wrapperPath)).resolves.toBeUndefined();

7688

const wrapper = await fs.readFile(generated.wrapperPath, "utf8");

77-

expect(wrapper).toContain('"--", "codex-acp"');

89+

expect(wrapper).toContain(JSON.stringify(installedBinPath));

90+

expect(wrapper).toContain("defaultArgs = [installedBinPath]");

7891

await expect(

7992

fs.access(path.join(agentDir, "acp-auth", "codex", "auth.json")),

8093

).rejects.toMatchObject({ code: "ENOENT" });

8194

});

829596+

it("falls back to the current Codex ACP package range when the local adapter is unavailable", async () => {

97+

const root = await makeTempDir();

98+

const stateDir = path.join(root, "state");

99+

const generated = generatedCodexPaths(stateDir);

100+

const pluginConfig = resolveAcpxPluginConfig({

101+

rawConfig: {},

102+

workspaceDir: root,

103+

});

104+105+

await prepareAcpxCodexAuthConfig({

106+

pluginConfig,

107+

stateDir,

108+

resolveInstalledCodexAcpBinPath: async () => undefined,

109+

});

110+111+

const wrapper = await fs.readFile(generated.wrapperPath, "utf8");

112+

expect(wrapper).toContain('"@zed-industries/codex-acp@^0.12.0"');

113+

expect(wrapper).toContain('"--", "codex-acp"');

114+

expect(wrapper).not.toContain("@zed-industries/codex-acp@^0.11.1");

115+

});

116+117+

it("uses the bundled Codex ACP dependency by default when it is installed", async () => {

118+

const root = await makeTempDir();

119+

const stateDir = path.join(root, "state");

120+

const generated = generatedCodexPaths(stateDir);

121+

const pluginConfig = resolveAcpxPluginConfig({

122+

rawConfig: {},

123+

workspaceDir: root,

124+

});

125+126+

await prepareAcpxCodexAuthConfig({

127+

pluginConfig,

128+

stateDir,

129+

});

130+131+

const wrapper = await fs.readFile(generated.wrapperPath, "utf8");

132+

expect(wrapper).toContain("@zed-industries/codex-acp");

133+

expect(wrapper).toContain("bin/codex-acp.js");

134+

expect(wrapper).toContain("defaultArgs = [installedBinPath]");

135+

});

136+137+

it("launches the locally installed Codex ACP bin with isolated CODEX_HOME", async () => {

138+

const root = await makeTempDir();

139+

const stateDir = path.join(root, "state");

140+

const generated = generatedCodexPaths(stateDir);

141+

const installedBinPath = path.join(root, "codex-acp-bin.js");

142+

await fs.writeFile(

143+

installedBinPath,

144+

"console.log(JSON.stringify({ argv: process.argv.slice(2), codexHome: process.env.CODEX_HOME }));\n",

145+

"utf8",

146+

);

147+

const pluginConfig = resolveAcpxPluginConfig({

148+

rawConfig: {},

149+

workspaceDir: root,

150+

});

151+152+

await prepareAcpxCodexAuthConfig({

153+

pluginConfig,

154+

stateDir,

155+

resolveInstalledCodexAcpBinPath: async () => installedBinPath,

156+

});

157+158+

const { stdout } = await execFileAsync(process.execPath, [generated.wrapperPath], {

159+

cwd: root,

160+

});

161+

const launched = JSON.parse(stdout.trim()) as { argv?: unknown; codexHome?: unknown };

162+

expect(launched.argv).toEqual([]);

163+

const expectedCodexHome = await fs.realpath(path.join(stateDir, "acpx", "codex-home"));

164+

expect(path.resolve(String(launched.codexHome))).toBe(expectedCodexHome);

165+

});

166+83167

it("does not copy source Codex auth", async () => {

84168

const root = await makeTempDir();

85169

const sourceCodexHome = path.join(root, "source-codex");

@@ -106,6 +190,7 @@ describe("prepareAcpxCodexAuthConfig", () => {

106190

const resolved = await prepareAcpxCodexAuthConfig({

107191

pluginConfig,

108192

stateDir,

193+

resolveInstalledCodexAcpBinPath: async () => undefined,

109194

});

110195111196

expectCodexWrapperCommand(resolved.agents.codex, generated.wrapperPath);

@@ -138,7 +223,7 @@ describe("prepareAcpxCodexAuthConfig", () => {

138223

rawConfig: {

139224

agents: {

140225

codex: {

141-

command: "npx @zed-industries/codex-acp@^0.11.1 -c 'model=\"gpt-5.4\"'",

226+

command: "npx @zed-industries/codex-acp@0.12.0 -c 'model=\"gpt-5.4\"'",

142227

},

143228

},

144229

},

@@ -148,10 +233,11 @@ describe("prepareAcpxCodexAuthConfig", () => {

148233

const resolved = await prepareAcpxCodexAuthConfig({

149234

pluginConfig,

150235

stateDir,

236+

resolveInstalledCodexAcpBinPath: async () => path.join(root, "codex-acp.js"),

151237

});

152238153239

expectCodexWrapperCommand(resolved.agents.codex, generated.wrapperPath);

154-

expect(resolved.agents.codex).toContain("npx @zed-industries/codex-acp@^0.11.1");

240+

expect(resolved.agents.codex).toContain("npx @zed-industries/codex-acp@0.12.0");

155241

expect(resolved.agents.codex).toContain("-c 'model=\"gpt-5.4\"'");

156242

const isolatedConfig = await fs.readFile(generated.configPath, "utf8");

157243

expect(isolatedConfig).not.toContain("notify");