Skip to content

fix: per-task worktree slot ownership (no shared pool worktrees) - #96

Merged
rimusz merged 1 commit into
mainfrom
termo/atr-worktree-slots
Nov 20, 2026
Merged

rimusz merged 1 commit into
mainfrom
termo/atr-worktree-slots

Conversation

@rimusz

@rimusz rimusz commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Root cause

pick_pool_slot chose a slot by scanning other tasks' worktree paths. Two dispatches in the same tick both took slot 0. Reuse did not check the owner. macOS has no busy-tree check.

Fix

pool_slots rows are keyed by task id and claimed in one write transaction. Checkout is refused when another live task owns the directory. When no slot is free the task is queued. Stale slots are cleaned up.

Tests

992 pass locally on the agent.

Limits

Force-cancel frees the slot when the task is marked failed. There is no macOS process-cwd check.

Slot choice read other tasks' worktree paths and fell back to slot 0
when every index looked taken, so two live tasks could check out the
same directory. Persist one owner per slot, claim it in a write
transaction, and refuse checkout when another live task still owns it.

Co-authored-by: rimusz <rimusz@users.noreply.github.com>
@rimusz
rimusz merged commit fe3ffc6 into main Nov 20, 2026
10 checks passed
@rimusz
rimusz deleted the termo/atr-worktree-slots branch November 20, 2026 04:47
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