The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): session edits on a remote primary stay on its route
teknium120b9d3a1f188
diff --git a/apps/desktop/src/api/sessions.ts b/apps/desktop/src/api/sessions.tsindex e9c52b3aa66..48afcf0bfcf 100644--- a/apps/desktop/src/api/sessions.ts+++ b/apps/desktop/src/api/sessions.ts@@ -373,7 +373,9 @@ export async function listSidebarSessions(req: SidebarSessionsRequest): Promise<const runSessionMutation = createSessionMutationClient()function mutateSessionHttp<T>(id: string, method: 'PATCH' | 'DELETE', payload: Record<string, unknown>, profile?: ProfileScope): Promise<T> {- const scope = { connectionId: getApiRequestConnection() || 'local', ...sessionScoped(profile) }+ // Null is the window's v1 route (its primary, local or remote); defaulting it to+ // the registry's 'local' source would pin a remote primary's edits to this machine.+ const scope = { connectionId: getApiRequestConnection(), ...sessionScoped(profile) }const path = `/api/sessions/${encodeURIComponent(id)}`const query = new URLSearchParams(scope.profile ? { profile: scope.profile } : {})const suffix = query.size ? `?${query}` : ''diff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.tsindex 712af22d5e4..f583ea7c46b 100644--- a/apps/desktop/src/sdk/index.ts+++ b/apps/desktop/src/sdk/index.ts@@ -1552,7 +1552,8 @@ export const host = {throw new Error('Persisted session updates require a profile and session id')}- const scope = { connectionId: route?.connectionId || getApiRequestConnection() || 'local' }+ // Null keeps the window's v1 route (a remote primary stays remote).+ const scope = { connectionId: route?.connectionId || getApiRequestConnection() }const path = `/api/sessions/${encodeURIComponent(options.sessionId)}`const payload = { hidden: options.hidden, profile }diff --git a/apps/desktop/src/sdk/profile-routing.test.ts b/apps/desktop/src/sdk/profile-routing.test.tsindex 026891aaa1d..913d871b121 100644--- a/apps/desktop/src/sdk/profile-routing.test.ts+++ b/apps/desktop/src/sdk/profile-routing.test.ts@@ -348,6 +348,16 @@ describe('connection-aware plugin host APIs', () => {expect(requestGatewayForProfile).not.toHaveBeenCalled()})+ it('keeps an unrouted persisted-session edit on the window primary instead of pinning it to this device', async () => {+ vi.mocked(hermesApi)+ .mockResolvedValueOnce({ exists: true, runtime_revision: 2, runtime_generation: 1 })+ .mockResolvedValueOnce({ ok: true, hidden: true })++ await host.setPersistedSessionHidden(null, { sessionId: 'remote-chat', profile: 'default', hidden: true })++ expect(vi.mocked(hermesApi).mock.calls.map(([request]) => request.connectionId)).toEqual([null, null])+ })+it('forwards an explicit timeout so long-running methods outlive the generic deadline', async () => {// #93911: bot_relay.deliver's backend contract tolerates ~1320s (120s turn// lock + a 600s turn, doubled by the bounded retry). Without a way to pass