[Improve] Ground PR review pre-screen hints in specific hunks - #3130
Merged
Merged
Conversation
Contributor
|
No new code issues found. See task
Reviewed f103b41 |
mrubens
marked this pull request as ready for review
September 22, 2026 19:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Follow-up to #3119. The pre-screen now points the reviewer at specific changed hunks instead of whole-PR risk categories. The selection rule was tuned and checked against past review findings.
pnpm --filter @roomote/cloud-agents review-prescreen:eval --repo owner/name --reviewer login[,login] [--limit N] [--chunk-lines N] [--out scores.json]. It replays merged PRs at the commit their first review ran against, runs the shipped selection code, and scores hints against that review's inline comments. Those reviews ran without hunk hints, so the ground truth is independent of the pre-screen.Example output
This is the
review_prescreentext the reviewer receives, generated with this branch for past PRs, followed by what the first review actually flagged on the same commit.#3119 (28 screened hunks). The review's one finding, at line 245 of the new file, is inside hint 3. Chunking narrowed that hint from the whole 256-line file to lines 151-256.
#3066 (9 screened hunks). Both findings are hinted: a retry storm after a failed cache refresh (line 66, hint 1, labeled concurrency) and a process-wide cache retaining credentials (line 654, hint 2).
#3071 (35 screened hunks). This is a partial miss. Hint 2 covers the follow-up dedupe bug at harness line 5393. The unredacted
diff_statattask-completion-gate.ts:184falls just outside hint 3 (lines 1-150), and a stale test assertion in a workflow doc was not hinted.Validation
Scored against the 200 most recent merged PRs in this repo that got inline review comments: about 5,700 hunks, 210 of which held findings (3.7% base rate). The top-3 rule was chosen on the 120 most recent PRs and then checked on the next 80.
Latency. Wall time for all decision-model requests for one PR, measured against TypeSafe's API over the 200 eval PRs (150-line chunking):
The pre-screen starts right after the diff fetch and runs alongside the review-comment and issue-comment fetches, so it adds little or no wall time before the reviewer starts. The 10s timeout never came close to firing. Deployments that reach the model through OpenRouter, Vercel, or a self-hosted upstream will add their own network overhead.
Chunk size, compared on the same 197 PRs using finding-level coverage (share of the 237 inline findings inside a hinted range):
The shipped row is from a rerun after the replacement-boundary fix; only 2 PRs chunked differently, and the change is within run-to-run variation (about half a point). 50-line chunks lose about 8 points of coverage (95% CI -12 to -4): small chunks strip the context the model ranks with, and within-PR AUC drops from 0.91 to 0.89. 150-line chunks keep coverage (difference CI -3.4 to +2.6 points) and trim the largest hinted regions.
Unit tests cover parsing, quoted paths, deletion-only ranges, chunking and chunk boundaries, round-robin selection, fair budgeting, ranking, caps, area-label withholding, batching, and fallback.
Limits