Skip to main content

Module codex

Module codex 

Source
Expand description

OpenAI Codex (codex) as a Harness.

Same process-spawn shape as the bob and Claude adapters — a different binary, flags, and stdout parser. We invoke codex exec --json and parse its JSONL into the shared normalized crate::RunEvent stream.

Auth: like Claude Code, Codex manages its own credentials (its codex login / ChatGPT auth or its own OPENAI_API_KEY in the environment), so Compose does not store or inject a key — credential().required is false.

The stdout wire format and its decode — including the stateful CodexStreamParser that resolves codex’s preamble-vs-answer ambiguity — live in [parser].

Structs§

CodexHarness
OpenAI Codex CLI as a Harness.
CodexStreamParser
Stateful per-run wrapper over parse_codex_line that resolves codex’s preamble-vs-answer ambiguity and drops its stderr noise. One per run.

Constants§

CODEX_HARNESS_ID
Registry id for the Codex harness.

Functions§

parse_codex_line
Parse one line of codex exec --json JSONL into the shared ParsedLine. Assistant text is the full agent_message on item.completed; tool items (command_execution, file_change, web_search, mcp_tool_call) become structured tool cards (ToolStart/ToolEnd). Codex edits files directly via tools (reflected on disk by the file watcher), so it never emits suggested-edit previews — edits stays empty.