Skip to content

fix(queue): bound linked-issue webhook fanout by queuing staggered per-PR jobs - #2476

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-unbounded-fanout-in-issue-webhooks
Jul 2, 2026
Merged

fix(queue): bound linked-issue webhook fanout by queuing staggered per-PR jobs#2476
JSONbored merged 1 commit into
mainfrom
codex/fix-unbounded-fanout-in-issue-webhooks

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The issues webhook handler synchronously re-reviewed every open PR linking the changed issue, causing an unbounded, expensive fanout that can exhaust GitHub/queue/worker resources and bypass the rate-limit-aware per-PR path.
  • Issue-side signals should wake linked PRs promptly while honoring the existing per-PR rate-limit/backpressure model and preserving coalescing semantics for bursts on the same PR.

Description

  • Rewrote maybeReReviewOnLinkedIssueChange in src/queue/processors.ts to enqueue bounded per-PR agent-regate-pr jobs (one job per linked PR) instead of calling the expensive reReviewStoredPullRequest inline, and staggered enqueues by index to reuse the sweep's backpressure behavior.
  • Capped the fanout to SWEEP_MAX_PRS so an issue-side event cannot synchronously schedule more work than the sweep budget.
  • Kept the dedicated issue-side coalesce (issueLinkedPrReReviewCoalesced) and trailing re-review scheduling (scheduleTrailingIssueLinkedReReview) behavior intact so same-PR bursts still coalesce and the latest state is captured after the window.
  • Updated test/unit/queue.test.ts to assert the new behavior and added regression tests that verify no inline GitHub work is performed by the issue handler, the fanout is capped and staggered, and trailing/coalesced job retry/dedupe semantics remain correct.

Testing

  • Ran git diff --check with no issues reported.
  • Ran npm run typecheck, which completed successfully with no type errors.
  • Ran unit tests focused on the changed behavior with npx vitest run test/unit/queue.test.ts -t "issue" --reporter=dot, and the targeted tests passed locally (issue-related tests covering capping, enqueueing, coalescing, and trailing retry/dedupe passed).
  • Attempted npm run test:ci and npm audit --audit-level=moderate but the CI-level run and audit were blocked by external network/resolution issues in the environment (actionlint setup fallback and registry audit endpoint returned network/permission errors), so the full gated CI could not be completed in this session.
  • No DB migrations or generated artifacts were required for this change.

Codex Task

@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 05:34:46 UTC

2 files · 1 AI reviewer · no blockers · readiness 68/100 · CI pending · blocked

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The diff moves linked-issue webhook fanout out of the synchronous issue handler and into bounded, staggered per-PR queue jobs, while preserving the existing issue-side coalesce and trailing retry behavior. The changed tests exercise the important behavioral contract: no inline GitHub fetches on the issue path, capped fanout, staggered queue options, and trailing job dedupe/retry semantics. I do not see a reachable breaking defect in the provided diff.

Nits — 7 non-blocking
  • nit: src/queue/processors.ts:2784 couples issue-side webhook fanout directly to SWEEP_MAX_PRS, whose documented budget is calibrated for scheduled sweeps; add a short comment or separate constant if that coupling is intentional.
  • nit: src/queue/processors.ts:2786 silently drops linked PRs beyond the cap for this issue event; logging the capped count would make delayed convergence easier to diagnose.
  • nit: test/unit/queue.test.ts:1544 repeats the same Queue capture stub across several issue-side tests; a small helper would make the assertions easier to maintain.
  • src/queue/processors.ts:2784: document why the issue-webhook fanout should share the sweep budget rather than having its own issue-specific cap.
  • src/queue/processors.ts:2786: consider emitting a structured log when linkedPrNumbers exceeds SWEEP_MAX_PRS so maintainers can see when issue-side wakes defer extra PRs to later backstops.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:S; no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 55 merged, 554 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 65 PR(s), 554 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
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: not available
  • Official Gittensor activity: 65 PR(s), 554 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (PR #2470)
  • Related work: Titles/paths share 6 meaningful terms. (PR #2473)
  • Related work: Titles/paths share 6 meaningful terms. (PR #2470, PR #2473)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Triage stale or unlinked PRs.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
  • Check active issues and PRs before submitting.
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

@loopover-orb loopover-orb Bot added gittensor gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.93%. Comparing base (8c63ec4) to head (1bbcfc6).
⚠️ Report is 21 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2476   +/-   ##
=======================================
  Coverage   95.93%   95.93%           
=======================================
  Files         225      225           
  Lines       25338    25340    +2     
  Branches     9218     9219    +1     
=======================================
+ Hits        24308    24310    +2     
  Misses        417      417           
  Partials      613      613           
Files with missing lines Coverage Δ
src/queue/processors.ts 91.74% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant