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
cleanupWorktree should null ghost fields when the dir is already gone #843
cleanupWorktree (electron/worktrees.js) runs git worktree remove and throws if that fails, before it can updateThread({ worktreePath: null, branch: null }). That leaves ghost worktreePath/branch on done threads after the directory was removed outside the app (PR #840 leftover extract, orphan sweep, manual rm). After prune, git reports is not a working tree.
maybeCleanupMergedWorktree already handles the missing-dir case: prune, best-effort branch -D, then null the fields.
Do
Treat a missing worktreePath the same way: do not throw, still null worktreePath+branch, do not set pendingWorktree.
Add a test next to the existing worktrees tests.
Do not change default-branch merge behavior when the dir still exists.
cleanupWorktree now matches maybeCleanupMergedWorktree when the dir is already gone: prune, best-effort branch -D, then updateThread({ worktreePath: null, branch: null }). Does not set pendingWorktree. Live-dir git worktree remove still throws on failure.
Test: removeWorktree nulls ghost fields when the worktree dir is already gone in electron/test/worktrees.test.js. RED was Failed to remove worktree: … is not a working tree. worktrees.test.js 64/64 pass; blast-radius rematerialize-then-merge still passes.
Implementing on coder/fork-fork-fork-solenta-guardrail-deny-as-712b7c: treat a missing worktree dir as already removed in cleanupWorktree, then null worktreePath/branch the same as the success path. Tests first in electron/test/worktree-cleanup.test.js. Not touching live coder-store.json or Application Support worktrees.
Implemented on coder/fork-fork-fork-solenta-guardrail-deny-as-712b7c.
cleanupWorktree now treats a missing directory as already removed: prune, then updateThread({ worktreePath: null, branch: null }) + save(), same as the success path. pendingWorktree is not set. A present dir that git cannot remove still throws.
Tests in electron/test/worktree-cleanup.test.js (missing dir, present dir, throw when the path is the main checkout). Verified: 3/3 new tests pass; existing removeWorktree tests pass.
Did not touch live coder-store.json or Application Support worktrees.
Activity
currentbits commentedon Sep 2, 2026
cleanupWorktreenow matchesmaybeCleanupMergedWorktreewhen the dir is already gone: prune, best-effortbranch -D, thenupdateThread({ worktreePath: null, branch: null }). Does not setpendingWorktree. Live-dirgit worktree removestill throws on failure.Test:
removeWorktree nulls ghost fields when the worktree dir is already goneinelectron/test/worktrees.test.js. RED wasFailed to remove worktree: … is not a working tree.worktrees.test.js64/64 pass; blast-radius rematerialize-then-merge still passes.currentbits commentedon Sep 2, 2026
Implementing on
coder/fork-fork-fork-solenta-guardrail-deny-as-712b7c: treat a missing worktree dir as already removed incleanupWorktree, then nullworktreePath/branchthe same as the success path. Tests first inelectron/test/worktree-cleanup.test.js. Not touching livecoder-store.jsonor Application Support worktrees.currentbits commentedon Sep 2, 2026
Implemented on
coder/fork-fork-fork-solenta-guardrail-deny-as-712b7c.cleanupWorktreenow treats a missing directory as already removed: prune, thenupdateThread({ worktreePath: null, branch: null })+save(), same as the success path.pendingWorktreeis not set. A present dir that git cannot remove still throws.Tests in
electron/test/worktree-cleanup.test.js(missing dir, present dir, throw when the path is the main checkout). Verified: 3/3 new tests pass; existingremoveWorktreetests pass.Did not touch live
coder-store.jsonor Application Support worktrees.currentbits commentedon Sep 3, 2026
Audit of how this landed on main (via #850 squash
ea85e2be):This is the intended #843 fix. It belonged on main. Do not revert.
What shipped in
electron/worktrees.js+electron/test/worktree-cleanup.test.jsmatches this issue:worktreePathis treated as already-removed: prune, thenupdateThread({ worktreePath: null, branch: null })pendingWorktreemaybeCleanupMergedWorktreeHow it got onto main was a leftover worktree merge, not STT work:
coder/fork-fork-fork-solenta-guardrail-deny-as-712b7c(thread712b7ce3)fe8a42c1(Merge worktree coder/fork-fork-fork-solenta-guardrail-deny-as-712b7c)spike/speech/only, "no product code"closedByPullRequestsReferencesempty). This issue was closed COMPLETED on 2026-09-02 when the worker finished on its branch, ~17h before the squash.Vehicle was wrong. Content was right. Reverting those two files would re-open the #841/#843 ghost-field bug.
Verified on this audit: the three
#843tests inelectron/test/worktree-cleanup.test.jspass (missing dir, present dir, throw on main checkout).