Skip to content

fix(server): worktree cleanup removes half-deleted checkouts - #249

Merged
badcuban merged 1 commit into
mainfrom
threadlines/fix-worktree-deletion
Sep 6, 2026
Merged

fix(server): worktree cleanup removes half-deleted checkouts#249
badcuban merged 1 commit into
mainfrom
threadlines/fix-worktree-deletion

Conversation

@badcuban

@badcuban badcuban commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

The clean up worktrees view listed three worktrees as deletable, but deleting any of them failed with fatal: validation failed, cannot remove working tree: '.../.git' does not exist. Each folder had been half deleted by an earlier removal: the .git file was gone but some files were left behind, so git lists the entry as prunable and refuses git worktree remove on it.

removeWorktree now asks git how it sees the registration when the remove command fails. A prunable entry gets git worktree prune and the server deletes the leftover folder itself, reusing the retry loop that already handles folders a shell still holds open. Live registrations and unrelated failures surface exactly as before. One regression test half-deletes a worktree and checks removal clears both the folder and git's record of it.

A worktree removal that died halfway (a long-path failure before
core.longpaths, a kill mid-delete) leaves the folder without its .git
file. Git then lists the registration as prunable and refuses to remove
it ("validation failed ... '.git' does not exist"), so the cleanup view
offered the worktree for deletion but every attempt failed.

removeWorktree now asks git how it sees the registration when the
remove command fails. A prunable entry is pruned and the leftover folder
is deleted by the server, reusing the retry loop that already handles
folders a shell still holds open. Live registrations and unrelated
failures still surface as before.
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Sep 6, 2026 8:49am UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 6, 2026
@badcuban
badcuban enabled auto-merge September 6, 2026 08:52
@badcuban
badcuban added this pull request to the merge queue Sep 6, 2026
Merged via the queue into main with commit 46bc190 Sep 6, 2026
16 checks passed
@badcuban
badcuban deleted the threadlines/fix-worktree-deletion branch September 6, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant