The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a session-picker click re-selects the active session
Austin Pickette30c6aecef92
diff --git a/apps/desktop/src/app/open-session.test.ts b/apps/desktop/src/app/open-session.test.tsindex d0292c1df2d..f829c075ea0 100644--- a/apps/desktop/src/app/open-session.test.ts+++ b/apps/desktop/src/app/open-session.test.ts@@ -35,7 +35,7 @@ vi.mock('./routes', () => ({sessionRoute: (id: string) => `/c/${encodeURIComponent(id)}`}))-import { $activeSessionId, $selectedStoredSessionId } from '@/store/session'+import { $activeSessionId, $selectedStoredSessionId, $sessionResumeRequest } from '@/store/session'import { openSession, openSessionFromPicker, openSessionIntentFromModifiers } from './open-session'@@ -82,6 +82,7 @@ describe('openSession', () => {focusedSessionWorkspaceScope.mockReturnValue({ workspaceMode: 'sessions' })$activeSessionId.set(null)$selectedStoredSessionId.set(null)+ $sessionResumeRequest.set(null)})it('in-place focuses an existing tile and does not navigate', () => {@@ -256,6 +257,34 @@ describe('openSession', () => {expect(navigate).toHaveBeenCalledWith('/c/s3')})+ // #62045: picking the session this window already shows must still be an+ // EXPLICIT reselect — the picker door queues the resume request the sidebar+ // door always does, so use-route-resume re-runs resumeSession instead of+ // treating the click as an already-active no-op.+ it('picker queues an explicit resume request even for the session already on screen', () => {+ // The active session, already selected in main — the in-place open path+ // below would front 'main' and navigate nowhere.+ $selectedStoredSessionId.set('s1')+ $activeSessionId.set('runtime-current')+ focusOpenSession.mockReturnValue('main')++ expect($sessionResumeRequest.get()).toBeNull()++ openSessionFromPicker('s1', navigate)++ expect($sessionResumeRequest.get()?.sessionId).toBe('s1')+ // The session still lands on screen exactly as before.+ expect(navigate).not.toHaveBeenCalled()+ expect(openSessionTile).not.toHaveBeenCalled()++ // Not just the active row: every picker pick is an explicit reselect, so a+ // DIFFERENT session's request is queued too (with a fresh sequence).+ openSessionFromPicker('s2', navigate)++ expect($sessionResumeRequest.get()?.sessionId).toBe('s2')+ expect(($sessionResumeRequest.get()?.sequence ?? 0)).toBeGreaterThan(1)+ })+it('window pops out when the bridge supports it', () => {openSession('s1', navigate, 'window')expect(openSessionInNewWindow).toHaveBeenCalledWith('s1')diff --git a/apps/desktop/src/app/open-session.ts b/apps/desktop/src/app/open-session.tsindex 6b3cc4d29f4..b4da7a42c45 100644--- a/apps/desktop/src/app/open-session.ts+++ b/apps/desktop/src/app/open-session.ts@@ -15,7 +15,7 @@* the bridge has no session-window support.*/import type { WorkspaceMode } from '@/contrib/types'-import { $activeSessionId, $selectedStoredSessionId, markSessionRead } from '@/store/session'+import { $activeSessionId, $selectedStoredSessionId, markSessionRead, requestSessionResume } from '@/store/session'import type { SessionProfileRoute } from '@/store/session-request-router'import {focusedSessionNeedsRoute,@@ -88,6 +88,18 @@ export function openSessionFromPicker(navigate: OpenSessionNavigate,intent: OpenSessionIntent = 'in-place'): void {+ // A picker click is an EXPLICIT reselect, even when the row is the chat this+ // window already shows (#62045): openSession's in-place path would see the+ // active session on screen, front it (a visual no-op), and never queue a+ // resume — so the transcript/composer never get the re-attach a sidebar click+ // on the same row issues via its own door (wiring.tsx openStoredSession →+ // requestSessionResume). Queue the explicit request here so every picker+ // surface (/resume overlay, ⌘K, artifacts) matches the sidebar, and+ // use-route-resume's `explicitlyRequested` branch bypasses its+ // already-active skip and re-runs resumeSession (which re-fronts the+ // surface and re-focuses the composer through its normal path).+ requestSessionResume(storedSessionId)+const workspaceScope = focusedSessionWorkspaceScope()const resolved = workspaceScope.workspaceMode === 'bots' && intent === 'in-place' ? 'stack' : intent