The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): explicitly scoped session reads keep the ambient dial priority
teknium16ae79db3eb06
diff --git a/apps/desktop/src/api/sessions.test.ts b/apps/desktop/src/api/sessions.test.tsindex 0bbf3dadaf3..ae03a525794 100644--- a/apps/desktop/src/api/sessions.test.ts+++ b/apps/desktop/src/api/sessions.test.ts@@ -11,7 +11,7 @@ vi.mock('./client', () => ({const client = await import('./client')-const { deleteSession, setSessionArchived, setSessionPinnedRemote, setSessionUnreadRemote, listSidebarSessions } =+const { deleteSession, getSession, setSessionArchived, setSessionPinnedRemote, setSessionUnreadRemote, listSidebarSessions } =await import('./sessions')const hermesApi = vi.mocked(client.hermesApi)@@ -85,6 +85,21 @@ describe('deleteSession profile scoping', () => {})})+describe('getSession dial priority', () => {+ it('does not dial an explicitly scoped session read foreground', async () => {+ // The scope helper tags every explicit scope foreground (#111651); the+ // cross-profile probe loop in resolveStoredSession would otherwise cold-start+ // every other profile on the reserved slot during a boot-time resume.+ hermesApi.mockResolvedValue({ id: 'sess-5' } as never)+ vi.mocked(client.capabilityScoped).mockReturnValue({ priority: 'foreground', profile: 'tommy' })++ await getSession('sess-5', { connectionId: 'local', profile: 'tommy' })++ expect(hermesApi.mock.calls[0][0]).toMatchObject({ profile: 'tommy', connectionId: 'local' })+ expect(hermesApi.mock.calls[0][0]).not.toHaveProperty('priority')+ })+})+describe('setSessionArchived profile scoping', () => {it('carries the owning profile in the PATCH body', async () => {// Same class as the unscoped DELETE: the PATCH handler reads its target DBdiff --git a/apps/desktop/src/api/sessions.ts b/apps/desktop/src/api/sessions.tsindex 8ad982da8c1..c1c090045dd 100644--- a/apps/desktop/src/api/sessions.ts+++ b/apps/desktop/src/api/sessions.ts@@ -28,7 +28,12 @@ function sessionScoped(scope?: ProfileScope): { connectionId?: string; profile?:return {}}- const scoped = capabilityScoped(scope)+ // Session reads keep the ambient dial default (main's background): the+ // cross-profile probe that resolves a remembered/404'd session id walks every+ // other profile (resolveStoredSession) and must not cold-start each one on the+ // pool's reserved foreground slot. The tag belongs to the scope selectors+ // (Settings, Capabilities, Messaging), not to session lookups.+ const { priority: _priority, ...scoped } = capabilityScoped(scope)if (typeof scope === 'object' && scope.connectionId?.trim() === 'local') {return { ...scoped, connectionId: 'local' }