run_codex
Run Codex CLI asynchronously for batch code generation or patch tasks, with automatic retries on rate limits and session resumption for continued context.
Instructions
Async call Codex CLI (codex exec) to run a task. For batch codegen/patches. Non-blocking. Auto-tracks task. Pass session_id to resume a prior Codex session (preserves context); the new session id is captured from output and returned for later resumption. Retries automatically on 429/rate-limit/timeout with exponential backoff (default 2 retries, 3 total attempts); set max_retries=0 to disable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| auto | No | ||
| model | No | ||
| prompt | Yes | ||
| task_id | No | ||
| workdir | No | ||
| reasoning | No | codex reasoning effort override, e.g. 'low' (default) / 'medium' / 'high'. low suppresses <PROVIDER> 429 for real long tasks. | |
| session_id | No | ||
| max_retries | No | Max retries after the first attempt on 429/timeout (0-5, default 2). 0 = fail on first error. | |
| timeout_sec | No | ||
| fork_on_fail | No | A 失败自动 fork:真失败时把任务父标记 superseded 并生成备选子任务给此 agent 承接(仅对属于工作流的任务,≤3 演进上限)。传备选 agent 名(codex/claude/qwen/dsh/opencode)即启用;不传则不自动 fork。 | |
| retry_max_ms | No | Cap on backoff delay in ms (default 30000). | |
| capture_trace | No | 捕获本次任务的完整推理 step 流(含中间日志/思考)存 task.trace。默认 false(省存储)。 | |
| retry_base_ms | No | Base backoff delay in ms (default 2000). Honors Retry-After if the CLI surfaces one. |