Repository navigation
[CI] Switch Gemini code review to two-pass Hunter/Verifier agent with local read-only tools (Stack 5/5) - #41855
Closed
damccorm wants to merge 1 commit into
Conversation
… local read-only tools
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 (
5/5)Replaces the single-pass
web_fetchinvocation inRun Gemini Enterprise Code Review Agent(.github/workflows/gemini_code_review.yml,+225 / -17) with the two-pass local read-only pipeline:web_fetch/directWebFetchwithtools.core: ["read_file", "grep_search", "glob", "list_directory"]overrepo/andpr_context/(no shell, no file writes, no network access).repo/.github/gemini_review_guide.md(added in PR 1/5) to a per-run random filename (GEMINI_TRUSTED_GUIDE_<16hex>.md) and setscontext.fileName,discoveryMaxDirs: 1,memoryBoundaryMarkers: [], andmodel.compressionThreshold: 0.9. This prevents long-context instruction drift on large PRs and blocks untrusted PRs from injectingGEMINI.mdviapr_context/head_files/.@-free CLI prompts: Keepshunter_prompt.txt,verifier_prompt.txt, andrepair_prompt.txtcompletely free of literal@characters sogemini-cli's@filepreprocessor cannot attach unrelated workspace files.maxSessionTurns: 65): Runs whilethreads.jsonis still staged outside the workspace in$RUNNER_TEMP, outputting free-form Markdown topr_context/hunter_findings.md(printed inside::group::whendry_run=true). Gracefully catchesFatalTurnLimitedError(exit53) with a warning and fallback note so Pass 2 still runs.maxSessionTurns: 35): Movesthreads.jsonintopr_context/threads.json, verifies every Pass 1 candidate againstpr_context/head_files/andrepo/, checks exact 1-based line numbers inpr_context/pr.numbered.diffand hunks invalid_lines.json, and emits strict JSON.maxSessionTurns: 4,tools.core: ["read_file"]): Validatesgemini_response.txtwith Node'sJSON.parse; only if invalid (e.g., an unescaped"inside a markdown code span), runs a read-only syntax-repair pass without altering findings or line numbers..stats.toolsand.stats.modelsfor each pass, raisestimeout-minutesfrom15to30, and cleans up all temporary prompt/output/GEMINI_TRUSTED_GUIDE_*.mdfiles inif: always().Exact equivalence: The final tree of this PR matches the benchmarked commit (
48f502e5dbdon #41844) byte-for-byte.