codex-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodex Review
Codex代码审查
Run Codex's built-in code review as a closeout check. This is code review (), not Guardian approval routing.
codex reviewauto_reviewUse when:
- user asks for Codex review / autoreview / second-model review
- after non-trivial code edits, before final/commit/ship
- reviewing a local branch or PR branch after fixes
将Codex内置的代码审查作为收尾检查来运行。这是代码审查(),而非Guardian的审批流程。
codex reviewauto_review适用场景:
- 用户要求进行Codex审查/自动审查/第二模型审查
- 在完成非琐碎代码编辑后、最终提交/发布前
- 修复后审查本地分支或PR分支
Contract
规范
- Treat review output as advisory. Never blindly apply it.
- Verify every finding by reading the real code path and adjacent files.
- Read dependency docs/source/types when the finding depends on external behavior.
- Reject unrealistic edge cases, speculative risks, broad rewrites, and fixes that over-complicate the codebase.
- Prefer small fixes at the right ownership boundary; no refactor unless it clearly improves the bug class.
- Keep going until Codex review returns no accepted/actionable findings.
- If a review-triggered fix changes code, rerun focused tests and rerun Codex review.
- Never switch or override the review model. If the review hits model capacity, retry the same command a few times with the same model. If it hits sandbox/permission limits, use the helper's option instead of changing models.
--full-access - Stop as soon as the review command/helper exits 0 with no accepted/actionable findings. Do not run an extra direct just to get a nicer "clean" line, a second opinion, or clearer closeout wording.
codex review - Treat the helper's successful exit plus absence of actionable findings as the clean review result, even if the underlying Codex CLI output is terse.
- If rejecting a finding as intentional/not worth fixing, add a brief inline code comment only when it explains a real invariant or ownership decision that future reviewers should know.
- Do not push just to review. Push only when the user requested push/ship/PR update.
- 将审查结果视为参考建议,切勿盲目应用。
- 通过阅读实际代码路径及关联文件验证每一项发现。
- 当发现内容依赖外部行为时,查阅依赖文档/源码/类型定义。
- 拒绝不切实际的边缘情况、推测性风险、大范围重写以及使代码库过度复杂的修复方案。
- 优先在合适的职责边界进行小修复;除非能明确改善bug类别,否则不要重构。
- 持续运行直到Codex审查不再返回可接受/可执行的发现。
- 若审查触发的修复修改了代码,重新运行针对性测试并再次执行Codex审查。
- 切勿切换或覆盖审查模型。若审查达到模型容量限制,使用相同模型重试几次相同命令。若遇到沙箱/权限限制,使用助手的选项而非更换模型。
--full-access - 一旦审查命令/助手以0状态退出且无任何可接受/可执行的发现,立即停止。不要为了获得更美观的“干净”输出、二次意见或更清晰的收尾表述而额外运行。
codex review - 即使底层Codex CLI输出简洁,只要助手成功退出且无任何可执行发现,即可视为审查结果干净。
- 若因设计如此/修复价值低而拒绝某项发现,仅当该发现涉及未来审查者应知晓的实际不变量或职责决策时,添加简短的行内代码注释。
- 不要只为了审查而推送代码。仅当用户要求推送/发布/更新PR时才进行推送。
Pick Target
选择审查目标
Dirty local work:
bash
codex review --uncommittedUse this only when the patch is actually unstaged/staged/untracked in the
current checkout. For committed, pushed, or PR work, review the branch against
its base instead; do not force / just because the
helper docs mention dirty work first. A clean review only proves
there is no local patch.
--mode local--uncommitted--uncommittedBranch/PR work:
bash
git fetch origin
codex review --base origin/mainDo not pass an inline prompt with ; current CLI rejects + even though help text is ambiguous. If custom instructions are needed, run the plain base review first, then do a local/manual follow-up pass.
--base--base[PROMPT]If an open PR exists, use its actual base:
bash
base=$(gh pr view --json baseRefName --jq .baseRefName)
codex review --base "origin/$base"Committed single change:
bash
codex review --commit HEAD本地未提交工作:
bash
codex review --uncommitted仅当当前检出版本中确实存在未暂存/已暂存/未跟踪的补丁时使用此命令。对于已提交、已推送或PR中的工作,请审查分支与其基准分支的差异;不要因为助手文档首先提到未提交工作就强制使用 / 。审查仅能证明本地无补丁。
--mode local--uncommitted--uncommitted分支/PR工作:
bash
git fetch origin
codex review --base origin/main使用时不要传入内联提示;当前CLI会拒绝 + 组合,尽管帮助文本表述模糊。若需要自定义指令,先运行基础审查,再进行本地/手动后续检查。
--base--base[PROMPT]若存在已打开的PR,使用其实际基准分支:
bash
base=$(gh pr view --json baseRefName --jq .baseRefName)
codex review --base "origin/$base"已提交的单次变更:
bash
codex review --commit HEADParallel Closeout
并行收尾
Format first if formatting can change line locations. Then it is OK to run tests and review in parallel:
bash
scripts/codex-review --parallel-tests "<focused test command>"Tradeoff: tests may force code changes that stale the review. If tests or review lead to code edits, rerun the affected tests and rerun review until no accepted/actionable findings remain. Once that rerun exits cleanly, stop; do not spend another long review cycle on redundant confirmation.
若格式化会改变代码行位置,先执行格式化。之后可并行运行测试与审查:
bash
scripts/codex-review --parallel-tests "<focused test command>"权衡点:测试可能会强制修改代码,导致审查结果过时。若测试或审查引发代码编辑,重新运行受影响的测试并再次执行审查,直到无任何可接受/可执行的发现。一旦重新运行后干净退出,立即停止;不要花费额外的审查周期进行冗余确认。
Context Efficiency
上下文效率
Codex review is usually noisy. Default to a subagent filter when subagents are available. Ask it to run the review and return only:
- actionable findings it accepts
- findings it rejects, with one-line reason
- exact files/tests to rerun
Run inline only for tiny changes or when subagents are unavailable.
Codex审查通常会产生较多冗余信息。当有子代理可用时,默认使用子代理过滤器。要求它运行审查并仅返回:
- 它接受的可执行发现
- 它拒绝的发现及一行理由
- 需要重新运行的具体文件/测试
仅在微小变更或子代理不可用时直接运行审查。
Helper
助手工具
Bundled helper:
bash
~/.codex/skills/codex-review/scripts/codex-review --helpIf installed from , path is:
agent-scriptsbash
/Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --helpThe helper:
- chooses dirty first
--uncommitted - otherwise uses current PR base if works
gh pr view - otherwise uses for non-main branches
origin/main - should be left in or forced to
--mode autofor committed/PR work; do not force--mode branchafter committing--mode local - writes only to stdout unless or
--outputis setCODEX_REVIEW_OUTPUT - supports and
--dry-run--parallel-tests - supports for nested review runs that need localhost bind/listen tests
--full-access - prints when the selected review command exits 0
codex-review clean: no accepted/actionable findings reported
内置助手:
bash
~/.codex/skills/codex-review/scripts/codex-review --help若从安装,路径为:
agent-scriptsbash
/Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --help助手功能:
- 优先选择未提交的模式
--uncommitted - 若可用,则使用当前PR的基准分支
gh pr view - 否则,对非主分支使用作为基准
origin/main - 应保持或对已提交/PR工作强制使用
--mode auto;提交后不要强制使用--mode branch--mode local - 除非设置了或
--output,否则仅输出到标准输出CODEX_REVIEW_OUTPUT - 支持和
--dry-run选项--parallel-tests - 支持选项,用于需要本地主机绑定/监听测试的嵌套审查运行
--full-access - 当选定的审查命令以0状态退出时,输出
codex-review clean: no accepted/actionable findings reported
Final Report
最终报告
Include:
- review command used
- tests/proof run
- findings accepted/rejected, briefly why
- the clean review result from the final helper/review run, or why a remaining finding was consciously rejected
Do not run another Codex review solely to improve the final report wording. If the final helper run exited 0 and produced no accepted/actionable findings, report that exact run as clean.
需包含:
- 使用的审查命令
- 运行的测试/验证依据
- 接受/拒绝的发现及简要理由
- 最终助手/审查运行返回的干净结果,或为何有意识地拒绝剩余发现
不要只为了优化最终报告的表述而再次运行Codex审查。若最终助手运行以0状态退出且无任何可接受/可执行的发现,直接报告该次运行结果为干净。