/review base-branch picker includes current branch (e.g. main -> main)
Open 💬 3 comments Opened Feb 26, 2026 by enriquemorenotent
💡 Likely answer: A maintainer (enriquemorenotent, contributor)
responded on this thread — see the highlighted reply below.
Summary
When using /review -> Review against a base branch, the picker includes the currently checked out branch as a base option.
Example shown in UI while on main:
main -> main
Why this is a problem
Selecting the current branch as its own base is not a meaningful comparison target for PR-style review and is confusing in the picker.
Reproduction
- Checkout
main(or any branch). - Run
/reviewin TUI. - Choose
Review against a base branch. - Observe that the list contains
<current> -> <current>.
Actual
Current branch is included in the base-branch options.
Expected
Current branch should be excluded from base-branch options (or clearly disabled as non-selectable).
3 Comments
I dug into this and found a concrete root cause in the TUI flow:
show_review_branch_pickerbuilds options from all local branches returned bylocal_git_branches(cwd).main -> mainare rendered and selectable.Proposed fix (minimal scope):
current_branchfrom the base-branch options list before building picker items.If this approach matches maintainers’ intent, would a Codex team member invite me to open a PR for this?
(and yes, the post has been AI-generated, but it has been human reviewed ;)
Repro
main./reviewbase-branch picker was offering the current branch as a candidate base branch, so flows likemain -> maincould be selected.Root Cause
show_review_branch_pickerwas usinglocal_git_branches(cwd)unchanged in bothtui/src/chatwidget.rsandtui_app_server/src/chatwidget.rs.current_branchbefore building the selection items in both copies and added deterministic regression coverage with a temporary git repo initialized onmainplus afeaturebranch.Validation
cargo test -p codex-tui review_branch_picker_excludes_current_branchcargo test -p codex-tui-app-server review_branch_picker_excludes_current_branchjust fix -p codex-tuijust fix -p codex-tui-app-serverCARGO_TARGET_DIR=/tmp/codex-target-12942-tui-full cargo test -p codex-tuiCARGO_TARGET_DIR=/tmp/codex-target-12942-app-full cargo test -p codex-tui-app-serverRisk
Maintainer Pickup