Skip to content

fix(miner): worktree-allocator.acquire() silently returns the stale allocation on a repo-mismatched re-acquire #8858

Description

@JSONbored

⚠️ 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:328-332's acquire(attemptId, repoFullName) early-return (existing?.status === "active") keys only on attemptId, never checking existing.repo_full_name against the newly-passed repoFullName. A second acquire call for the same attemptId but a different repo silently gets back the first allocation with no error. Only the same-repo re-acquire case is currently tested.

Requirements

Throw a clear error (e.g. attempt_id_repo_mismatch) when existing.repo_full_name !== normalizedRepo on the early-return path, instead of silently returning the mismatched allocation.

Deliverables

  • acquire() throws when an existing active allocation's repo_full_name differs from the requested one
  • A test asserting the same attemptId re-acquired against a different repoFullName throws the new error, and a second test confirming the existing same-repo re-acquire path is unaffected

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 both the new error branch and the existing happy path.

Expected Outcome

A programming error that re-acquires the same attempt ID against a different repo fails loudly instead of silently handing back a worktree allocation for the wrong repo.

Links & Resources

  • packages/loopover-miner/lib/worktree-allocator.ts:328-332

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions