Skip to content

[teardown] fix: allow stale task cleanup when a pool slot has a new owner (adopt #5993) - #7

Merged
keenvc merged 4 commits into
mainfrom
fm/fm-adopt-5993-shared-slot-cleanup
Sep 29, 2026
Merged

keenvc merged 4 commits into
mainfrom
fm/fm-adopt-5993-shared-slot-cleanup

Conversation

@keenvc

@keenvc keenvc commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Adopts kunchenguid#5993 (cherry-picked with -x from upstream commits by QIanGua).

Contract review

Claim-first ordering lets a terminal record whose pool slot is owned by another task finish its own cleanup without touching the claimant's copy, processes, or .fm-slot-owner marker. Records that still own their slot keep the exclusivity refusal unchanged (covered by tests/fm-teardown-endpoint-safety.test.sh).

Tests

  • bash tests/fm-teardown-endpoint-safety.test.sh — pass on this branch (fork main base)
  • bash bin/fm-lint.sh — pass

Live before/after (methodology)

Same command both times: FM_HOME=/home/azureuser/firstmate bin/fm-teardown.sh a11y-5717-review (no --force), on terminal task a11y-5717-review whose recorded worktree /home/azureuser/.treehouse/v10-bfb443/76/v10 is also recorded by done task v12-nic1419-review, with slot claim task=v12-nic1419-review.

Before (pre-fix code on this worktree): teardown_exit=1, refusal: shared worktree with v12-nic1419-review; owner meta, claim, and checkout HEAD cb94a64329 left in place.

After (this branch): teardown_exit=0, reassignment warning, teardown a11y-5717-review complete; stale .meta removed; owner meta unchanged (cmp vs snapshot); slot claim unchanged; owner checkout HEAD still cb94a64329.

@keenvc keenvc added the do-not-auto-ready Keep PR in draft; do not mark ready for review automatically label Sep 28, 2026
QIanGua and others added 4 commits September 28, 2026 23:50
…leanup

Reassigned-slot teardown with a dead Herdr husk no longer takes the shared
presentation session lock, restoring the pre-5993 contention profile for stale
records while keeping live-slot protection intact. Herdr presentation recovery
spawns now wait up to 120s for that lock and release it on abort so concurrent
cross-home recovery cannot fail the 5s try loop after a legitimate holder.

Co-authored-by: Cursor <cursoragent@cursor.com>
@keenvc
keenvc force-pushed the fm/fm-adopt-5993-shared-slot-cleanup branch from 5e231b1 to 4aa15a3 Compare September 28, 2026 23:50
@keenvc keenvc removed the do-not-auto-ready Keep PR in draft; do not mark ready for review automatically label Sep 29, 2026
@keenvc
keenvc marked this pull request as ready for review September 29, 2026 00:08
@keenvc
keenvc merged commit 7f74031 into main Sep 29, 2026
18 of 19 checks passed
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.

2 participants