The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): reconcile tiles on return even with no selected session
liuhao10241ce2cfb7facc
diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.test.tsindex 87043479d09..6c034ed5ab4 100644--- a/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts+++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts@@ -795,6 +795,27 @@ describe('active transcript refresh', () => {await waitFor(() => expect(getLatestSessionMessages).toHaveBeenCalledWith(tileStoredId, undefined, { passive: true }))})+ it('reconciles tiles on return in a workspace with no selected session (#125532 review)', async () => {+ // A workspace whose pane shows only bot tiles has no main-pane selection+ // (activeSessionId null); the return reconcile must still reach the tiles,+ // while the main-pane refresh stays silent for lack of a session to resolve.+ const tileRuntimeId = 'runtime-tile-only'+ const tileStoredId = 'stored-tile-only'+ $sessionTiles.set([{ runtimeId: tileRuntimeId, storedSessionId: tileStoredId }])+ publishSessionState(tileRuntimeId, createClientSessionState(tileStoredId))+ vi.mocked(getLatestSessionMessages).mockResolvedValue(transcript('tile only answer', tileStoredId) as never)++ const refresh = vi.fn(async () => undefined)+ renderSync(refresh, { activeSessionId: null, activeStoredSessionId: null })++ await act(async () => {+ document.dispatchEvent(new Event('visibilitychange'))+ })++ expect(refresh).not.toHaveBeenCalled() // nothing selected in the main pane+ await waitFor(() => expect(getLatestSessionMessages).toHaveBeenCalledWith(tileStoredId, undefined, { passive: true }))+ })+it('does not refresh on a visibilitychange to hidden (#125532 review)', () => {vi.spyOn(document, 'visibilityState', 'get').mockReturnValue('hidden')$changeEventsAvailable.set(true)diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.tsindex 9313f1b32a5..1d89976b66c 100644--- a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts+++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.ts@@ -1164,7 +1164,7 @@ export function useBackgroundSync({// the reconcile is signature-gated, so an unchanged transcript costs one// cheap tail read. Messaging transcripts keep their own visible poll below.useEffect(() => {- if (gatewayState !== 'open' || activeIsMessaging || !activeSessionId || !activeStoredSessionId) {+ if (gatewayState !== 'open' || activeIsMessaging) {return}@@ -1192,7 +1192,12 @@ export function useBackgroundSync({}lastRefreshAt = now- requestActiveTranscriptRefresh(true)+ // The main pane resolves only with a selected session; a workspace whose+ // pane shows just bot tiles has none, and the tile reconcile below still+ // owes those tiles their catch-up.+ if (activeSessionId && activeStoredSessionId) {+ requestActiveTranscriptRefresh(true)+ }// Workspace tiles share the zombie-socket blind spot: the sessions.changed// tick that would have reconciled them does not replay on wake, and bot// canonical chats never resolve through the main-pane path. The shared