Add codex exec review: headless code review

Resolved 💬 6 comments Opened Nov 9, 2025 by felixzc8 Closed Aug 4, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

Why
Enable CI/automation without requiring the interactive TUI.

What
Introduce codex exec review command with presets:

  • uncommitted
  • base-branch <branch>
  • commit <hash> [--subject <subject>]
  • custom [PROMPT|-]

How
Reuse existing review flow and emit lifecycle events.
Surface a structured JSON result for machine parsing; keep human mode to final review text on stdout.

Examples
codex exec review uncommitted
codex exec review base-branch main
codex exec review commit d5853d9 --subject "Fix sandbox"
codex exec review custom "Check for security vulnerabilities"

Acceptance
All presets run end-to-end with TUI-equivalent output.
Structured result is CI-friendly and easy to parse; human mode prints only final review content.
Behavior matches current codex review logic.

Note: Implementation ready — opening this issue for visibility and review. Happy to open PR if maintainers are open to this feature.

Additional information

_No response_

View original on GitHub ↗

6 Comments

github-actions[bot] contributor · 9 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #6023

Powered by Codex Action

IANTHEREAL · 9 months ago

I don't think It conflicts with #6023. Using codex as a agent tool or in multi agents scenario, a system prompt will potentially occupy contextual space.

ThomasFD · 8 months ago

Headless review is already supported via the non-interactive runner:

  • Uncommitted: codex exec review --uncommitted
  • Base branch: codex exec review --base main
  • Commit: codex exec review --commit <SHA> --title "..." (title is supported)

For CI/multi-agent workflows where you want the final TUI-equivalent review text as a
single blob, use JSONL mode and extract the last agent_message:

  codex exec --json --sandbox read-only review --uncommitted \
    | jq -rs '[.[] | select(.type=="item.completed" and .item.type=="agent_message")
  | .item.text] | last // ""'

This avoids tail truncation (messages are multi-line) and gives a clean machine-consumable
way to grab the final review output.

source: I used codex in the codex repo. only tested uncommitted myself

IANTHEREAL · 8 months ago

@ThomasFD I will test codex exec review --base and remove [prompt]

IANTHEREAL · 8 months ago

@ThomasFD I’m running headless review in --json mode and trying to capture the final verdict to a file with -o, but it writes an empty file:

codex exec --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox \
  --json -o code_review.log review "is there a bug for review agent?"

I consistently get:

Warning: no last agent message; wrote empty content to code_review.log

This is a poor experience for CI/multi-agent workflows because I want a single, TUI-equivalent “final review” blob saved to a file without requiring jq/post-processing. Ideally, when -o is provided.

etraut-openai contributor · 24 days ago

codex exec review now supports uncommitted, base, and commit reviews.