coily dispatch reap should handle orphaned worktree dirs - registration gone, dir survived #123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
coily dispatch reaperrors out on dispatch worktree directories whose worktree registration has been deleted but whose directory survives:The dir is a real directory with content (
.claude,.claude-plugin,.coily,.gitfile,.github,.python-version,.venv), but the.gitfile points at/Users/kai/projects/coilysiren/gauntlet/.git/worktrees/issue-39which no longer exists in the parent repo. Sogit -Creturns 128, and reap can't act.Net result: orphaned worktree dirs accumulate forever, indistinguishable to reap from worktrees that legitimately failed to clean.
Likely root causes
Either:
gauntletrepo got rebuilt or re-cloned somewhere along the way (e.g. nuked and re-cloned during repo migration), which invalidates every registered worktree. Dirs are left behind becausegitonly owns the registration, not the disk.git worktree remove --forceagainst the registration externally, but couldn't (or didn't) delete the dir.Either origin produces the same end state for reap.
Fix
coily dispatch reapshould detect this case and handle it:<dir>/.gitis a file pointing at a path that doesn't exist in the parent repo, treat the dir as orphaned..claude*,.coily,.github,.python-version,.venv), thenrm -rfthe dir.Evidence today
One orphan observed 2026-05-27:
.dispatch-worktrees/gauntlet/issue-39. Contents are bookkeeping-only - no source. Safe torm -rfonce the systemic fix is in.Sibling issues
.claude/*. Different failure mode; same family ("reap leaves dispatch worktrees uncleanable").Out of scope
rm -rfof the existinggauntlet/issue-39dir today. Safe to do manually now; waiting on the systemic fix is fine since the dir is inert.