Repository navigation
[CI] Add commit_id pinning, diff-hunk validation, and dry_run mode to Gemini review posting (Stack 4/5) - #41854
Closed
damccorm wants to merge 1 commit into
Conversation
… Gemini review posting
This was referenced Dec 1, 2026
Contributor
Author
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.
Context: I found I was getting much better results from my local agent than I was from the review bot. This tries to fix the problem, but I expect we'll want to do more hill climbing from here
Overall Change (Gemini Code Review Overhaul)
Splits draft PR #41844 into 5 small, focused, independently valid stacked PRs that replace the single-pass
web_fetch-based review workflow with a hardened, two-pass Hunter → Verifier review agent operating over read-only local context (repo/+pr_context/):web_fetchon the PR URL with no checkout, nogrep_searchacross callers/subclasses, no diff-hunk orcommit_idvalidation, nodry_runtesting mode, and single-pass JSON output — leading to missed bugs on non-trivial PRs and occasional hallucinated false positives.pr.diff, exact 1-basedpr.numbered.diff,valid_lines.json, boundedhead_files/,incremental.diff,checks.json, git log/static checks, and$RUNNER_TEMP-isolatedthreads.json), pin.github/gemini_review_guide.mdin system memory under a random per-run filename, run Pass 1 (high-recall Adversarial Hunter) → Pass 2 (high-precision Skeptical Verifier & JSON Formatter) → optional Pass 2b (JSON syntax repair), validate single-/multi-line same-hunk placement pinned tohead_sha, and add aworkflow_dispatchdry_runmode.workflow_dispatchwithdry_run=trueacross a representative sample of 10 open Java, Python, Go, YAML, runner, and I/O PRs—comparing the bot's output against independent blind reviews without posting comments—including a clean PR check to verify precision (0 false positives). Also verified workflow lint, license, whitespace, and security checks (beam_PreCommit_GHA,beam_PreCommit_RAT,beam_PreCommit_Whitespace, andzizmor).What This PR Changes (
4/5)Upgrades
Post PR Review to GitHuband adds a non-postingdry_runtesting mode in.github/workflows/gemini_code_review.yml(+161 / -26):workflow_dispatchdry_runinput (type: boolean,default: false):-dry-runtoconcurrency.groupwhendry_runis enabled so test dispatches never cancel live PR reviews.commit_id,reviewBody, and all validated inline comments (plus a collapsible::group::Dry-run reviewPayload JSONblock and a Markdown summary in$GITHUB_STEP_SUMMARY), and returns without callinggithub.rest.pulls.createReview.commit_idfrompr_context/head_sha.txton both primary and fallback review submissions.lineandsideagainstpr_context/valid_lines.json; routes out-of-hunk comments to## 💬 Additional Findings (Outside Diff Hunks)instead of causing the entirecreateReviewAPI call to fail.start_line < line,start_side === side, both inside the same hunk) while preserving single-linesuggestionblocks whenstart_line === line && start_side === side.core.warningwith the exactSyntaxErrormessage ifJSON.parsefails instead of silently swallowing the error.retries: 0on this write step to avoid duplicate posted reviews.Standalone safety: Consumes
pr_context/head_sha.txtandpr_context/valid_lines.jsonproduced by PR 2/5 and works cleanly with either the existingweb_fetchagent or PR 5/5's two-pass agent.