You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
afx cleanup reports success but leaves the worktree registered and on disk when it holds untracked files #1721
git worktree list still shows .builders/air-1709 (912 MB on disk, branch builder/air-1709 still checked out there)
git branch -d builder/air-1709 refuses: "used by worktree"
a second afx cleanup -p 1709 says Builder not found for project: 1709 — the roster row is gone, so the CLI can no longer reach the worktree it failed to remove
A manual git worktree remove .builders/air-1709 (non-force) fails with "contains modified or untracked files, use --force". The untracked files are only the spawn scaffolding (.builder-prompt.txt, .builder-role.md, .builder-session-id, .builder-start.sh, .claude/hooks/); tracked state was clean and every commit was on origin.
Expected
Either the worktree is actually removed (cleanup owns the scaffolding it wrote, so removing it, or using --force for a worktree whose branch is fully merged and pushed, is correct), or cleanup reports the failure and keeps the roster row so it can be retried — not "cleaned up!" with the worktree intact and the handle deleted.
Notes
Other lanes cleaned up normally with the same scaffolding present, so the trigger may be something specific here (the .claude/hooks/ directory? a node_modules from the builder's pnpm install --frozen-lockfile?). Worth checking what git worktree remove actually returned and whether its exit code is inspected.
Reproduced 2026-09-22 with afx cleanup -p 1724 after PR #1725 merged: "[ok] Builder builder-air-1724 cleaned up!" but the worktree is still registered and on disk, roster row gone. Same profile as the first case: tracked tree clean, every commit on origin, only spawn scaffolding untracked (.builder-*, .claude/hooks/) plus the builder's node_modules. Two for two on AIR lanes that ran pnpm install in the worktree.
Field evidence from a multi-architect adopter workspace (7 architects, ~10 builders, one machine, codev 3.3.7), sent at the owner's request on 2026-11-11.
The untracked files behind this are harness scaffolding: .builder-session-id and .claude/hooks/worktree-write-guard.cjs (also .builder-prompt.txt, .builder-role.md, .builder-start.sh) show up in git status of every builder worktree, so every cleanup needs a manual 'only those' check and afx cleanup warns about uncommitted files. Suggested fix, tried by hand there and working across worktrees: at spawn, add them to the shared .git/info/exclude. Confirmed independently in this repo on 2026-11-01, when six merged worktrees each showed five to seven such files and nothing else. This is a few-line change in spawn and would make this issue and #1363 largely moot.
Activity
waleedkadous commentedon Sep 22, 2026
Reproduced 2026-09-22 with
afx cleanup -p 1724after PR #1725 merged: "[ok] Builder builder-air-1724 cleaned up!" but the worktree is still registered and on disk, roster row gone. Same profile as the first case: tracked tree clean, every commit on origin, only spawn scaffolding untracked (.builder-*,.claude/hooks/) plus the builder'snode_modules. Two for two on AIR lanes that ranpnpm installin the worktree.waleedkadous commentedon Nov 11, 2026
Field evidence from a multi-architect adopter workspace (7 architects, ~10 builders, one machine, codev 3.3.7), sent at the owner's request on 2026-11-11.
The untracked files behind this are harness scaffolding:
.builder-session-idand.claude/hooks/worktree-write-guard.cjs(also.builder-prompt.txt,.builder-role.md,.builder-start.sh) show up ingit statusof every builder worktree, so every cleanup needs a manual 'only those' check andafx cleanupwarns about uncommitted files. Suggested fix, tried by hand there and working across worktrees: at spawn, add them to the shared.git/info/exclude. Confirmed independently in this repo on 2026-11-01, when six merged worktrees each showed five to seven such files and nothing else. This is a few-line change in spawn and would make this issue and #1363 largely moot.