Skip to content

Bug: agit cleanup does not prune stale worktrees detected by agit status #3

@Fato07

Description

@Fato07

Description

agit status correctly detects stale worktrees (where the directory has been removed) and displays:

NOTICE: 2 worktree(s) marked stale (directory removed)

However, running agit cleanup immediately after reports "Nothing to clean up" — it does not remove the stale DB entries.

Steps to Reproduce

  1. agit spawn myrepo --agent test --branch feat/test
  2. rm -rf /path/to/repo/.worktrees/agit-<id>
  3. agit status → shows "N worktree(s) marked stale (directory removed)" ✅
  4. agit cleanup → "Nothing to clean up" ❌

Expected Behavior

agit cleanup should prune stale worktree entries from the database when their directories no longer exist on disk.

Environment

  • agit version: 0.1.1
  • OS: Linux (Ubuntu 22.04)
  • Arch: amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions