Expand description
Codex agent backend: drives codex exec --json headless.
Ground truth is crates/engine/tests/fixtures/codex_exec_scrutiny.jsonl,
a recorded codex exec --json transcript. This module is single-shot
only: unlike backend_claude, there is no --resume and no
streaming-input mode, so CodexSession::send_user_message and a
resumed SessionSpec are both rejected at the seam rather than
translated into codex flags.
Several SessionSpec fields are claude-isms with no codex equivalent and
are deliberately ignored when building argv: json_schema,
max_budget_usd, resume, permission_mode, allowed_tools /
disallowed_tools, tools, settings_json, effort.
Structs§
- Codex
Backend - The
AgentBackendforcodex exec --json: single-shot with sandbox mode selected from the session role. - Codex
Session - A live
codex exec --jsonsession (theAgentSessionimpl). - Codex
Stream Parser - Stateful wrapper around
parse_codex_linethat remembers the most recentagent_messageAgentEvent::Textand stitches it into the terminalAgentEvent::Resultwhen aturn.completedline arrives.
Functions§
- build_
args - Build the argv (excluding the binary itself) for one session.
- discover_
codex_ binary - Locate a working
codexbinary. - parse_
codex_ line - Parse one stdout line into zero or more
AgentEvents.modelis the configured model, used both as theInitfallback (codex’sthread.startedcarries no model field in observed output) and as the pricing key when a terminal event has no CLI-reported dollar cost. - parse_
codex_ value - Map one parsed
codex exec --jsonvalue to events (see module docs / fixture).