Skip to content

feat(worktrees): add manual cleanup for failed checkouts - #1072

Merged
nixuuu merged 2 commits into
devfrom
feat/manual-worktree-cleanup
Nov 21, 2026
Merged

nixuuu merged 2 commits into
devfrom
feat/manual-worktree-cleanup

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

What changed

  • Settings → Worktrees offers Clean up… for locked checkouts from a verified failed Canopy setup. The confirmation identifies the folder and explains that cleanup removes the worktree directory and its Git registration while keeping the local branch.
  • The worker records proof after the checkout process tree has stopped and automatic rollback has left an incomplete checkout. It verifies the original directory identities, registration, branch and contents again before deleting. A matching Git backlink is accepted, and the reported state without a backlink or index and with an empty index.lock is covered. Older entries without proof show why cleanup is unavailable.
  • Cleanup checks for saved worktrees, workspace paths and active threads, and rejects stale confirmations or worker connections. The worker verifies both directories again after moving them aside and reports where any retained files can be found. The checkout timeout behavior and copy on dev are preserved.

Thanks @janek-normalnie for reporting the incomplete checkout and suggesting a manual cleanup action.

Verification

  • On nix-pc (Linux, Git 2.56.0, Bun 1.4.5), 88 focused tests passed on ed80fec8 through check:tmp, with no leftover temporary fixtures. They cover successful and failed checkout creation, the existing rollback, refusal for foreign or changed data, branch and metadata races, concurrent confirmations, owner and workspace scope, link replacement and expiry, and ordinary worktree lifecycle. A real Git checkout also timed out with its backlink present and was cleaned after a transient error prevented automatic rollback. A separate Linux fixture cleaned 22,000 remaining CRLF files from a 55,000-path repo with the Git backlink and index absent.
  • Worker, gateway and integration-test typechecks passed on the final revision. Web and mobile typechecks passed on the unchanged UI implementation. Editing-scope lint, format and diff checks passed. Protobuf outputs were regenerated after updating the branch from dev.
  • Chromium exercised eligible and ineligible rows, cancel, stale confirmation, server refusal and successful refresh at 1440 and 390 px in light and dark themes. On the native Android 16 development client, verified Settings → Worktrees, the cleanup confirmation, a specific server refusal and refresh after a successful cleanup response. Both UI checks used isolated response fixtures. The gateway–worker tests used a real repository.
  • CI runs the checkout and cleanup regression with native Git on the Windows Server runner. Jan’s Windows 11 device and original repository were unavailable.
  • Copy audit (§8). The eligible row now reads “Canopy setup failed · Locked worktree”. “Clean up…” and “Clean up worktree” use the same verb. The confirmation describes the consequences, and a refusal shows its reason beside the refresh action. Checked short, typical and long names at desktop and phone widths.

Related: #1026

@nixuuu
nixuuu enabled auto-merge (squash) November 21, 2026 12:13
@nixuuu
nixuuu disabled auto-merge November 21, 2026 12:14
@nixuuu
nixuuu enabled auto-merge (squash) November 21, 2026 12:18
@nixuuu
nixuuu disabled auto-merge November 21, 2026 12:24
@nixuuu
nixuuu force-pushed the feat/manual-worktree-cleanup branch from ec5f1e8 to ed80fec Compare November 21, 2026 12:27
@nixuuu
nixuuu enabled auto-merge (squash) November 21, 2026 12:27
@nixuuu
nixuuu merged commit 8546a02 into dev Nov 21, 2026
17 checks passed
@nixuuu
nixuuu deleted the feat/manual-worktree-cleanup branch November 21, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant