diff --git a/src/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.ts b/src/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.ts index 70d2bc3e2e6..020421e637c 100644 --- a/src/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.ts +++ b/src/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.ts @@ -225,6 +225,11 @@ export function pruneParkedTerminalWatchers(liveWorktreeIds: ReadonlySet } for (const [tabId, capture] of capturedPanesByTabId) { if (!liveWorktreeIds.has(capture.worktreeId)) { + for (const pane of capture.panes) { + // Worktree removal can bypass closeTab while panes are parked; release + // the same strong scroll-intent keys as explicit tab retirement. + releaseTerminalScrollIntentKey(pane.leafId) + } capturedPanesByTabId.delete(tabId) } }