From 53c620287a3ca29d28128627d905add2ea68fae0 Mon Sep 17 00:00:00 2001 From: Nich Date: Mon, 1 Jun 2026 12:48:16 +0100 Subject: [PATCH] fix: launch codex workers with exec --- .changeset/fix-codex-exec-launch.md | 5 +++++ packages/plugins/agent-codex/src/index.test.ts | 8 ++++---- packages/plugins/agent-codex/src/index.ts | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changeset/fix-codex-exec-launch.md diff --git a/.changeset/fix-codex-exec-launch.md b/.changeset/fix-codex-exec-launch.md new file mode 100644 index 0000000000..7d3f90dcb5 --- /dev/null +++ b/.changeset/fix-codex-exec-launch.md @@ -0,0 +1,5 @@ +--- +"@aoagents/ao-plugin-agent-codex": patch +--- + +Launch Codex worker sessions with `codex exec` so spawned AO workers run non-interactively. diff --git a/packages/plugins/agent-codex/src/index.test.ts b/packages/plugins/agent-codex/src/index.test.ts index 5499873a1d..d9de370e8f 100644 --- a/packages/plugins/agent-codex/src/index.test.ts +++ b/packages/plugins/agent-codex/src/index.test.ts @@ -267,7 +267,7 @@ describe("getLaunchCommand", () => { it("generates base command", () => { expect(agent.getLaunchCommand(makeLaunchConfig())).toBe( - "'codex' -c check_for_update_on_startup=false", + "'codex' exec -c check_for_update_on_startup=false", ); }); @@ -317,7 +317,7 @@ describe("getLaunchCommand", () => { makeLaunchConfig({ permissions: "permissionless", model: "o3", prompt: "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'", + "'codex' exec -c check_for_update_on_startup=false --dangerously-bypass-approvals-and-sandbox --model 'o3' -c model_reasoning_effort=high -- 'Go'", ); }); @@ -1971,7 +1971,7 @@ describe("postLaunchSetup", () => { // Before postLaunchSetup, binary is "codex" expect(agent.getLaunchCommand(makeLaunchConfig())).toBe( - "'codex' -c check_for_update_on_startup=false", + "'codex' exec -c check_for_update_on_startup=false", ); // After postLaunchSetup resolves the binary @@ -1979,7 +1979,7 @@ describe("postLaunchSetup", () => { // Now getLaunchCommand should use the resolved binary expect(agent.getLaunchCommand(makeLaunchConfig())).toBe( - "'/opt/bin/codex' -c check_for_update_on_startup=false", + "'/opt/bin/codex' exec -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 770c6a5050..98ad059f2d 100644 --- a/packages/plugins/agent-codex/src/index.ts +++ b/packages/plugins/agent-codex/src/index.ts @@ -606,7 +606,7 @@ function createCodexAgent(): Agent { getLaunchCommand(config: AgentLaunchConfig): string { const binary = resolvedBinary ?? "codex"; - const parts: string[] = [shellEscape(binary)]; + const parts: string[] = [shellEscape(binary), "exec"]; appendNoUpdateCheckFlag(parts); appendApprovalFlags(parts, config.permissions);