Run Codex¶
Requires the OpenAI Codex CLI on PATH and its credentials
(OPENAI_API_KEY or a completed codex login; CODEX_HOME is forwarded).
What the adapter runs¶
codex exec --json --sandbox workspace-write --skip-git-repo-check
--color never -C <worktree> -c sandbox_workspace_write.network_access=false
-o <last-message-file> -
with the prompt on stdin. The JSONL stream is parsed incrementally into command executions
(with exit codes and output), file changes, MCP tool calls, web searches, todo lists, assistant
messages, per-turn usage and errors. Reasoning items are counted as reasoning_event; their text
is discarded before anything is written. A legacy {"id", "msg": {...}} stream shape is also
understood.
Two honest gaps:
- Codex does not report cost, so
reported_cost_usdstaysnull. Give it a pricing table for estimates. - Codex's stream does not expose model invocations, so
llm_callsisnull.
The flag check¶
New in Harness Lab 0.3.0. Upgrade an older install with
pip install -U harnesslab.
Before a run, Harness Lab compares every flag of the command above with the CLI's --help (codex exec --help, and codex exec resume --help for resumed improvement rounds).
A flag the installed version no longer lists makes the run unavailable: it is not verified, it
does not count in pass rates, and its error names the flag and the CLI version. harnesslab
doctor shows such a CLI as incompatible. A run the CLI still refuses at startup (an unknown
option) is reported the same way rather than as a failed attempt. The check covers the flags
Harness Lab itself passes; a variant's own extra_args are left to the CLI, because a CLI can
accept flags its help does not list, and a refusal of one is still caught at startup. Update the
CLI or Harness Lab, change the variant's options, or set flag_check: false to turn the check
off.
Variant options¶
| Option | Default | Effect |
|---|---|---|
model |
CLI default | -m |
sandbox |
workspace-write |
workspace-write, read-only, or the explicit opt-in danger-full-access |
full_auto |
none | No effect. Codex CLI 0.153 rejects --full-auto; --sandbox workspace-write already selects the same sandbox, and codex exec never stops for approval. |
network_access |
false |
-c sandbox_workspace_write.network_access= |
reasoning_effort |
unset | -c model_reasoning_effort= |
profile |
unset | --profile <name>; with Codex CLI 0.153 a profile is a <name>.config.toml file layered over the base configuration |
config_overrides |
{} |
-c key=value for each entry, e.g. a compaction limit |
action_policy |
unset | batched, fine or free text prepended to the prompt |
harness |
unset | a harness bundle directory |
skip_git_repo_check |
true |
--skip-git-repo-check |
improve_session (0.3.0) |
fresh |
improvement tasks only: resume relies on Codex's session persistence (on by default) and continues later rounds with codex exec resume … <thread id> -, passing the sandbox as -c sandbox_mode= and no -C; cannot be combined with profile, --ephemeral or extra_args that codex exec resume rejects; see Fresh or resumed sessions |
extra_args |
[] |
appended verbatim |
flag_check (0.3.0) |
true |
compare the flags Harness Lab passes with the CLI's --help before a run; see the flag check |
env_passthrough |
[] |
extra environment variables forwarded |
executable |
codex |
the binary to run |
danger-full-access is never selected implicitly.
With a harness bundle¶
Codex has no plugin mechanism, so the bundle's system_prompt.md and each skill's text become a
prompt prefix placed before the action policy and the task prompt. hooks.json and agents/ are
unsupported; the adapter records one harness_components_ignored system event naming them rather
than dropping them silently.
Example variant¶
variants:
- id: codex-high-effort
runner: codex
model: gpt-5-codex
reasoning_effort: high
config_overrides: { model_context_window: 200000 }
network_access: false
The adapter is verified against recorded JSONL fixtures and a stand-in executable that replays
them through the real adapter code. To exercise the real CLI:
HARNESSLAB_INTEGRATION=1 uv run pytest tests/test_integration_real.py from a clone.