AI changes repositories faster and faster, and the bottleneck is often "who reviews this diff." On the Claude Code side, this site already covers /code-review and REVIEW.md; Codex CLI ships its own dedicated entry point: /review inside a session, or the non-interactive codex review. The official CLI docs place it as "local review before you commit or open a PR," separate from the main session where code gets written.
In this article we ran it for real on Codex CLI 0.164.0 + this site's api.aicodewith.ai provider (model=gpt-5.6-sol): a small local git repository with deliberately planted regressions, running both codex review --uncommitted and codex review --base main. The yardstick is still the open-source repository's rubric.md (rust-v0.164.0).
The bottom line first:
- In-session
/review/ CLIcodex review: pick one of four: uncommitted, against a base, a single commit, or a custom prompt. - The review thread defaults to
sandbox: read-onlyandapproval: never(as shown in the session header on stderr on our machine); it only reads the diff and does not change the working tree. - "Empty results" really do happen: minor flaws (such as "division by zero raises the standard exception") are filtered out by the rubric; clearly breaking existing semantics produces
[P1]. approvals_reviewer=auto_reviewis not code review; don't confuse it with/review.
Our test environment
codex --version
# 输出:codex-cli 0.164.0
# Provider / 模型(config.toml,不展示 Key)
# model_provider = "codex"
# model = "gpt-5.6-sol"
# base_url = https://api.aicodewith.ai/chatgpt/v1
# wire_api = responses
Demo repository path: /workspace/codex-live-demo (main has the initial mathutil.py; feature/review-demo then adds helpers.py and divide).
How it lines up with "AI reviewing the diff before a PR"
The site's use case page AI code review is about having a model read the diff before a PR and find logic traps. Codex's /review is the official implementation of exactly that layer. For end-to-end acceptance by clicking through pages, see verification skill; this article covers only diff review.
| Goal | In a session | Non-interactive command | What it reads |
|---|---|---|---|
| Uncommitted changes | /review → Uncommitted | codex review --uncommitted | staged + unstaged + untracked |
| Against a baseline (PR style) | /review → base branch | codex review --base main | Branch diff against the merge-base |
| A single commit | /review → commit | codex review --commit <SHA> | Changes introduced by that commit |
| Custom instructions | /review → custom | codex review "Focus on …" | Narrowed by your wording |
Test 1: minor flaws → empty result (checking the rubric)
Against the main root commit, the working tree adds, uncommitted, divide(a,b): return a/b and an untracked helpers.py (first returns items[0]). Run:
cd /workspace/codex-live-demo
codex review --uncommitted
# 墙钟耗时:18.656 秒;exit 0
Session header (stderr, excerpt):
OpenAI Codex v0.164.0
workdir: /workspace/codex-live-demo
model: gpt-5.6-sol
provider: codex
approval: never
sandbox: read-only
The stdout verdict, verbatim:
The new code has no identifiable regression or actionable defect based on the available repository context. Division by zero and empty-sequence access retain standard Python exception behavior.
This matches rubric.md: it only reports hard defects introduced by this change that "the author would most likely fix if they knew"; "no division-by-zero guard" often doesn't count when there is no project convention for it. An empty output does not mean the CLI is broken.
Test 2: a clear regression → two [P1]
Change the uncommitted edits so they clearly break existing semantics:
# helpers.py:first 改成 return items[-1]
# mathutil.py:average 直接 return 0
codex review --uncommitted
# 墙钟耗时:15.659 秒;exit 0
stdout summary (original structure kept):
Both modified functions violate their existing behavior: `first` returns the wrong element for multi-item inputs, and `average` ignores its input entirely.
Full review comments:
- [P1] Preserve first-item semantics — /workspace/codex-live-demo/helpers.py:3-3
For any sequence containing more than one item, this now returns the last element instead of the first...
- [P1] Compute the requested average — /workspace/codex-live-demo/mathutil.py:7-7
For every non-empty input whose average is not zero, this returns `0` regardless of the supplied values...
Test 3: codex review --base main
After committing "add divide/helpers" on feature/review-demo, compare against main:
codex review --base main
# 墙钟耗时:11.786 秒;exit 0
stderr shows the target as changes against 'main' and uses a merge-base style git diff <main-sha>. This time stdout judged that the new functions fit the "basic arithmetic" semantics and that division by zero raises the standard exception. Once again: a base review looks at the branch diff, not an audit of the whole repository.
How to set it up (command list)
For installing and connecting a Key from this site, see Install / Setup; for day-to-day use, see How to use.
curl -fsSL https://chatgpt.com/codex/install.sh | sh
cd your-repo
codex # 交互里输入 /review
codex review --uncommitted
codex review --base main
codex review --commit <SHA> --title "…"
codex review "Focus on edge cases"
Optional review_model
# ~/.codex/config.toml
# slug 以 /model 列表为准
review_model = "gpt-5.6-sol"
In this test the review thread actually used the session model gpt-5.6-sol (no separate review_model was set).
Don't confuse it with auto_review / Claude Code
| Name | What it actually does | Common misuse |
|---|---|---|
| /review or codex review | Reads the diff and reports prioritized issues | Treating it as automatic bug fixing |
| approvals_reviewer=auto_review | Reviews on your behalf whether to approve privilege escalation / network access | Assuming it reviews code |
| Claude Code /code-review | A separate set of slash commands and REVIEW.md | Copying the commands verbatim into Codex |
| verification skill | End-to-end proof by driving the real app | Using it and diff review as substitutes for each other |
Troubleshooting errors
- 401: first get a normal
codexconversation working, then run review (see 401 troubleshooting). - At capacity / 429: see capacity / 429.
- Empty result: first confirm the diff is not empty, then check against the rubric; if you need a strict security checklist, use a custom prompt.
- Directory trust / sandbox: the review itself is read-only; for day-to-day write permissions, see Sandbox and /permissions.
Suggested workflow
- After editing →
codex review --uncommitted(on the clear regression this time, on the order of 16 seconds); - Before opening a PR →
codex review --base main; - An empty result only means no hard defects by the rubric's standard, not that you can skip testing;
- If you need proof by clicking through pages → use verification, not a longer review prompt.



