Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-codex-exec-launch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aoagents/ao-plugin-agent-codex": patch
---

Launch Codex worker sessions with `codex exec` so spawned AO workers run non-interactively.
8 changes: 4 additions & 4 deletions packages/plugins/agent-codex/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
});

Expand Down Expand Up @@ -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'",
);
});

Expand Down Expand Up @@ -1971,15 +1971,15 @@ 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
await agent.postLaunchSetup!(makeSession({ workspacePath: "/workspace/test" }));

// 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",
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/agent-codex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down