📚AI 编程官方教程中文版
官方教程中文版产品入口

在 App 中审查改动

Review pane 帮你理解 Codex 改了什么、给出针对性反馈,并决定哪些改动要保留。

Review pane 帮你理解 Codex 改了什么、给出针对性反馈,并决定哪些改动要保留。

它只适用于位于 Git repository 内的 projects。如果你的 project 还不是 Git repository,review pane 会提示你创建一个。

What changes it shows

Review pane 反映的是整个 Git repository 的状态,而不只是 Codex 编辑过的内容。

它会显示:

  • Codex 做出的 changes。
  • 你自己做出的 changes。
  • repo 中其他 uncommitted changes。

默认情况下,review pane 聚焦 uncommitted changes。你也可以切换 scope:

Scope说明
All branch changes和 base branch 做 diff。
Last turn changes只看最近一个 assistant turn 的改动。

本地工作时,还可以在 UnstagedStaged changes 之间切换。

常用操作:

  • 点击 file name,通常会在你选择的 editor 中打开该文件。默认 editor 可以在 settings 中选择。
  • 点击 file name background,可以展开或折叠 diff。
  • 按住 Cmd 点击某一行,会在你选择的 editor 中打开对应行。
  • 如果满意某个 change,可以 stage changes 或 revert 不想保留的 changes

Inline comments for feedback

Inline comments 可以把 feedback 直接附到 diff 的具体行上。这通常是引导 Codex 进行正确修改的最快方式。

留下 inline comment 的步骤:

  1. 打开 review pane。
  2. hover 你想 comment 的 line。
  3. 点击出现的 + button。
  4. 写下 feedback 并提交。
  5. 留完 feedback 后,回到 thread 发一条消息。

因为 comments 和具体行绑定,Codex 通常能比泛泛的 instruction 更精确地响应。

Codex 会把 inline comments 当作 review guidance。留下 comments 后,再发送一条明确意图的 follow-up message,例如:

Address the inline comments and keep the scope minimal.

Code review results

如果你用 /review 运行 code review,comments 会直接 inline 出现在 review pane 中。

官方截图:

Pull request reviews

当 Codex 拥有当前 repository 的 GitHub access,并且当前 project 位于 pull request branch 上,Codex App 可以帮你在不离开 App 的情况下处理 pull request feedback。

sidebar 会显示 pull request context 和 reviewers 的 feedback。review pane 会把 comments 和 diff 放在一起,这样你可以在同一个 thread 中要求 Codex 处理问题。

安装 GitHub CLI gh,并用下面的命令完成认证:

gh auth login

这样 Codex 才能加载 pull request context、review comments 和 changed files。如果缺少 gh 或没有认证,pull request details 可能不会出现在 sidebar 或 review pane 中。

适合把完整修复循环留在一个地方时使用这个流程:

  1. 在 pull request branch 上打开 review pane。
  2. Review pull request context、comments 和 changed files。
  3. 要求 Codex 修复你指定的 comments。
  4. 在 review pane 中检查生成的 diff。
  5. 准备好后,stage、commit,并 push changes 到 PR branch。

GitHub-triggered reviews 见:

https://developers.openai.com/codex/integrations/github

Staging and reverting files

Review pane 包含 Git actions,方便你在 commit 前整理 diff。

你可以在这些层级 stage、unstage 或 revert changes:

层级说明
Entire diff使用 review header 中的 action buttons,例如 "Stage all" 或 "Revert all"。
Per file对单个 file stage、unstage 或 revert。
Per hunk对单个 hunk stage、unstage 或 revert。

当你想接受部分工作时,使用 staging。当你想丢弃某些改动时,使用 revert。

staged 和 unstaged 状态

Git 允许同一个文件同时存在 staged 和 unstaged changes。出现这种情况时,pane 可能看起来像是在 staged 和 unstaged views 中把“同一个文件显示了两次”。这是正常 Git behavior。

On this page