Repository navigation
Description
Measured (live store, 2026-08-20)
- 505 threads, 216 hold a worktreePath, 195 are
orchWorker. - 191 orch workers are stranded: status
done/idle, non-nullworktreePath, all 191 archived, 0 pinned. ~/Library/Application Support/Solenta/worktrees= 100 GB / 186 dirs.worktreeRetentionisundefinedon all five projects.- Probe of 40 stranded workers: 15 already gone from disk, 0 dirty, 6 with commits not on
main, 19 clean-and-merged.
#600 stopped the bleeding (thread_merge lands + removes a worker going forward). This issue reclaims the existing 100 GB.
Root cause: the GC already exists, it just never classifies anything
gcScan (#316) already walks worktreeBase, sizes each dir with du, and classifies candidates as orphan or retention; WorktreeGcSection already renders a per-project usage table, a per-row checkbox list and a "Delete N worktrees (X GB)" confirm. Nothing new is needed there.
The 191 stranded workers are not orphans — their threads still reference the path — so the only bucket that could catch them is retention, and that bucket is gated on worktreeRetention > 0 (electron/worktrees.js:3916), unset everywhere. They are invisible in the dialog and always have been. isSettledForGc already returns true for all 191 (archived is a settle signal), so the classification works the moment the gate opens.
Plan
-
DEFAULT_WORKTREE_RETENTION = 10as the fallback ingcScan's retention classification only. The 191 become visibleretentioncandidates in the existing dialog; per-project setting still overrides. -
enforceRetentionstays strictly opt-in — no new silent deletion. It is the one path that deletes without a human in the loop (boot,main.js:396). It must keep reclaiming only for projects with an explicitworktreeRetention, so it filters candidates to that set rather than inheriting the new default. It also skips anything with unmerged commits. -
Report unmerged commits per candidate.
git rev-list --count HEAD ^<default branch>ininspectWorktreeDir(default branch memoized per repo). This is not ablockedreason — GC removes directories and never branches, so the commits stay reachable via the branch ref — but it is the difference between dead weight and work worth keeping, so it must be visible and must not be reclaimed by accident. -
UI: unmerged rows are never pre-selected. "Select all" and the initial selection cover clean candidates only; an unmerged row renders
N unmerged commits · branch keptand stays untickable-by-default, so reclaiming one is an explicit per-row click. Section shows the reclaimable byte total.
Not doing
- No auto-remove of the 191. The affordance is the existing Settings → Worktrees dialog with its confirm; the user picks.
- No branch deletion anywhere (Worktree garbage collection with UI: retention limits, batch cleanup, visible disk usage #316's rule stands).
- No new IPC surface, no new dialog, no migration script.
Tests
electron/test/worktree-gc-retention.test.js: default retention produces candidates with no project setting; explicit setting overrides; enforceRetention ignores default-retention projects; unmerged count reported and skipped by enforceRetention. Renderer: unmerged row not pre-selected.
Activity
currentbits commentedon Aug 20, 2026
Shipped in
4c9605a.Verified against the live store (read-only,
skipSizes:false):enforceRetentionremoves at bootThe last row is the one that matters: boot GC is still opt-in, so nothing is deleted without the user opening Settings → Worktrees and confirming.
The unmerged probe is not a
blockedreason — GC removes directories and never branches, so those 27 branches keep every commit either way — but they are never pre-selected andenforceRetentionskips them outright.Tests: 8 new electron cases + 2 renderer. Confirmed load-bearing: stashing the diff makes the new suite fail, and the 5 remaining electron failures are byte-identical before and after (the #536 baseline).