| Phase | 8 — Headless server & exec |
| Status | Not started |
| Depends on | 33 |
| Size | M |
| Drop-in critical | ★★ (codex exec JSONL output) |
Port codex-exec: the non-interactive codex exec mode for scripting/CI. This is
the first end-to-end usable milestone — a full agent turn with tools/sandbox,
driven headlessly, with Codex-compatible output.
reference-codex/codex-rs/exec/src/(cli.rsflags,event_processor_with_jsonl_output.rs, in-process client usage, resume/review).reference-codex/docs/exec.md.
- Run an agent turn via the in-process app-server client (spec 33) from a prompt (arg/stdin) and an optional image input.
- Flags:
--json(JSONL, one event per line),--output-last-message FILE,--output-schema FILE(constrain response), default human-readable text (final message to stdout). Subcommandsresume,review. - JSONL event model: transform
ServerNotifications into the execThreadEventtypes (ThreadStartedEvent,TurnStartedEvent,CommandExecutionItem,PatchApplyStatus,TodoListItem,ThreadErrorEvent, …) with the same{type, id, timestamp, …}shape; final statussuccess/failed/interrupted. - Exit codes matching Codex (
exit_statusconventions; signals as 128+n on Unix).
- Differential:
codexgo exec --json "<prompt>"over a mocked model produces the same JSONL event stream (line-by-line, after canonicalization) ascodex exec. --output-last-message/--output-schemabehave identically.- Exit codes match across success/failure/interrupt scenarios.
- Human-readable (non-json) output is equivalent (allowing for cosmetic spacing documented as deviations).
- The exec
ThreadEventmapping is a distinct surface from rawEventMsg; capture both and map precisely. - Deterministic timestamps in fixtures (inject a clock) for golden comparisons.
- Interactive TUI (Phase 9); cloud
execvariants beyond local.