fix(review): auto-pause count excluded the PR's own current head, so it never paused - #4319
Merged
Merged
Conversation
…it never paused countPublishedAiReviewHeads excluded the current head SHA from its count (#3719), meaning a PR swept repeatedly with no new commits could never reach auto_pause_after_reviewed_commits' threshold -- the one head it had ever been reviewed on was always the "current" one, always subtracted back out. Confirmed live: one PR took 63 fresh AI calls across 12 hours of scheduled sweeps with zero new commits. #3719 excluded the current head specifically to avoid a real problem: once paused, the cached review's findings were never reapplied, so an already-published blocker would silently vanish from later gate evaluations. Fixes that properly instead of avoiding it: the count now includes the current head (matching its own "published review count" contract), and a new reuse branch in processors.ts reapplies the last published review's findings whenever the pause reason fires, mirroring the existing frozen-for-manual-review reuse pattern.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4319 +/- ##
==========================================
- Coverage 93.81% 93.81% -0.01%
==========================================
Files 398 398
Lines 36780 36788 +8
Branches 13443 13444 +1
==========================================
+ Hits 34506 34511 +5
- Misses 1620 1621 +1
- Partials 654 656 +2
🚀 New features to boost your workflow:
|
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.
Summary
countPublishedAiReviewHeadsexcluded the PR's own current head SHA from its count (fix(review): exclude current head from auto-pause count #3719), so a PR swept repeatedly with NO new commits could never reachreview.auto_review.auto_pause_after_reviewed_commits's threshold — the one head it had ever been reviewed on was always "the current one," always subtracted back out. Confirmed live: one open PR (gittensory#4122) took 63 fresh AI review calls across a 12-hour window of scheduled sweeps, with zero new commits — the exact same cycle (miner-check → slop-advisory → AI-review → publish) repeating every 15-40 minutes, all night.countPublishedAiReviewHeadsnow counts the current head too, matching its own always-documented "published AI review count" contract (and its signature drops the now-unusedcurrentHeadShaparameter).processors.ts(autoReviewSkipReason === "review paused (commit threshold)") reapplies the last published review's findings whenever the pause fires — mirroring the existingisFrozenForManualReviewreuse pattern exactly, under its own distinctgithub_app.ai_review_paused_reuseaudit event /gittensory_ai_review_paused_reuse_totalcounter.Scope
CONTRIBUTING.md.Validation
git diff --checknpm run typechecknpx vitest run test/unit/ai-review-cache.test.ts test/unit/auto-review-wiring.test.ts— 45/45 passing, including the repurposed fix(review): exclude current head from auto-pause count #3719 regression test (now asserting the count correctly INCLUDES the current head) and the pre-existing threshold/draft/label/docs-only auto-review tests.test/unit/queue.test.ts: simulates 3 consecutive scheduled sweeps of the SAME unchanged PR (matching the real-world pattern exactly) — asserts zero fresh AI calls across all 3 passes, the new reuse audit event fires on every pass, and the cached review's blocker text is still present in the public comment on every pass (proving fix(review): exclude current head from auto-pause count #3719's original concern — a vanishing blocker — is actually fixed, not just avoided).audit_eventstable directly, confirmedgithub_app.autoreview_paused/_resumed(a DIFFERENT, unrelated manual-command marker) has zero rows ever, then traced the real mechanism tocountPublishedAiReviewHeads's SQL and confirmed the exclusion viagit log -Sback to fix(review): exclude current head from auto-pause count #3719's own issue text.Safety
resolveAutoReviewSkipForPullRequest) is updated in the same commit; no other call sites exist.