⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.
Context
packages/loopover-miner/lib/worktree-allocator.ts:261-281's reclaimOrphanedAllocations runs exactly once inside openWorktreeAllocator(). A long-lived fleet worker that opens its allocator once and calls .acquire() for hours never re-sweeps a peer that crashes mid-lease after open -- only a process restart re-triggers reclaim. Contrast with the sibling packages/loopover-miner/lib/portfolio-queue-manager.ts:169-174's claimNextBatch(), which calls sweepStuckItems(...) on every claim.
Requirements
Call reclaimOrphanedAllocations (with a fresh Date.now()) at the start of every acquire() call, matching portfolio-queue-manager.ts's existing per-claim sweep pattern, so a peer's crashed/orphaned allocation is reclaimed promptly rather than only at process-restart time.
Deliverables
All of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.
Test Coverage Requirements
packages/loopover-miner/** -- 99%+ patch coverage on the new per-acquire reclaim path.
Expected Outcome
A crashed peer's orphaned worktree allocation is reclaimed on the very next acquire() call by any live worker, not only after every worker restarts its allocator.
Links & Resources
packages/loopover-miner/lib/worktree-allocator.ts:261-281
packages/loopover-miner/lib/portfolio-queue-manager.ts:169-174
Context
packages/loopover-miner/lib/worktree-allocator.ts:261-281'sreclaimOrphanedAllocationsruns exactly once insideopenWorktreeAllocator(). A long-lived fleet worker that opens its allocator once and calls.acquire()for hours never re-sweeps a peer that crashes mid-lease after open -- only a process restart re-triggers reclaim. Contrast with the siblingpackages/loopover-miner/lib/portfolio-queue-manager.ts:169-174'sclaimNextBatch(), which callssweepStuckItems(...)on every claim.Requirements
Call
reclaimOrphanedAllocations(with a freshDate.now()) at the start of everyacquire()call, matchingportfolio-queue-manager.ts's existing per-claim sweep pattern, so a peer's crashed/orphaned allocation is reclaimed promptly rather than only at process-restart time.Deliverables
acquire()callsreclaimOrphanedAllocationsat its start, on every invocation, not just at allocator-open timeacquire()call reclaims it without requiring a freshopenWorktreeAllocator()callAll of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.
Test Coverage Requirements
packages/loopover-miner/**-- 99%+ patch coverage on the new per-acquire reclaim path.Expected Outcome
A crashed peer's orphaned worktree allocation is reclaimed on the very next
acquire()call by any live worker, not only after every worker restarts its allocator.Links & Resources
packages/loopover-miner/lib/worktree-allocator.ts:261-281packages/loopover-miner/lib/portfolio-queue-manager.ts:169-174