


















@@ -172,7 +172,7 @@ async function writeCodexCliAuthFile(codexHome: string): Promise<void> {
172172}
173173174174describe("bridgeCodexAppServerStartOptions", () => {
175-it("sets agent-owned CODEX_HOME and HOME for local app-server launches", async () => {
175+it("sets agent-owned CODEX_HOME without overriding HOME for local app-server launches", async () => {
176176const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-app-server-"));
177177const startOptions = createStartOptions();
178178try {
@@ -188,17 +188,40 @@ describe("bridgeCodexAppServerStartOptions", () => {
188188 ...startOptions,
189189env: {
190190CODEX_HOME: codexHome,
191-HOME: nativeHome,
192191},
193192});
194193await expect(fs.access(codexHome)).resolves.toBeUndefined();
195-await expect(fs.access(nativeHome)).resolves.toBeUndefined();
194+await expectPathMissing(nativeHome);
196195expect(startOptions.env).toBeUndefined();
197196} finally {
198197await fs.rm(agentDir, { recursive: true, force: true });
199198}
200199});
201200201+it("preserves inherited HOME when clearEnv asks to clear app-server isolation vars", async () => {
202+const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-app-server-"));
203+const startOptions = createStartOptions({
204+clearEnv: ["CODEX_HOME", "HOME", "FOO"],
205+});
206+try {
207+await expect(
208+bridgeCodexAppServerStartOptions({
209+ startOptions,
210+ agentDir,
211+}),
212+).resolves.toEqual({
213+ ...startOptions,
214+env: {
215+CODEX_HOME: resolveCodexAppServerHomeDir(agentDir),
216+},
217+clearEnv: ["FOO"],
218+});
219+expect(startOptions.clearEnv).toEqual(["CODEX_HOME", "HOME", "FOO"]);
220+} finally {
221+await fs.rm(agentDir, { recursive: true, force: true });
222+}
223+});
224+202225it("preserves explicit CODEX_HOME and HOME overrides", async () => {
203226const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-app-server-"));
204227const codexHome = path.join(agentDir, "custom-codex-home");
@@ -260,7 +283,6 @@ describe("bridgeCodexAppServerStartOptions", () => {
260283env: {
261284EXISTING: "1",
262285CODEX_HOME: resolveCodexAppServerHomeDir(agentDir),
263-HOME: resolveCodexAppServerNativeHomeDir(agentDir),
264286},
265287clearEnv: ["FOO", "CODEX_API_KEY", "OPENAI_API_KEY"],
266288});
@@ -298,7 +320,6 @@ describe("bridgeCodexAppServerStartOptions", () => {
298320 ...startOptions,
299321env: {
300322CODEX_HOME: resolveCodexAppServerHomeDir(agentDir),
301-HOME: resolveCodexAppServerNativeHomeDir(agentDir),
302323},
303324clearEnv: ["FOO", "CODEX_API_KEY", "OPENAI_API_KEY"],
304325});
@@ -331,7 +352,6 @@ describe("bridgeCodexAppServerStartOptions", () => {
331352 ...startOptions,
332353env: {
333354CODEX_HOME: resolveCodexAppServerHomeDir(agentDir),
334-HOME: resolveCodexAppServerNativeHomeDir(agentDir),
335355},
336356clearEnv: ["FOO", "CODEX_API_KEY", "OPENAI_API_KEY"],
337357});
@@ -364,7 +384,6 @@ describe("bridgeCodexAppServerStartOptions", () => {
364384 ...startOptions,
365385env: {
366386CODEX_HOME: resolveCodexAppServerHomeDir(agentDir),
367-HOME: resolveCodexAppServerNativeHomeDir(agentDir),
368387},
369388});
370389} finally {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。