The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep popped Browser tabs out of docked closes after the session-scope rebase
Brooklyn Nicholson87a128a656f8
diff --git a/apps/desktop/src/app/model-picker-overlay.test.tsx b/apps/desktop/src/app/model-picker-overlay.test.tsxindex 347fa6b8c64..c48a0b40a43 100644--- a/apps/desktop/src/app/model-picker-overlay.test.tsx+++ b/apps/desktop/src/app/model-picker-overlay.test.tsx@@ -17,9 +17,20 @@ import { ModelPickerOverlay } from './model-picker-overlay'const $focusedTreePaneId = $focusedTreePaneIdMock as unknown as WritableAtom<null | string>vi.mock('@/store/session-focus', async () => {- const { atom } = await import('nanostores')+ const { atom, computed } = await import('nanostores')+ const { $selectedStoredSessionId } = await import('@/store/session')+ const TILE_PANE_PREFIX = 'session-tile:'+ const $focusedTreePaneId = atom<null | string>(null)- return { $focusedTreePaneId: atom<null | string>(null) }+ // Only the tree focus is driven by the test; the session derivations stay real.+ return {+ $focusedSessionIsTile: computed($focusedTreePaneId, active => Boolean(active?.startsWith(TILE_PANE_PREFIX))),+ $focusedStoredSessionId: computed([$focusedTreePaneId, $selectedStoredSessionId], (active, selected) =>+ active?.startsWith(TILE_PANE_PREFIX) ? active.slice(TILE_PANE_PREFIX.length) : selected+ ),+ $focusedTreePaneId,+ TILE_PANE_PREFIX+ }})vi.mock('@/hermes', async importOriginal => ({...(await importOriginal<Record<string, unknown>>()),diff --git a/apps/desktop/src/store/preview.ts b/apps/desktop/src/store/preview.tsindex 2ddacf36f66..e3c55b28091 100644--- a/apps/desktop/src/store/preview.ts+++ b/apps/desktop/src/store/preview.ts@@ -990,14 +990,14 @@ export function closeBrowserPreviewMatchingLiveUrl(...candidates: string[]): booreturn true}-function closePreviewMatchingTabs(candidates: string[]): boolean {+function closePreviewMatchingTabs(tabs: readonly PreviewTab[], candidates: string[]): boolean {const queries = [...new Set(candidates.map(value => value.trim()).filter(Boolean))]if (queries.length === 0) {return false}- const tab = $visiblePreviewTabs.get().find(item => {+ const tab = tabs.find(item => {const fields = [item.target.source, item.target.url, item.target.label]return queries.some(query => fields.includes(query))@@ -1016,13 +1016,18 @@ function closePreviewMatchingTabs(candidates: string[]): boolean {* Empty candidates are a no-op so a missed match cannot wipe the rail —* closing the whole pane is `closeRightRail`. */export function closePreviewMatching(...candidates: string[]): boolean {- return closePreviewMatchingTabs(candidates)+ return closePreviewMatchingTabs($visiblePreviewTabs.get(), candidates)}/** Agent-driven close is scoped to the docked rail; an independent Browser* window owns popped tabs and must not lose its backing state here. */export function closeDockedPreviewMatching(...candidates: string[]): boolean {- return closePreviewMatchingTabs(candidates)+ const popped = $poppedBrowserTabIds.get()++ return closePreviewMatchingTabs(+ $visiblePreviewTabs.get().filter(tab => !popped.has(tab.id)),+ candidates+ )}/** Artifact tabs can't outlive the registry they read from, so clearing itdiff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex 52c608cc202..9cb5a073e70 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -2155,6 +2155,7 @@"preview.openPreview","preview.opening","preview.overwrite",+ "preview.pin","preview.popIn","preview.popOut","preview.previewAnyway",@@ -2167,6 +2168,7 @@"preview.truncated","preview.unavailable","preview.unknownSize",+ "preview.unpin","preview.unsavedChanges","preview.web.addComments","preview.web.address",