Skip to content

afx cleanup reports success but leaves the worktree registered and on disk when it holds untracked files #1721

Description

@waleedkadous

Observed (2026-09-22, cluesmith/codev, after PR #1710 merged)

afx cleanup -p 1709 printed:

[info] To delete: git branch -d "builder/air-1709"
[ok] Builder builder-air-1709 cleaned up!

but afterwards:

  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/towerArea: Tower server / agent farm CLI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions