Add staged-only code review target via index snapshot

Resolved 💬 2 comments Opened Mar 11, 2026 by 0xble Closed Apr 18, 2026

Summary

Add a staged-only review mode to codex exec review and the app-server review APIs.

Proposed usage:

  • codex exec review --staged

Motivation

review --uncommitted is useful for reviewing the entire working tree, but in many real workflows the desired review scope is the exact staged set that is being prepared for shipping. Uncommitted changes are often broader or noisier than the intended review target, while staging provides precise control over scope, including hunk-level selection within a file.

Proposed behavior

When --staged is used, review should run against a temporary snapshot materialized from the current Git index, so the reviewer sees exactly the staged contents and does not get confused by unstaged edits in the working tree.

Implementation notes

The core design is to treat this as a Git/data-source feature rather than a prompt-only feature:

  • add a staged review target through protocol and app-server surfaces
  • add --staged to codex exec review
  • create a detached temporary worktree from HEAD
  • copy the current index into that worktree
  • materialize the staged tree with git checkout-index
  • run the review turn from that snapshot cwd for the lifetime of the review task

Validation

A working implementation is available here:

That PR is for my personal use right now, and I am using it locally from my fork rather than submitting it as an upstream PR.

That PR includes passing targeted tests for git snapshot behavior, core prompt/hint behavior, exec request building and CLI parsing, and app-server review start behavior.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗