Skip to content

fix(queue): cap linked issue regate fanout#3699

Merged
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-unbounded-pr-regate-issue
Jul 6, 2026
Merged

fix(queue): cap linked issue regate fanout#3699
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-unbounded-pr-regate-issue

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Restore the bounded, rate-aware behavior for issue-side linked-PR re-gates to prevent a single issue webhook from enqueueing an unbounded number of foreground agent-regate-pr jobs and exhausting queue/GitHub/AI budgets.

Description

  • Reinstates the sweep budget cap by slicing matched linked PRs with .slice(0, SWEEP_MAX_PRS) in maybeReReviewOnLinkedIssueChange (src/queue/processors.ts).
  • Clarifies the surrounding comment to document a rate-aware leading batch with sweep-based tail convergence instead of unbounded fanout.
  • Adjusts the regression test in test/unit/queue.test.ts to seed more linked PRs than the sweep budget and assert only the capped leading batch is enqueued with the expected staggered delays.

Testing

  • Ran the focused unit tests with npx vitest run test/unit/queue.test.ts -t "issue-side linked PR wake|issue label change wakes|issue label change coalesces", which passed.
  • Ran npm run typecheck, which passed without errors.
  • Ran git diff --check, which produced no findings.
  • Executed a focused coverage run with npm run test:coverage -- test/unit/queue.test.ts -t "issue-side linked PR wake caps linked PR fanout to the sweep budget"; the targeted test passed but the global coverage threshold check failed (project-wide coverage is intentionally outside the scope of this focused change in this environment).
  • Attempted npm audit --audit-level=moderate, but the registry returned 403 Forbidden so the audit could not complete in this environment.

Codex Task

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-06 05:02:35 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This PR reinstates a `.slice(0, SWEEP_MAX_PRS)` cap on the linked-PR list in `maybeReReviewOnLinkedIssueChange` (src/queue/processors.ts), preventing an issue-side webhook from enqueueing unbounded `agent-regate-pr` jobs — matching the stated motivation of restoring a bounded, rate-aware fanout. The updated comment correctly reframes the behavior as a rate-aware leading batch with sweep-based tail convergence rather than claiming every linked PR is woken immediately. The regression test was updated in lockstep: it now seeds more linked PRs than the sweep budget and asserts exactly `SWEEP_MAX_PRS` jobs are enqueued with the expected staggered delays (undefined, 10, 20), which is internally consistent with the new slice logic.

Nits — 4 non-blocking
  • The renamed test title drops the original rationale ('hard-rule changes cannot leave stale passing gates'); consider keeping a one-line comment noting the tail still converges via the staleness-ordered sweep so future readers don't assume dropped PRs are simply ignored forever.
  • The PR description itself notes the global coverage threshold failed in the focused run; worth confirming project-wide coverage still meets the ~97% patch bar before merge even though this specific change is well-tested.
  • Consider asserting that PRs beyond the `SWEEP_MAX_PRS` cutoff are picked up by the staleness-ordered sweep in a follow-up/complementary test, to make the tail-convergence claim in the comment verifiable rather than just documented.
  • If `SWEEP_MAX_PRS` is reused across multiple call sites, a brief JSDoc on the constant itself would help future contributors avoid re-removing this cap.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 55 registered-repo PR(s), 47 merged, 456 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 55 PR(s), 456 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 55 PR(s), 456 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.33%. Comparing base (bb04de7) to head (61b41f9).
⚠️ Report is 14 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3699   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files         315      315           
  Lines       32080    32080           
  Branches    11762    11762           
=======================================
  Hits        29942    29942           
  Misses       1507     1507           
  Partials      631      631           
Files with missing lines Coverage Δ
src/queue/processors.ts 94.01% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 6, 2026
@JSONbored
JSONbored merged commit 23d85cd into main Jul 6, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-unbounded-pr-regate-issue branch July 6, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

1 participant