Skip to content

fix(miner): re-entry must transition the dequeued repo's run-state, and no-op on an empty queue - #9887

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9683
Jul 29, 2026
Merged

fix(miner): re-entry must transition the dequeued repo's run-state, and no-op on an empty queue#9887
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9683

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(miner): re-entry must transition the dequeued repo's run-state, and no-op on an empty queue

attemptLoopReentry flipped run-state to "discovering" for the just-finished
repoFullName, but the portfolio queue is global so the dequeued candidate is
frequently a different repo — and it did so even when the queue was empty,
parking a finished repo at "discovering" forever. Gate the transition on a
non-null dequeue and write dequeued.repoFullName instead.

Closes #9683

…nd no-op on an empty queue

attemptLoopReentry flipped run-state to "discovering" for the just-finished
repoFullName, but the portfolio queue is global so the dequeued candidate is
frequently a different repo — and it did so even when the queue was empty,
parking a finished repo at "discovering" forever. Gate the transition on a
non-null dequeue and write dequeued.repoFullName instead.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 29, 2026 18:58
@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-29 19:04:04 UTC

2 files · 1 AI reviewer · no blockers · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This fixes attemptLoopReentry so run-state transitions target the just-dequeued repo (dequeued.repoFullName) instead of the just-finished repoFullName, and gates the transition on a non-null dequeue so an empty queue no longer parks the finished repo at 'discovering' forever. The fix is correct and minimal, and the loop-cli.ts caller confirms the portfolio queue is indeed global (dequeue can return a different repo than the one that finished), matching the stated bug. Three new tests exercise the exact scenarios described: cross-repo dequeue, empty-queue no-op, and suppressed re-entry, all real assertions against the actual exported function.

Nits — 2 non-blocking
  • The updated JSDoc comment is a bit dense — consider trimming the parenthetical for readability, though it's accurate.
  • Consider adding a test where the queue returns the SAME repo that just finished, to confirm the (now-correct) behavior is unchanged in that overlapping case.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9683
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 ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 94 registered-repo PR(s), 65 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 94 PR(s), 1 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff guards the setRunState call on dequeued being non-null and writes dequeued.repoFullName instead of the finished repoFullName, updates the docstring accordingly, and adds all three required regression tests (dequeued-to-other-repo, empty-queue no-op, and reenter=false no-op) while leaving dequeueNext, the reenter gate, audit event, and return shape untouched.

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is registered but has no active allocation in the current snapshot.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 94 PR(s), 1 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Await review-lane availability.
  • Then work through the remaining 2 steps in the Signals table above.
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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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://loopover.ai/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 added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.29%. Comparing base (300c381) to head (2c0b37a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9887      +/-   ##
==========================================
+ Coverage   79.28%   79.29%   +0.01%     
==========================================
  Files         281      282       +1     
  Lines       58510    58545      +35     
  Branches     6777     6792      +15     
==========================================
+ Hits        46387    46422      +35     
  Misses      11840    11840              
  Partials      283      283              
Flag Coverage Δ
backend 100.00% <100.00%> (?)

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

Files with missing lines Coverage Δ
packages/loopover-miner/lib/loop-reentry.ts 100.00% <100.00%> (ø)

@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 027e797 into JSONbored:main Jul 29, 2026
8 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.

miner(loop): re-entry transitions run-state for the wrong repo, and on an empty queue

1 participant