fix(regate-sweep): prevent oldest-first starvation - #3978
Merged
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
❌ 53 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Contributor
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-07 09:46:40 UTC
🛑 Suggested Action - Manual Review
Why this is blocked
CI checks failing
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
JSONbored
force-pushed
the
codex/propose-fix-for-oldest-first-re-gate-issue
branch
from
July 7, 2026 09:39
6ef38e9 to
954036f
Compare
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.
Motivation
oldest-firstregate ordering could permanently starve newer PRs when a backlog exceeds two sweep batches because already-stamped older PRs continued to sort before never-regated newer PRs.ceil(open/max)sweeps and not pinning later PRs indefinitely.Description
oldest-firstcandidate pool to an "initial drain" of never-regated PRs (while still allowing priority repairs) so the sweep advances through never-regated creation-order batches instead of repeatedly selecting already-stamped older PRs; implemented insrc/settings/agent-sweep.ts.lastRegatedAt/regateProgress) key so ongoing periodic sweeps continue to converge rather than pin immutable creation order.candidatesset and updated sort key selection; expanded and adjusted unit tests intest/unit/agent-sweep.test.tsto cover >2-batch convergence, the initial-drain behavior, priority-repair interaction, and the all-regated fallback.Testing
npx vitest run test/unit/agent-sweep.test.tsand the updated unit suite foragent-sweeppassed (29/29 tests).npm run test:coverage -- --run test/unit/agent-sweep.test.tsand the tests passed but the local coverage reporting failed withTypeError: jsTokens is not a functionduring the coverage transformation step.npm run test:ci; the run progressed through lint andtsc --noEmit(typecheck) but the full coverage + larger test matrix encountered pre-existing test-run instability and was interrupted locally (not a regression introduced by this change).git diff --checkwas run and no whitespace/conflict errors were reported.Codex Task