code-review skill diffs against wrong base branch, pulls in unrelated files as findings
Description
Running the built-in code-review skill (invoked via /code-review and via the Skill tool with skill: code-review) against a specific PR produces findings anchored to files that are not part of that PR's actual diff.
Steps to reproduce
- In a repo where a PR's base branch is not
master(e.g. base isdevelop), run/code-reviewagainst the PR URL, e.g.:
/code-review https://github.com/seismic/email-background-worker/pull/254
- Repeat with
args: "https://github.com/seismic/email-background-worker/pull/254 --comment".
Observed behavior
Both runs returned review findings citing files that are not touched by the PR's actual diff (verified independently via gh pr diff 254 and gh api repos/.../pulls/254 --jq '.head.sha'):
- Run 1 explicitly noted: "The PR's actual base is
develop... Diffing against localmaster/origin/masterpulled in ~50 unrelated commits... already merged history on this branch but not part of this PR," yet still reported a finding anchored to a file/line (SendEmailCommandHandler.cs:83) from that unrelated history. - Run 2 (same PR, after being told to target it explicitly) again returned 7 findings, only 2 of which were in files actually present in
gh pr diff 254's output. The other 5 referenced files (GovernanceWorkflowMappingProfile.cs,ProcessEmailArchivalCommandHandler.cs,LibraryServiceClient.cs,SendEmailCommandHandler.cs,GovernanceWorkflowPayloadConverter.cs) that do not appear anywhere in the PR's diff.
This looks like the skill (or its internal review sub-agents) computes the diff/scope against the wrong base ref (e.g. local master, or full repo history) instead of the PR's actual merge base, causing scope bleed where findings from unrelated already-merged commits or unrelated files get attributed to the PR under review.
Impact
Findings from outside the PR's diff can get posted as inline PR review comments on lines/files the PR never touched, which is confusing and erodes trust in the tool's output. Users must manually cross-check every finding against gh pr diff before trusting or posting it.
Environment
- Claude Code CLI, Windows 11
- Repo: private GitHub repo, PR base branch
develop(non-default relative to localmaster)