The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a fresh draft's drawer no longer shows another runtime's pending tab
teknium1c2b049241d31
diff --git a/apps/desktop/src/store/preview.test.ts b/apps/desktop/src/store/preview.test.tsindex 820cc18b12b..ede239a0561 100644--- a/apps/desktop/src/store/preview.test.ts+++ b/apps/desktop/src/store/preview.test.ts@@ -688,6 +688,37 @@ describe('preview session scoping (#73890)', () => {}})+ // A runtime's pending tab (opened before its stored id bound) belongs to that+ // runtime's drawer only: a fresh draft — or another runtime — must not see+ // it, while a true draft tab stays in the draft.+ it("keeps a runtime's pending tab out of a fresh draft's drawer", () => {+ $activeSessionId.set('rt-shown')++ try {+ openPreview(urlTarget('https://pending.example'))+ const pendingTab = $previewTabs.get()[0]!.id++ expect($visiblePreviewTabs.get().map(tab => tab.id)).toEqual([pendingTab])++ // A fresh draft: no runtime on screen yet.+ $activeSessionId.set(null)+ expect($visiblePreviewTabs.get()).toEqual([])++ openPreview(fileTarget('/work/draft-own.html'))+ expect(paths($visiblePreviewTabs.get())).toEqual(['/work/draft-own.html'])++ // Another runtime on screen sees neither the first runtime's tab.+ $activeSessionId.set('rt-other')+ expect($visiblePreviewTabs.get().map(tab => tab.id)).not.toContain(pendingTab)++ // The runtime that opened it still does.+ $activeSessionId.set('rt-shown')+ expect($visiblePreviewTabs.get().map(tab => tab.id)).toContain(pendingTab)+ } finally {+ $activeSessionId.set(null)+ }+ })+it('owns a strip "+" Browser by the focused session, never adopting it elsewhere', () => {$selectedStoredSessionId.set('sess-x')newBrowserTab()diff --git a/apps/desktop/src/store/preview.ts b/apps/desktop/src/store/preview.tsindex 4af73e81aec..aa564cda84c 100644--- a/apps/desktop/src/store/preview.ts+++ b/apps/desktop/src/store/preview.ts@@ -392,9 +392,23 @@ function currentSessionId(sessionId: null | string | undefined): null | string {}/** True when `sessionId`'s drawer shows `tab`: its own tabs plus every pin.- * With no session (a fresh draft) the ownerless tabs are its own. */-function tabVisibleTo(tab: PreviewTab, sessionId: null | string, rotated: ReadonlyMap<string, string>): boolean {- return Boolean(tab.pinned) || latestSessionId(tab.sessionId, rotated) === latestSessionId(sessionId, rotated)+ * With no session (a fresh draft) the true draft tabs are its own — never a+ * runtime's pending tab, which only that runtime's drawer shows. */+function tabVisibleTo(+ tab: PreviewTab,+ sessionId: null | string,+ rotated: ReadonlyMap<string, string>,+ pending: ReadonlyMap<string, string>+): boolean {+ if (tab.pinned) {+ return true+ }++ if (tab.sessionId == null && pending.has(tab.id)) {+ return false+ }++ return latestSessionId(tab.sessionId, rotated) === latestSessionId(sessionId, rotated)}/** Who an agent tool acts for: a stored id (null = none bound yet), or the@@ -516,7 +530,7 @@ export const $visiblePreviewTabs = computed((tabs, sessionId, rotated, pending, activeRuntime, focusedIsTile, selectionIsListed) =>tabs.filter(tab =>- tabVisibleTo(tab, sessionId, rotated) ||+ tabVisibleTo(tab, sessionId, rotated, pending) ||(!focusedIsTile &&!selectionIsListed &&tab.sessionId == null &&