codex harness runs the OpenAI Codex CLI non-interactively in a benchmark-prepared workspace.
How it works
- Prepare Codex CLI. An optional Runtime Capsule supplies Node/npm first; if
codexis absent, the harness then appliesinstall_strategyandinstall_command. - Configure and run. The harness writes a session-scoped Codex provider configuration and invokes the CLI non-interactively in the task workspace. Recipes may place this configuration outside the repository so it cannot enter a generated patch.
- Collect results. Codex JSON events are normalized into the trajectory, final answer, and execution status in a
RunResult.
Parameters
Pass harness options with--harness-params '{...}'. The table exposes the installation, provider, and execution behavior that normally needs tuning; path and upload details use built-in defaults.
Parameter reference
| Parameter | Type | Default | Choices / values | Description |
|---|---|---|---|---|
install_strategy | string | install_if_missing | preinstalled / install_if_missing / upload | How to prepare Codex. |
install_command | string | npm install -g @openai/codex | shell command | Command used when Codex is missing. |
setup_capsule_tag | string | unset | node24-v1 | Optional predefined Node toolchain Capsule injected before Codex installation. |
sandbox | string | workspace-write | read-only / workspace-write / danger-full-access | Codex sandbox policy. |
reasoning_effort | string | unset | provider-supported effort | Value written to Codex as model_reasoning_effort. |
dangerously_bypass_approvals_and_sandbox | bool | true | true / false | Whether to pass —dangerously-bypass-approvals-and-sandbox. Set it to false only when the Codex approval and sandbox flow must be retained. |
Model API
Codex requires an OpenAI-compatible--model-base-url and --model-api-key. --model-api-protocol openai-responses selects the Responses API and openai-chat selects Chat Completions; the CLI protocol takes precedence over the harness’s internal wire_api fallback. The harness appends /v1 when it is absent from the base URL.
Run examples
- Default
- Custom params
- Runtime Capsule
Run with the default installation and workspace-write policy.
Output
The harness returns aRunResult per task: trajectory, final answer, and execution status. Per-task details and aggregate metrics are written by the benchmark under the run directory (see Results).
Set the task execution deadline through --execution-params with run_timeout_seconds and run_timeout_multiplier. See phase timeouts.