From 2cd1b02b49af6fa8757506656934a0c35f07975b Mon Sep 17 00:00:00 2001 From: Prateek Date: Sat, 7 Mar 2026 14:24:55 +0530 Subject: [PATCH 1/5] fix: suppress codex update prompt in non-interactive agent sessions --- packages/plugins/agent-codex/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/plugins/agent-codex/src/index.ts b/packages/plugins/agent-codex/src/index.ts index 0ebb69039..ec68115c7 100644 --- a/packages/plugins/agent-codex/src/index.ts +++ b/packages/plugins/agent-codex/src/index.ts @@ -603,6 +603,8 @@ function createCodexAgent(): Agent { // The wrappers strip this directory from PATH before calling the real // binary, so there's no infinite recursion. env["PATH"] = `${AO_BIN_DIR}:${process.env["PATH"] ?? "/usr/bin:/bin"}`; + // Disable Codex's version check/update prompt for non-interactive AO sessions. + env["CODEX_DISABLE_UPDATE_CHECK"] = "1"; return env; }, From 79dcaa043fc6dce04c8e1c36252b3259b445c029 Mon Sep 17 00:00:00 2001 From: Prateek Date: Sat, 7 Mar 2026 15:11:00 +0530 Subject: [PATCH 2/5] test: verify codex update check env var is set --- packages/plugins/agent-codex/src/index.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/plugins/agent-codex/src/index.test.ts b/packages/plugins/agent-codex/src/index.test.ts index 363825244..eb611a3c7 100644 --- a/packages/plugins/agent-codex/src/index.test.ts +++ b/packages/plugins/agent-codex/src/index.test.ts @@ -374,6 +374,11 @@ describe("getEnvironment", () => { expect(env["PATH"]?.startsWith("/mock/home/.ao/bin:")).toBe(true); }); + it("sets CODEX_DISABLE_UPDATE_CHECK=1 to suppress interactive update prompts", () => { + const env = agent.getEnvironment(makeLaunchConfig()); + expect(env["CODEX_DISABLE_UPDATE_CHECK"]).toBe("1"); + }); + it("falls back to /usr/bin:/bin when process.env.PATH is undefined", () => { const originalPath = process.env["PATH"]; delete process.env["PATH"]; From e90c7f7ff20a4f06b361eec2deeba52a1aa221ea Mon Sep 17 00:00:00 2001 From: Prateek Date: Sat, 7 Mar 2026 20:31:35 +0530 Subject: [PATCH 3/5] fix: disable codex startup update check via config override --- packages/plugins/agent-codex/src/index.test.ts | 16 +++++++++++----- packages/plugins/agent-codex/src/index.ts | 7 +++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/plugins/agent-codex/src/index.test.ts b/packages/plugins/agent-codex/src/index.test.ts index eb611a3c7..5e9e2c05f 100644 --- a/packages/plugins/agent-codex/src/index.test.ts +++ b/packages/plugins/agent-codex/src/index.test.ts @@ -210,7 +210,7 @@ describe("getLaunchCommand", () => { const agent = create(); it("generates base command", () => { - expect(agent.getLaunchCommand(makeLaunchConfig())).toBe("'codex'"); + expect(agent.getLaunchCommand(makeLaunchConfig())).toBe("'codex' -c check_for_update_on_startup=false"); }); it("includes --dangerously-bypass-approvals-and-sandbox when permissions=skip", () => { @@ -255,7 +255,7 @@ describe("getLaunchCommand", () => { const cmd = agent.getLaunchCommand( makeLaunchConfig({ permissions: "skip", model: "o3", prompt: "Go" }), ); - expect(cmd).toBe("'codex' --dangerously-bypass-approvals-and-sandbox --model 'o3' -c model_reasoning_effort=high -- 'Go'"); + expect(cmd).toBe("'codex' -c check_for_update_on_startup=false --dangerously-bypass-approvals-and-sandbox --model 'o3' -c model_reasoning_effort=high -- 'Go'"); }); it("escapes single quotes in prompt (POSIX shell escaping)", () => { @@ -294,10 +294,15 @@ describe("getLaunchCommand", () => { expect(cmd).not.toContain("--dangerously-bypass-approvals-and-sandbox"); expect(cmd).not.toContain("--ask-for-approval"); expect(cmd).not.toContain("--model"); - expect(cmd).not.toContain("-c"); + expect(cmd).toContain("-c check_for_update_on_startup=false"); expect(cmd).not.toContain("model_reasoning_effort"); }); + it("always includes -c check_for_update_on_startup=false", () => { + const cmd = agent.getLaunchCommand(makeLaunchConfig({ model: "gpt-4o", prompt: "Fix it" })); + expect(cmd).toContain("-c check_for_update_on_startup=false"); + }); + // -- Reasoning effort tests -- describe("reasoning effort", () => { it("adds model_reasoning_effort=high for o3 model", () => { @@ -967,6 +972,7 @@ describe("getRestoreCommand", () => { expect(cmd).not.toBeNull(); expect(cmd).toContain("'codex' resume"); + expect(cmd).toContain("-c check_for_update_on_startup=false"); expect(cmd).toContain("thread-abc-123"); }); @@ -1218,13 +1224,13 @@ describe("postLaunchSetup", () => { mockReadFile.mockRejectedValue(new Error("ENOENT")); // Before postLaunchSetup, binary is "codex" - expect(agent.getLaunchCommand(makeLaunchConfig())).toBe("'codex'"); + expect(agent.getLaunchCommand(makeLaunchConfig())).toBe("'codex' -c check_for_update_on_startup=false"); // After postLaunchSetup resolves the binary await agent.postLaunchSetup!(makeSession({ workspacePath: "/workspace/test" })); // Now getLaunchCommand should use the resolved binary - expect(agent.getLaunchCommand(makeLaunchConfig())).toBe("'/opt/bin/codex'"); + expect(agent.getLaunchCommand(makeLaunchConfig())).toBe("'/opt/bin/codex' -c check_for_update_on_startup=false"); }); }); diff --git a/packages/plugins/agent-codex/src/index.ts b/packages/plugins/agent-codex/src/index.ts index ec68115c7..baed566f1 100644 --- a/packages/plugins/agent-codex/src/index.ts +++ b/packages/plugins/agent-codex/src/index.ts @@ -538,6 +538,11 @@ function appendModelFlags(parts: string[], model: string | undefined): void { } } +/** Disable Codex startup update checks/prompts in non-interactive sessions */ +function appendNoUpdateCheckFlag(parts: string[]): void { + parts.push("-c", "check_for_update_on_startup=false"); +} + /** TTL for session file path cache (ms). Prevents redundant filesystem scans * when getActivityState and getSessionInfo are called in the same refresh cycle. */ const SESSION_FILE_CACHE_TTL_MS = 30_000; @@ -570,6 +575,7 @@ function createCodexAgent(): Agent { getLaunchCommand(config: AgentLaunchConfig): string { const binary = resolvedBinary ?? "codex"; const parts: string[] = [shellEscape(binary)]; + appendNoUpdateCheckFlag(parts); appendApprovalFlags(parts, config.permissions as string | undefined); appendModelFlags(parts, config.model); @@ -761,6 +767,7 @@ function createCodexAgent(): Agent { // Flags are placed before the positional threadId for CLI parser compatibility. const binary = resolvedBinary ?? "codex"; const parts: string[] = [shellEscape(binary), "resume"]; + appendNoUpdateCheckFlag(parts); appendApprovalFlags(parts, project.agentConfig?.permissions as string | undefined); const effectiveModel = (project.agentConfig?.model ?? data.model) as string | undefined; From e81a8a4e27564792b6566bb04eb81f0ccfe78dcf Mon Sep 17 00:00:00 2001 From: Prateek Date: Sat, 7 Mar 2026 20:37:36 +0530 Subject: [PATCH 4/5] test: add codex launch/env integration coverage --- ...agent-codex-launch-env.integration.test.ts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 packages/integration-tests/src/agent-codex-launch-env.integration.test.ts diff --git a/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts b/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts new file mode 100644 index 000000000..6ad47f861 --- /dev/null +++ b/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts @@ -0,0 +1,45 @@ +import { describe, expect, it } from "vitest"; +import type { AgentLaunchConfig } from "@composio/ao-core"; +import codexPlugin from "@composio/ao-plugin-agent-codex"; + +function makeLaunchConfig(overrides: Partial = {}): AgentLaunchConfig { + return { + sessionId: "sess-int-1", + projectConfig: { + name: "my-project", + repo: "owner/repo", + path: "/workspace/repo", + defaultBranch: "main", + sessionPrefix: "my", + }, + ...overrides, + }; +} + +describe("agent-codex launch/env wiring (integration)", () => { + const agent = codexPlugin.create(); + + it("includes check_for_update_on_startup=false in launch command", () => { + const cmd = agent.getLaunchCommand(makeLaunchConfig()); + expect(cmd).toContain("-c check_for_update_on_startup=false"); + }); + + it("preserves update-check override alongside other flags", () => { + const cmd = agent.getLaunchCommand( + makeLaunchConfig({ + permissions: "skip", + model: "o3-mini", + prompt: "Do the thing", + }), + ); + expect(cmd).toContain("-c check_for_update_on_startup=false"); + expect(cmd).toContain("--dangerously-bypass-approvals-and-sandbox"); + expect(cmd).toContain("--model 'o3-mini'"); + expect(cmd).toContain("-c model_reasoning_effort=high"); + }); + + it("sets CODEX_DISABLE_UPDATE_CHECK=1 in environment", () => { + const env = agent.getEnvironment(makeLaunchConfig()); + expect(env["CODEX_DISABLE_UPDATE_CHECK"]).toBe("1"); + }); +}); From cb2b386f9960d71b2699bd5b84390f2dc20e04ce Mon Sep 17 00:00:00 2001 From: Prateek Date: Sat, 7 Mar 2026 21:01:32 +0530 Subject: [PATCH 5/5] test: align codex integration test with AgentPermissionMode --- .../src/agent-codex-launch-env.integration.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts b/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts index 6ad47f861..2d76089b0 100644 --- a/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts +++ b/packages/integration-tests/src/agent-codex-launch-env.integration.test.ts @@ -27,13 +27,13 @@ describe("agent-codex launch/env wiring (integration)", () => { it("preserves update-check override alongside other flags", () => { const cmd = agent.getLaunchCommand( makeLaunchConfig({ - permissions: "skip", + permissions: "default", model: "o3-mini", prompt: "Do the thing", }), ); expect(cmd).toContain("-c check_for_update_on_startup=false"); - expect(cmd).toContain("--dangerously-bypass-approvals-and-sandbox"); + expect(cmd).not.toContain("--ask-for-approval"); expect(cmd).toContain("--model 'o3-mini'"); expect(cmd).toContain("-c model_reasoning_effort=high"); });