Skip to content

fix(teardown): refuse to release a worktree another task still records - #8

Merged
karanmrn merged 1 commit into
mainfrom
fm/fm-teardown-shared-slot-guard
Oct 2, 2026
Merged

karanmrn merged 1 commit into
mainfrom
fm/fm-teardown-shared-slot-guard

Conversation

@karanmrn

@karanmrn karanmrn commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Why

On 1 Oct 2026, tearing down a stale task (pubmax-map-ui-sweep, whose work had moved elsewhere) returned treehouse slot pubmaxx-bde241/19 to the pool while another live task, pubmax-out-honesty-guard, was working in it. That reset the live worker's copy to detached main. Its commits survived, but nothing stopped the release.

Change

  • bin/fm-teardown.sh: before releasing a worktree, look for any other state/<id>.meta that records the same worktree path. If that task's endpoint is alive, or it records a different branch, teardown refuses to return, reset, or clean the slot and names the conflicting task. The rest of the stale task's cleanup (its own records, endpoint, hooks it owns) still completes. A dead record on the same branch does not block release, and it never weakens the existing unlanded-work refusal.
  • bin/fm-backend.sh: small helper changes the guard uses to read neighbor endpoint liveness.
  • tests/fm-teardown.test.sh: regression cases for the shared-slot guard.

Tests

Reproduced first: with two metas pointing at the same worktree, tearing down the stale one returned the slot and cleaned the neighbor's hook files. After the fix:

  • bash tests/fm-teardown.test.sh: exit 0, 65 ok, 0 not ok. New cases:
    • a live neighbor recording the same worktree blocks slot return, reset, and cleanup
    • a neighbor on a different branch blocks slot return even when its endpoint is dead
    • a dead record on this task's own branch does not block slot return
    • another task's unpushed branch does not block stale-record cleanup or get returned
    • a dead same-branch neighbor does not weaken the unlanded-work refusal
  • bin/fm-lint.sh: exit 0 (ShellCheck 0.11.0, actionlint 1.7.12, pinned).

Validation path

This PR skips the no-mistakes pipeline by the captain's decision on 2 Oct 2026, because no-mistakes refuses every available gate agent on the firstmate repo. It ships as a direct PR; GitHub CI is the gate.

🤖 Generated with Claude Code

A stale cleanup returned a shared slot and reset the live checkout. Leave that slot in place when another task still records it, and still remove the stale task's own record.
@karanmrn
karanmrn merged commit 446fbac into main Oct 2, 2026
0 of 14 checks passed
karanmrn pushed a commit that referenced this pull request Oct 2, 2026
Keep both upstream's reassigned-slot ownership check and the fork's
shared-slot guard (#8) in teardown: the worktree is left in place when
either says another task owns it. fm_backend_source keeps upstream's
readable-source preflight and sources each adapter through #8's
fm_backend_dot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant