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: '[ok] cleaned up' when only deregistered — worktree-preservation is inconsistent and the message misrepresents it #1363
afx cleanup -p <id> prints [ok] Builder <id> cleaned up! in two very different situations:
Full cleanup — registry row removed, worktree removed, branch deleted.
Deregistration only — registry row removed, but the worktree and branch are preserved on disk (with [info] Worktree preserved at: ... lines above the [ok]).
The [ok] cleaned up! reads as case 1 either way. An operator (or agent) scanning outcomes sees success and later finds .builders/ still populated — and by then the registry row is gone, so afx cleanup can no longer address the leftover at all ("Builder not found", the #1102 row-less gap). The tool's own preservation path manufactures row-less worktrees.
This repo's sweep: builders with tracked modifications (e.g. a modified package-lock.json) were preserved; builders with untracked-only dirt (builder artifacts, porch state) were fully removed — both printed [ok] cleaned up!. Neither the criterion nor the outcome difference is stated in the output.
A sibling workspace reports the same shape: two builders deregistered-but-preserved (one was checked out on a non-canonical branch, which may be a second preservation trigger; the other was on its canonical builder branch), a third under near-identical conditions fully removed. Same [ok] for all three.
Asks
Honest messaging: when preserving, say [warn] Deregistered only — worktree preserved (uncommitted changes / non-canonical branch): <path> and exit distinctly, so scripts and agents can branch on it.
Document (or make configurable) the preservation criteria — tracked-dirt vs untracked-dirt vs branch-mismatch is currently reverse-engineered folklore.
Repro data from the reporting workspace (sanitized). One sweep, four worktrees, all push-verified (local HEAD == origin branch; all PR content merged to the default branch) before cleanup:
Case
Checked-out branch
Dirt
Result
A
canonical builder/<id>
1 untracked (hooks .cjs)
Fully removed, remote branch deleted
B
non-canonical follow-up feature branch
15 untracked (consult ephemera under codev/projects/ + hooks .cjs)
[ok] cleaned up! but only deregistered — dir + checkout remain
C
canonical builder/<id>
1 untracked (hooks .cjs only)
Same as B — reported cleaned, dir remains
D
canonical
1 untracked
Registration lost in an earlier session crash → cleanup -p <id> and -p <name> both 'Builder not found' (the #1102 row-less gap)
Notes:
A and C are near-identical (canonical branch, single untracked hook file, HEAD = one status.yaml-only bookkeeping commit ahead of default) yet diverged — so neither non-canonical-branch nor tracked-vs-untracked dirt fully explains the preservation trigger on our data.
The preserved cases' output prescribed only git branch -d <name> — it never printed a git worktree remove <path> follow-up — so the 'tool-prescribed removal step' unblock suggested in this issue does not exist in the output as shipped; the leftover directory has no sanctioned path at all from the operator's seat.
In all cases the success line [ok] Builder <name> cleaned up! was identical whether the worktree was actually removed or not.
Activity
waleedkadous commentedon Aug 6, 2026
Repro data from the reporting workspace (sanitized). One sweep, four worktrees, all push-verified (local HEAD == origin branch; all PR content merged to the default branch) before cleanup:
builder/<id>codev/projects/+ hooks .cjs)[ok] cleaned up!but only deregistered — dir + checkout remainbuilder/<id>cleanup -p <id>and-p <name>both 'Builder not found' (the #1102 row-less gap)Notes:
git branch -d <name>— it never printed agit worktree remove <path>follow-up — so the 'tool-prescribed removal step' unblock suggested in this issue does not exist in the output as shipped; the leftover directory has no sanctioned path at all from the operator's seat.[ok] Builder <name> cleaned up!was identical whether the worktree was actually removed or not.