bug: --base silently overrides --scope working-tree, so staged and unstaged changes are not reviewed
Summary
resolveReviewTarget() returns a branch review as soon as --base is present, before it reads --scope. So $cc:review --base main --scope working-tree (and the same for $cc:adversarial-review) reviews main...HEAD and ignores the staged and unstaged changes the caller asked for. Nothing reports that the scope was dropped. The review comes back clean because the diff it looked at did not contain the work.
The skills list --base <ref> and --scope <auto|working-tree|branch> as independent arguments, so a Codex agent combines them. In my usage, Codex passed both flags in about ten adversarial reviews over several weeks. Once it noticed afterward that the review "reviewed none of the staged SQL". The others went unnoticed at the time.
An unknown scope passed with --base is also accepted without the usual "Unsupported review scope" error, because that check comes after the early return.
Environment
- cc@sendbird 1.5.0, current
mainat 19e565151f35b328a5b9433df351bd8f3818fdc7 - Codex CLI 0.164.0, Claude Code 2.1.310, Node.js 24, macOS
Reproduction (no model call)
From a checkout of this repository:
R="$(mktemp -d "${TMPDIR:-/tmp}/scope-repro-XXXXXX")/repo"; mkdir -p "$R"; cd "$R"
git init -q -b main && echo a > f && git add f && git -c user.email=x@x -c user.name=x commit -qm init
echo b >> f && git add f # staged change on main
cd - >/dev/null
node --input-type=module -e '
import { resolveReviewTarget } from "./scripts/lib/git.mjs";
const r = process.argv[1];
console.log(resolveReviewTarget(r, { base: "main", scope: "working-tree" }));
console.log(resolveReviewTarget(r, { base: "main", scope: "bogus" }));
' "$R"
Output:
{ mode: 'branch', label: 'branch diff against main', baseRef: 'main', explicit: true }
{ mode: 'branch', label: 'branch diff against main', baseRef: 'main', explicit: true }
The first call asked for the working tree and got main against itself, an empty diff. The second should have been rejected as an unsupported scope.
Expected
--base with --scope working-tree is contradictory, because a working-tree review always compares against HEAD. It should fail with a clear message rather than pick one silently. --base with --scope branch or auto keeps working as it does now, and an unknown scope is rejected whether or not --base is present.
I have a small fix with tests and can open a PR.