fix: recover missing worktree deletes (#4811)

This commit is contained in:
Jinjing
2026-06-07 11:01:26 -07:00
committed by GitHub
parent f9e8616bb6
commit bb40dcd028
8 changed files with 94 additions and 9 deletions
+7 -1
View File
@@ -444,7 +444,8 @@ import {
findRegisteredDeletableWorktree,
isWorktreePathMissing,
ORPHANED_WORKTREE_DIRECTORY_MESSAGE,
stripOrcaProvenanceMetaUpdates
stripOrcaProvenanceMetaUpdates,
UNREGISTERED_MISSING_WORKTREE_MESSAGE
} from '../worktree-removal-safety'
import { prefetchWorktreeCreateBase } from '../worktree-create-base-prefetch'
import { invalidateAuthorizedRootsCache } from '../ipc/filesystem-auth'
@@ -10353,6 +10354,11 @@ export class OrcaRuntimeService {
return {}
}
if (await isRuntimeWorktreePathMissing(repo, removalTarget.path)) {
if (!force && !removedMeta) {
// Why: without persisted metadata, require the renderer recovery
// path before deleting Orca-only state for an unregistered path.
throw new Error(UNREGISTERED_MISSING_WORKTREE_MESSAGE)
}
// Why: a manually deleted worktree is already gone from Git and disk.
// Finish runtime metadata cleanup without requiring force or touching
// any unregistered path that still exists.