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。

本頁目錄