📚AI 编程官方教程中文版
📘 OpenAI Codex📚 官方教程中文版实战场景

让 Codex 审查 GitHub PR

Codex code review 可以在 GitHub pull request 上自动指出 regressions、missing tests、docume

Codex code review 可以在 GitHub pull request 上自动指出 regressions、missing tests、documentation issues 和 risky behavior changes,作为人工 review 前的额外信号。

官方页面:https://developers.openai.com/codex/use-cases/github-code-reviews

官方封面图路径:https://developers.openai.com/codex/use-cases/gh-pr-use-case.png

适合什么任务

场景Codex 应该做什么
团队希望 merge 前多一个 review signal自动 review 每个 PR,或按需通过 comment 触发
生产项目的大型 codebase重点看 regression、missing tests 和 risky behavior changes
PR 涉及 secrets、auth、dependency changes$security-best-practices 强化安全相关 review

推荐运行环境:cloud

使用的能力

能力用法链接
$security-best-practices把 review 聚焦到 secrets、auth、dependency changes 等 risky surfaceshttps://github.com/openai/skills/tree/main/skills/.curated/security-best-practices

相关官方说明:

起始提示词

在 GitHub pull request comment 里可以这样触发:

@codex review 请重点检查 security regressions、missing tests 和 risky behavior changes。

如果 Codex 指出了 regression 或 potential issue,可以继续在 PR 里评论:

@codex fix it 请修复这个问题。

这会启动一个新的 cloud task,修复问题并更新 pull request。

使用方式

  1. 先把 Codex code review 添加到 GitHub organization 或 repository。
  2. 选择自动 review 每个 pull request,或在需要时用 @codex review 手动触发。
  3. 如果 Codex 提出问题,先 review 它的 evidence 和建议。
  4. 需要它修复时,再用 @codex fix it 触发后续 task。

定义 Review Guidance

如果希望 Codex 按团队标准 review,在 repo 顶层 AGENTS.md 中加入 review guidance。

官方示例:

## 审查建议

- 把 typos 和 grammar issues 标为 P0 issues。
- 把 potential missing documentation 标为 P1 issues。
- 把 missing tests 标为 P1 issues。
  ...

实际项目里,建议把 guidance 写成真正的风险标准,例如:

  • secrets、tokens、credentials 相关改动必须指出。
  • auth、payment、permission、data deletion 改动要提高优先级。
  • public API、database migration、background job 要检查回滚和兼容。
  • 缺少测试时说明应补哪类测试。

Codex 会读取离 changed file 最近的 AGENTS.md。如果某个 package 需要更具体的 review 标准,可以在更深层目录放一个更贴近该模块的 AGENTS.md

验收重点

Codex review 不是替代人工 review。它适合先筛出:

  • regression risk。
  • missing tests。
  • risky behavior changes。
  • documentation gaps。
  • security-sensitive surfaces。

人工 review 仍然要判断业务语义、产品取舍和最终合并风险。

On this page