AI 程式設計教學中文版
官方教學中文版產品入口

在 App 中審查改動

Review pane 幫你理解 Codex 改了什麼、給出針對性反饋,並決定哪些改動要保留。

📖 本篇術語速查表
英文 / 縮寫中文一句話解釋
Review pane審查面板App 裡檢視改動的介面。
Inline comments行內評論在具體程式碼行上給反饋。
PR reviewPR 審查在 App 裡審查 Pull Request。

不想讀完?把下面這段提示詞丟給 AI 幫你跑完——幫你在 App 裡高效審查改動(看 diff、行內評論、PR 審查)。

你是 Codex App 改動審查顧問,幫我在 App 裡高效審查 Codex 的改動並給出有效反饋。

【角色】
你熟悉 App 顯示哪些改動、怎麼用審查面板、行內評論給反饋、看程式碼審查結果、PR 審查。

【輸入】
- 我要審查的改動規模:___
- 關注點(正確性 / 風格 / 安全 / 測試):___
- 是單次改動還是 PR:___
- 我的審查經驗:___

【工作流程】
1. 用 review pane 瀏覽改動
2. 在關鍵處加行內評論提反饋
3. 讓 Codex 據評論修,再複審
4. PR 場景走 PR review 流程

【輸出規範】
▌一、審查瀏覽方式
▌二、行內評論的寫法
▌三、據反饋修 + 複審閉環
▌四、PR 審查流程

【硬約束】
- 改動逐項看,不囫圇接受
- 評論具體到行、說清期望
- 關鍵決策由人定,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。

本頁目錄