Commit fbc4f0c
fix(code-review): refuse a --github review of a tree that is not the PR head (ISS-8769) (#198)
* ISS-8769: Refuse a --github review of a tree that is not the PR head
`/code-review --github <PR>` run outside GitHub Actions reviewed whatever
tree happened to be checked out, silently and with exit 0.
`cmd_resolve_scope` skipped every PR-head check when the mode was github,
but `--github` selects file-based handoff output - it does not declare "I
am inside GitHub Actions" - and running it from a developer machine is
supported. Such a run left `review_root` empty and every reviewer read the
operator's branch while holding a diff from origin/<base>...origin/<head>.
GitHub mode now VERIFIES the tree it was handed and REFUSES with a
non-zero exit when it cannot establish it as the PR's source. Two checkout
shapes are accepted because both occur in Actions: HEAD is the PR head
(explicit `ref: <head sha>`), or HEAD is the PR's merge ref
refs/pull/N/merge - the DEFAULT checkout for a pull_request event - whose
second parent is the head. Either way tracked files must be unmodified.
The block ADDS a refusal and changes nothing else: no worktree, no
`review_root`, and `head_sha` stays out of the emitted scope so no
consumer of it moves. Isolation stays local-only on purpose - it redirects
a whole agent fleet, and github-review.md's own steps do not resolve
`review_root`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(code-review): bind github-mode checkout check to PR metadata and base
* fix(code-review): lock github-mode merge check to the PR base under --base
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kris Wong <kris.wong@closedloop.ai>1 parent 9e97927 commit fbc4f0c
5 files changed
Lines changed: 393 additions & 32 deletions
File tree
- plugins/code-review
- .claude-plugin
- commands
- tools/python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
| 377 | + | |
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| |||
0 commit comments