Skip to content

feat(read): github_read_pr_file — reads pinned to the PR head (v0.3.0)#22

Merged
mabry1985 merged 1 commit into
mainfrom
feat/read-pr-file
Jul 21, 2026
Merged

feat(read): github_read_pr_file — reads pinned to the PR head (v0.3.0)#22
mabry1985 merged 1 commit into
mainfrom
feat/read-pr-file

Conversation

@mabry1985

Copy link
Copy Markdown
Member

Fixes the tool-shaped half of pr-reviewer-plugin#20.

github_read_file's ref is optional and defaults to the repo's default branch. A reviewer that omits it reads the pre-PR file and then "confirms" that symbols the PR adds don't exist — blocker findings on correct code.

Reproduced: on protoAgent#2088 the verifier said goalDetailQuery was missing from apps/web/src/lib/queries.ts; it is exported at line 90 of the reviewed head 19c37f7a.

Prompt-level discipline was already deployed and still failed — both review-finder and verifier system prompts spell out "pass ref=<head SHA>", and the recipe passed the SHA to every step. So the fix has to remove the choice.

github_read_pr_file(number, path, repo) takes no ref: the head SHA is resolved server-side from the PR number, and a failed pinned read errors rather than falling back to the default branch — a silent fallback is precisely the defect.

Additive. github_read_file is untouched; existing callers are unaffected.

Test

113 passed. Three new tests, mutation-verified (deleting the ref= pin fails test_read_pr_file_reads_at_the_prs_head_sha):

  • content read is pinned to the SHA the PR reports
  • a failed pinned read errors instead of serving the pre-PR file
  • an unresolvable head SHA errors

🤖 Generated with Claude Code

`github_read_file`'s `ref` is optional and defaults to the repo's DEFAULT
BRANCH. A reviewer that omits it reads the PRE-PR file, then "confirms" that
symbols the PR ADDS don't exist — blocker findings on correct code.

That is not hypothetical: pr-reviewer-plugin#20. On protoAgent#2088 the verifier
reported `goalDetailQuery` missing from apps/web/src/lib/queries.ts; it is
exported at line 90 of the reviewed head. Prompt-level ref discipline was
already in place in BOTH the review-finder and verifier system prompts, and the
recipe passed the head SHA to every step — it still read the default branch.
Telling the model to pass a ref is not a guarantee.

`github_read_pr_file(number, path, repo)` takes no ref at all: it resolves the
head SHA server-side from the PR, and a failed pinned read ERRORS rather than
falling back to the default branch (a silent fallback is the bug itself).

Additive — `github_read_file` is untouched, so nothing existing changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mabry1985
mabry1985 merged commit e8acdfe into main Jul 21, 2026
1 check passed
@mabry1985
mabry1985 deleted the feat/read-pr-file branch July 21, 2026 09:32
mabry1985 added a commit to protoLabsAI/protoAgent that referenced this pull request Jul 21, 2026
#2100)

The review panel read PR files with `github_read_file`, whose `ref` is optional
and defaults to the repo's DEFAULT BRANCH. Omit it and you read the code as it
was BEFORE the PR — so the verifier "confirms" that symbols the PR ADDS don't
exist, and a correct PR collects blocker findings.

Observed on protoAgent#2088: the verifier reported `goalDetailQuery` missing
from apps/web/src/lib/queries.ts; it is exported at line 90 of the reviewed
head. #2094 drew 8 → 9 → 11 findings across three re-reviews about code the PR
never touched (recalled prior_findings re-seed each panel, so a wrong-ref
finding compounds).

Prompt-level discipline was ALREADY here and did not hold: both the
review-finder and verifier prompts said "pass ref=<head SHA>", the recipe passed
the SHA to every step, and the reads still went to main. A rule the model has to
remember on every call is not a guarantee.

Both review seats now use github-plugin's `github_read_pr_file` (v0.3.0), which
takes no ref at all — it resolves the head SHA server-side from the PR number.
`github_read_file` stays for policy docs, which must still be read at the base
(a PR must not rewrite the rules it is judged by), and the verifier now fails
closed: an unreadable head means "uncertain", never "confirmed".

Refs pr-reviewer-plugin#20, protoLabsAI/github-plugin#22.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant