dispatch reaper cannot remove its own worktrees: injected .claude lockdown files block git worktree remove #12

Open
opened 2026-05-23 20:53:57 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-05-21T12:09:58Z - https://github.com/coilysiren/coily/issues/308

Problem - coily dispatch's worktree reaper cannot clean up its own worktrees, so every dispatched worktree leaks until force-removed by hand.

Symptom - On every coily dispatch interactive run, the reap phase skips stale worktrees:

fatal: '/Users/kai/projects/coilysiren/.dispatch-worktrees/infrastructure/issue-216' contains modified or untracked files, use --force to delete it
dispatch reap: skip /Users/kai/projects/coilysiren/.dispatch-worktrees/infrastructure/issue-216: exit status 128

Root cause - coily dispatch injects lockdown files into every worktree it creates - .claude/settings.json gets modified and .claude/lockdown-deny.sh is added. git worktree remove (without --force) refuses to delete a worktree that has modified or untracked files. So the reaper's own injected files are exactly what makes git worktree remove fail. Every dispatched worktree leaks. Observed on two stuck worktrees (infrastructure/issue-216, eco-mods-assets/issue-2), both with only .claude/lockdown-deny.sh and .claude/settings.json as the blocking changes.

Fix - The reaper should --force past coily's own injected lockdown files. Options:

  • Pass --force to git worktree remove in the reap path. Simplest. The reaper already decided the worktree is merged/done, so discarding the lockdown deltas is safe.
  • Or: stash/restore the .claude/ injection so the worktree is clean at reap time, then a plain git worktree remove succeeds.
  • Or: scope the --force narrowly - only force when the sole diff is coily's own .claude/settings.json + .claude/lockdown-deny.sh, and keep the plain remove (with the current skip-and-warn) for any worktree carrying real uncommitted work.

The last option is the safest - it never silently discards genuine user work, only coily's own bookkeeping.

_Originally filed by @coilysiren on 2026-05-21T12:09:58Z - [https://github.com/coilysiren/coily/issues/308](https://github.com/coilysiren/coily/issues/308)_ **Problem** - `coily dispatch`'s worktree reaper cannot clean up its own worktrees, so every dispatched worktree leaks until force-removed by hand. **Symptom** - On every `coily dispatch interactive` run, the reap phase skips stale worktrees: ``` fatal: '/Users/kai/projects/coilysiren/.dispatch-worktrees/infrastructure/issue-216' contains modified or untracked files, use --force to delete it dispatch reap: skip /Users/kai/projects/coilysiren/.dispatch-worktrees/infrastructure/issue-216: exit status 128 ``` **Root cause** - coily dispatch injects lockdown files into every worktree it creates - `.claude/settings.json` gets modified and `.claude/lockdown-deny.sh` is added. `git worktree remove` (without `--force`) refuses to delete a worktree that has modified or untracked files. So the reaper's own injected files are exactly what makes `git worktree remove` fail. Every dispatched worktree leaks. Observed on two stuck worktrees (`infrastructure/issue-216`, `eco-mods-assets/issue-2`), both with only `.claude/lockdown-deny.sh` and `.claude/settings.json` as the blocking changes. **Fix** - The reaper should `--force` past coily's own injected lockdown files. Options: - Pass `--force` to `git worktree remove` in the reap path. Simplest. The reaper already decided the worktree is merged/done, so discarding the lockdown deltas is safe. - Or: stash/restore the `.claude/` injection so the worktree is clean at reap time, then a plain `git worktree remove` succeeds. - Or: scope the `--force` narrowly - only force when the sole diff is coily's own `.claude/settings.json` + `.claude/lockdown-deny.sh`, and keep the plain remove (with the current skip-and-warn) for any worktree carrying real uncommitted work. The last option is the safest - it never silently discards genuine user work, only coily's own bookkeeping.
coilysiren added
P3
and removed
P2
labels 2026-05-31 06:59:56 +00:00
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-bridge/coily#12
No description provided.