feat(review): inject enclosing control-flow scope into review prompts - #531
Merged
Conversation
Review run 2 on uteke#1084 flagged a false positive: the handler validated author_type up front and set_author_type sat in a SHARED match arm fed by two producers, but build_review_prompt shipped only raw diff hunks — the LLM reconstructed branch structure from diff shape and got it wrong (#523). - new engine::enclosing module: for hunks whose add/context lines touch branching constructs, extract the enclosing function from the post-image file (brace-balance heuristic), clamped to 120 lines with head+tail windowing so shared arms stay visible without token blowup - gated injection: new files, deletions, binaries, non-branching hunks, and unreadable files are skipped - always-on prompt guardrail forbidding reachability claims unless verified against surrounding code (stage 2 of the issue proposal) - stage 3 (call-graph reachability cross-check) intentionally left out Regression tests: acceptance fixture mirrors the shared-arm case (both producers visible in injected context); negative case without branching; new-file skip; clamp bound; guardrail presence. Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
This was referenced Aug 27, 2026
Closed
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.
Fixes #523 (stages 1 + 2; stage 3 intentionally deferred)
What
engine::enclosingmodule: for hunks whose add/context lines touch branching constructs, extract the enclosing function from the post-image file (brace-balance heuristic), clamped to 120 lines with head+tail windowing so shared arms stay visible without token blowupWhy
Review run 2 on uteke#1084 flagged a false positive: the handler validated
author_typeup front andset_author_typesat in a SHARED match arm fed by two producers, butbuild_review_promptshipped only raw diff hunks — the LLM reconstructed branch structure from diff shape and got it wrong. Plausible reasoning over missing evidence.Testing
All commits signed-off (DCO).