Repository navigation
Make exec the default worker mode (codex 0.155+) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| * status Print a run's status (get_loop_status). | ||
| * stop Request a cooperative stop of a run (stop_loop). | ||
| * | ||
| * Worker mode defaults to "mcp-server"; pass --dry-run (or --mode mock) to use | ||
| * Worker mode defaults to "exec"; pass --dry-run (or --mode mock) to use | ||
| * the mock worker with no network / no real Codex call. | ||
| */ | ||
|
|
||
|
|
@@ -45,7 +45,9 @@ Usage: | |
| codex-orchestrator run --project-dir <dir> [--goal-file PROJECT_GOAL.md] | ||
| [--verify "<cmd>" ...] [--max-iterations N] | ||
| [--sandbox workspace-write] [--approval-policy never] | ||
| [--max-runtime-ms N] [--mode mcp-server|exec|mock] [--dry-run] | ||
| [--max-runtime-ms N] [--task-timeout-ms N] | ||
| [--allow-guard <guard-name> ...] | ||
| [--mode mcp-server|exec|mock] [--dry-run] | ||
| codex-orchestrator review --project-dir <dir> [--goal-file PROJECT_GOAL.md] [--verify "<cmd>" ...] | ||
| codex-orchestrator task --project-dir <dir> --prompt "<text>" [--thread-id <id>] [--mode ...] [--dry-run] | ||
| codex-orchestrator status --project-dir <dir> --run-id <id> | ||
|
|
@@ -62,6 +64,8 @@ const options = { | |
| verify: { type: 'string' as const, multiple: true }, | ||
| 'max-iterations': { type: 'string' as const }, | ||
| 'max-runtime-ms': { type: 'string' as const }, | ||
| 'task-timeout-ms': { type: 'string' as const }, | ||
| 'allow-guard': { type: 'string' as const, multiple: true }, | ||
| sandbox: { type: 'string' as const }, | ||
| 'approval-policy': { type: 'string' as const }, | ||
| mode: { type: 'string' as const }, | ||
|
|
@@ -74,7 +78,7 @@ const options = { | |
|
|
||
| function resolveMode(values: Record<string, unknown>): CodexMode { | ||
| if (values['dry-run']) return 'mock'; | ||
| const m = (values.mode as string) ?? 'mcp-server'; | ||
| const m = (values.mode as string) ?? 'exec'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| if (m === 'mock' || m === 'mcp-server' || m === 'exec') return m; | ||
| throw new Error(`Invalid --mode "${m}" (mock|mcp-server|exec)`); | ||
| } | ||
|
|
@@ -114,7 +118,13 @@ async function cmdRun(values: Record<string, unknown>): Promise<number> { | |
| codexMode: mode, | ||
| }, | ||
| createCodexClient({ mode }), | ||
| { onEvent: out }, | ||
| { | ||
| onEvent: out, | ||
| taskTimeoutMs: values['task-timeout-ms'] | ||
| ? parseInt(values['task-timeout-ms'] as string, 10) | ||
| : undefined, | ||
| allowedGuards: (values['allow-guard'] as string[] | undefined) ?? [], | ||
| }, | ||
| ); | ||
|
|
||
| await controller.init(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -332,17 +332,19 @@ export class ExecCodexClient implements CodexClient { | |
|
|
||
| async runTask(input: CodexTaskInput): Promise<CodexTaskResult> { | ||
| const cwd = path.resolve(input.projectDir); | ||
| // First turn: codex exec [--json -s <sandbox> -a <approval>] "<prompt>" | ||
| // Continuation: codex exec resume <id> [--json -s ... -a ...] "<prompt>" | ||
| // `resume` MUST come immediately after `exec`. | ||
| // First turn: codex exec --json -c sandbox_mode=... -c approval_policy=... "<prompt>" | ||
| // Continuation: codex exec resume <id> --json -c ... "<prompt>" | ||
| // `resume` MUST come immediately after `exec`. Sandbox and approval go in as | ||
| // -c overrides: Codex 0.155 dropped `-a` from exec and never had `-s` on | ||
| // `exec resume`, but both accept -c. | ||
| const parts = [this.cli.bin, ...this.cli.execArgs]; | ||
| if (input.threadId) parts.push('resume', input.threadId); | ||
| parts.push( | ||
| this.cli.execJsonFlag, | ||
| '-s', | ||
| input.sandbox, | ||
| '-a', | ||
| input.approvalPolicy, | ||
| '-c', | ||
| shellQuote(`sandbox_mode="${input.sandbox}"`), | ||
| '-c', | ||
| shellQuote(`approval_policy="${input.approvalPolicy}"`), | ||
|
Comment on lines
+344
to
+347
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an API or CLI caller selects the still-advertised Useful? React with 👍 / 👎. |
||
| ); | ||
| // Prompt passed via a single-quoted arg; runCommand uses a shell. | ||
| parts.push(shellQuote(input.prompt)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After announcing exec as the default and stating that Codex 0.155 removed
mcp-server, the same README still labelsmcp-serveras the primary path at lines 249-250, tells users to verify it at lines 280-281, says the default real example uses it at lines 440-442, and describes exec as merely a fallback at lines 458-465. A user following the 0.155 setup instructions will therefore run a removed command and receive an inaccurate explanation of the actual transport; update those sections together with this compatibility statement.Useful? React with 👍 / 👎.