The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep dead tiles out of reopen history
funky-xamarinaa492fb76ea1
diff --git a/apps/desktop/src/app/chat/session-tile-gone.test.ts b/apps/desktop/src/app/chat/session-tile-gone.test.tsindex 48ae7cad63a..70e55ad54be 100644--- a/apps/desktop/src/app/chat/session-tile-gone.test.ts+++ b/apps/desktop/src/app/chat/session-tile-gone.test.ts@@ -7,7 +7,7 @@ import { stashSessionDraft, clearSessionDraft, takeSessionDraft } from '@/store/import { $gatewaySwitching } from '@/store/gateway-switch'import { $activeGatewayProfile, $profiles } from '@/store/profile'import { $connection, $gatewayState, $sessions } from '@/store/session'-import { $sessionTiles, openSessionTile } from '@/store/session-states'+import { $sessionTiles, openSessionTile, reopenLastClosedTile, closeSessionTile } from '@/store/session-states'import { startUnrestoredTileTitleBackfill } from './session-tile'@@ -42,6 +42,18 @@ afterEach(() => {})describe('restored dead tile backfill', () => {+ it('does not resurrect a dead tile ahead of a user-closed tab on reopen', async () => {+ openSessionTile('user-closed')+ closeSessionTile('user-closed')+ openSessionTile('deleted-chat')+ get.mockRejectedValue(new Error('404: Session not found'))+ stop = startUnrestoredTileTitleBackfill()+ $gatewayState.set('open')+ await vi.waitFor(() => expect($sessionTiles.get()).toEqual([]))+ reopenLastClosedTile()+ expect($sessionTiles.get().map(tile => tile.storedSessionId)).toEqual(['user-closed'])+ })+it('releases scope subscriptions on cancellation even while lookup is pending', async () => {openSessionTile('deleted-chat')const released = vi.fn()diff --git a/apps/desktop/src/app/chat/session-tile.tsx b/apps/desktop/src/app/chat/session-tile.tsxindex bcdbee82595..20f14dcafef 100644--- a/apps/desktop/src/app/chat/session-tile.tsx+++ b/apps/desktop/src/app/chat/session-tile.tsx@@ -66,6 +66,7 @@ import {$sessionTileDelegateRevision,$sessionTiles,closeSessionTile,+ discardSessionTile,patchSessionTile,type SessionTile,sessionTileDelegate@@ -677,7 +678,7 @@ export function startUnrestoredTileTitleBackfill(lookup = probeStoredSession): (!draft.text.trim() &&draft.attachments.length === 0) {- closeSessionTile(tile.storedSessionId)+ discardSessionTile(tile.storedSessionId)}}).catch(() => undefined)