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
Storage cleanup never removes a worktree that a subagent thread used #19144
Delete merged worktrees, Delete unchanged worktrees and Delete worktrees with deleted threads are all on, yet a cleanup run reports 0 removed, 111 kept. Most entries say "Shared by N threads".
Why
Each subagent that a thread starts is stored as its own thread (createdBy: "agent") with the parent's worktreePath. storageCleanup.ts groups every thread by worktreePath (L426) and keeps any worktree with more than one thread (L457: if (shared > 1) return keep(...)). Subagent threads are never archived or deleted with their parent. So a worktree whose thread ever started a subagent is kept forever, even after the user deletes the parent thread.
In my project this blocked 45 of 81 worktrees. Subagent threads caused 44 of them.
Repro
Turn on "Delete unchanged worktrees".
In a worktree thread, have the agent start one subagent.
Settle or delete the thread, then run Settings → Storage → Delete now.
The worktree is kept: "Shared by 2 threads".
Expected
Subagent threads should not count as users of a worktree. Their state should follow the parent thread's state (open, archived or deleted).
Activity