Skip to content

fix(queue): cap duplicate-sibling live GitHub fetch concurrency (#5835) - #6049

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-duplicate-sibling-concurrency
Jul 15, 2026
Merged

fix(queue): cap duplicate-sibling live GitHub fetch concurrency (#5835)#6049
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-duplicate-sibling-concurrency

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

Fixes #5835

reconcileLiveDuplicateSiblings fired one simultaneous live GitHub REST call per overlapping duplicate sibling via unbounded Promise.all, risking rate-limit bursts on popular issues with many duplicate PRs.

Root cause

The module was split from processors.ts but kept the unbounded fan-out while other live-check paths in the same family already use mapWithConcurrency with a cap of 10.

Fix approach

  • Extract mapWithConcurrency to src/queue/map-with-concurrency.ts (shared by processors.ts and duplicate-detection.ts without a circular import)
  • Replace unbounded Promise.all with mapWithConcurrency(overlapping, 10, ...)
  • Regression test asserts no more than 10 in-flight fetches with 15 siblings

Impact

Duplicate-cluster reconciliation now matches the concurrency posture of other per-item live GitHub checks in the queue layer.

Risk / tradeoffs

  • Pure concurrency bounding — fail-open stale-sibling filtering behavior unchanged
  • Slightly slower wall-clock for very large clusters (sequential batches of 10 instead of all-at-once)

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 15, 2026 07:44
@superagent-security

Copy link
Copy Markdown
Contributor

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

…#5835)

Use mapWithConcurrency (extracted to map-with-concurrency.ts) so
reconcileLiveDuplicateSiblings caps in-flight live PR fetches at 10
instead of unbounded Promise.all fan-out.

Closes JSONbored#5835

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.22%. Comparing base (9597167) to head (ba1cd15).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6049      +/-   ##
==========================================
+ Coverage   95.17%   95.22%   +0.05%     
==========================================
  Files         592      594       +2     
  Lines       46960    46968       +8     
  Branches    15007    15011       +4     
==========================================
+ Hits        44693    44726      +33     
+ Misses       1511     1493      -18     
+ Partials      756      749       -7     
Flag Coverage Δ
shard-1 43.97% <18.18%> (-0.05%) ⬇️
shard-2 36.55% <90.90%> (+0.13%) ⬆️
shard-3 32.06% <18.18%> (-0.15%) ⬇️
shard-4 33.03% <90.90%> (+0.05%) ⬆️
shard-5 31.47% <9.09%> (-0.01%) ⬇️
shard-6 44.71% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/duplicate-detection.ts 100.00% <100.00%> (ø)
src/queue/map-with-concurrency.ts 100.00% <100.00%> (ø)
src/queue/processors.ts 95.69% <ø> (-0.02%) ⬇️

... and 2 files with indirect coverage changes

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

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-15 07:54:51 UTC

4 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This extracts the previously-duplicated `mapWithConcurrency` helper from `processors.ts` into a new shared module and applies it to `reconcileLiveDuplicateSiblings`, replacing an unbounded `Promise.all` fan-out with a concurrency cap of 10 — matching the posture of other live GitHub checks in the same file. The re-export shim in `processors.ts` preserves existing import sites (e.g. `test/unit/advisory-ai-routing-call-sites.test.ts`), and the new regression test drives real concurrent fetch calls with 15 siblings, asserting `maxInFlight` stays within (1, 10], which is a real (non-fabricated) exercise of the code path. The change is narrow, correctly scoped, and directly tied to issue #5835.

Nits — 3 non-blocking
  • src/queue/duplicate-detection.ts: the closing braces/indentation after the `Promise.all` → `mapWithConcurrency` swap are left misaligned (the callback body is still indented as if nested inside `overlapping.map(...)`), worth a quick formatter pass for readability.
  • src/queue/processors.ts: importing and immediately re-exporting `mapWithConcurrency` from the same module in two separate statements works but could be collapsed to a single `export { mapWithConcurrency } from "./map-with-concurrency";` if `processors.ts` doesn't need the local binding for its own internal use — worth confirming it's actually used locally (it is, at `CONTRIBUTOR_CAP_LIVE_CHECK_CONCURRENCY`), so this is fine as-is, just noting for clarity.
  • Consider adding a short unit test for `map-with-concurrency.ts` in isolation (e.g. verifying it never exceeds the cap and preserves result order) now that it's a standalone shared module rather than only covered indirectly via the duplicate-sibling test.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #5835
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 344 registered-repo PR(s), 165 merged, 29 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 344 PR(s), 29 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR replaces the unbounded Promise.all fan-out in reconcileLiveDuplicateSiblings with mapWithConcurrency capped at 10, extracts the helper into a shared module to avoid a circular import with processors.ts while preserving its export, and adds a regression test asserting max in-flight fetches stay ≤10 with 15 siblings, matching all stated requirements.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 344 PR(s), 29 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit cef9795 into JSONbored:main Jul 15, 2026
15 checks passed
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

None yet

Development

Successfully merging this pull request may close these issues.

fix(queue): reconcileLiveDuplicateSiblings fans out unbounded GitHub fetches per duplicate-cluster sibling

1 participant