From 8e22ad2d0aa02c28de814cdcac9c8b8208dde833 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 7 Oct 2026 22:41:58 -0700 Subject: [PATCH] Scope completed worktree removal authorization refresh to its repository (#26253) --- .../runtime/orca-runtime-resolve-worktree-removal-target.ts | 4 ++-- .../worktree-removal-and-reconciliation-part-03.spec.ts | 4 ++-- .../worktree-removal-and-reconciliation.spec.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts b/src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts index f66240f5739..ed4aa8981b4 100644 --- a/src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts +++ b/src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts @@ -24,7 +24,7 @@ import { terminalShellOverrideRefusal } from './terminal-shell-override-host-sup import { resolveTerminalStartupCwd } from '../../shared/terminal-startup-cwd' import { resolveLocalProjectRuntimeForWorktreeId } from '../local-project-runtime-resolution' import { LOCAL_EXECUTION_HOST_ID, parseExecutionHostId } from '../../shared/execution-host' -import { invalidateAuthorizedRootsCache } from '../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCacheForRepo } from '../ipc/filesystem-auth' import { resumeInterruptedWorktreeRemovals, retryFailedWorktreeRemoval, @@ -124,7 +124,7 @@ export class OrcaRuntimeWithResolveWorktreeRemovalTarget extends OrcaRuntimeWith this.removeWorktreeMetadataAndHistory(store, worktreeId, removalHostId) this.invalidateResolvedWorktreeCache() this.invalidateWorktreeScanCacheForRepo(repoId) - invalidateAuthorizedRootsCache() + invalidateAuthorizedRootsCacheForRepo(store, repoId) } protected removeWorktreeMetadataAndHistory( diff --git a/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.ts b/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.ts index 96abf6a97ce..1017a8e9908 100644 --- a/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.ts +++ b/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.ts @@ -350,7 +350,7 @@ describe('OrcaRuntimeService', () => { // an unqualified purge would evict a same-id row owned by another host. expect(removeWorktreeMeta).toHaveBeenCalledWith(worktreeId, 'local') expect(deleteWorktreeHistoryDirMock).toHaveBeenCalledWith(worktreeId) - expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalled() + expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalledWith(runtimeStore, TEST_REPO_ID) expect(notifier.worktreesChanged).toHaveBeenCalledWith(TEST_REPO_ID) } finally { await rm(parentDir, { recursive: true, force: true }) @@ -376,7 +376,7 @@ describe('OrcaRuntimeService', () => { // an unqualified purge would evict a same-id row owned by another host. expect(removeWorktreeMeta).toHaveBeenCalledWith(worktreeId, 'local') expect(deleteWorktreeHistoryDirMock).toHaveBeenCalledWith(worktreeId) - expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalled() + expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalledWith(runtimeStore, TEST_REPO_ID) expect(notifier.worktreesChanged).toHaveBeenCalledWith(TEST_REPO_ID) } finally { await rm(parentDir, { recursive: true, force: true }) diff --git a/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation.spec.ts b/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation.spec.ts index d371ac3f96f..89f516dfac2 100644 --- a/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation.spec.ts +++ b/src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation.spec.ts @@ -489,6 +489,7 @@ describe('OrcaRuntimeService', () => { }) ) expect(deleteWorktreeHistoryDirMock).toHaveBeenCalledWith(TEST_WORKTREE_ID) + expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalledWith(store, TEST_REPO_ID) expect(result.warning).toBe( `orca.yaml archive hook skipped for ${TEST_WORKTREE_PATH}; pass --run-hooks to run it.` )