fix(review): stop the sweep from endlessly re-evaluating already-reviewed PRs - #4474
Merged
Conversation
…ewed PRs The re-gate sweep periodically re-checked every open PR for silent drift (a moved base, a merged sibling duplicate, a changed config) -- including PRs it had already fully reviewed, forever, on every tick. A PR that can never auto-close (owner-authored, failing CI) sat in that rotation indefinitely: confirmed live, 9 owner-authored PRs with failing checks (some 36+ hours old) were each getting a full PR + CI state re-fetch from GitHub every sweep tick, driving the primary GitHub rate limit to zero twice in two hours and backing up the job queue. selectRegateCandidates now permanently excludes any PR the sweep has already regated even once -- fail-closed, no re-check-for-drift window. Re-review only ever happens through two channels, neither of which is this sweep: a genuine new push (a new head SHA, handled by the real-time webhook path) or an explicit maintainer-triggered re-review (the PR panel's re-run checkbox, role-gated via command-authorization, never hardcoded to a specific login). The existing repair-priority bypass is preserved for PRs whose prior review never actually landed (a crashed or incomplete publish) -- retrying those delivers the one review they were owed, not a second one.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4474 +/- ##
=======================================
Coverage 94.02% 94.02%
=======================================
Files 420 420
Lines 37479 37479
Branches 13692 13692
=======================================
Hits 35240 35240
Misses 1583 1583
Partials 656 656
🚀 New features to boost your workflow:
|
This was referenced Jul 9, 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.
Summary
closeOwnerAuthors: false) sits in that rotation indefinitely. Confirmed live: 9 owner-authored PRs with failing checks (some 36+ hours old) were each getting a full PR + CI state re-fetch from GitHub every ~2-minute sweep tick, for hours.selectRegateCandidates(src/settings/agent-sweep.ts) now permanently excludes any PR the sweep has already regated even once -- no re-check-for-drift window, fail-closed. Re-review only happens through two channels, neither of which is this sweep: a genuine new push (new head SHA, real-time webhook path) or an explicit maintainer-triggered re-review (the PR panel's re-run checkbox, role-gated viacommandAuthorizationAllowedRoles, never hardcoded to a specific login -- verified insrc/queue/processors.ts's panel-retrigger handler).repairPrioritybypass is preserved unchanged: a PR whose prior review never actually landed (crashed/incomplete publish) still gets retried -- that delivers the one review it was owed, not a second one.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.md.Validation
npm run typechecknpx vitest run test/unit/agent-sweep.test.ts(32/32 passing, all updated to assert the new one-shot semantics)npx vitest run test/unit/queue.test.ts -t "agent re-gate sweep processes strict staleness order"(the one integration test exercising this exact scenario, updated and passing)npm run test:coveragewas NOT re-run locally before push given the live incident's urgency (queue actively growing, rate limit actively being consumed) -- relying on CI's full gate to catch anything the targeted runs above missed. Will monitor CI and fix forward if anything surfaces.Safety