The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): route remote mutation snapshots
KoNit-K172de9b26b15
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex f02868bfe62..8434c32040b 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -467,6 +467,7 @@ import {hasPinnedRegistrySessionSource,isAllProfilesAggregateRequest,isAllProfilesSessionListRequest,+ isRemoteSessionRequestPath,pathWithRemoteOwnerScope,type RegistrySessionSource,remoteProfileQueryScope,@@ -15971,7 +15972,7 @@ ipcMain.handle('hermes:window:readBelow', async event => {// request.profile. Either way, a remote profile's session lives only on its// remote host, so the request must go there (where it serves its own state.db).// GET /api/profiles/sessions → splice each remote profile's rows in-// GET /api/sessions/{id}[/messages] → read from remote+ // GET /api/sessions/{id}[/messages|/mutation-snapshot] → read from remote// DELETE /api/sessions/{id} → delete on remote// PATCH /api/sessions/{id} → rename/archive on remoteasync function interceptSessionRequestForRemote(request, registryConnectionId = null) {@@ -16061,7 +16062,7 @@ async function interceptSessionRequestForRemote(request, registryConnectionId =// param (it serves its own state.db natively).// - global remote mode: ONE backend serves every profile via ?profile=, so// route there and KEEP the profile param so it opens the right state.db.- if (/^\/api\/sessions\/[^/]+(\/messages)?$/.test(pathname)) {+ if (isRemoteSessionRequestPath(pathname)) {let profile = (searchParams.get('profile') || request.profile || '').trim()if (!profile) {diff --git a/apps/desktop/electron/profile-session-routing.test.ts b/apps/desktop/electron/profile-session-routing.test.tsindex 1b404826261..22b553e8dfa 100644--- a/apps/desktop/electron/profile-session-routing.test.ts+++ b/apps/desktop/electron/profile-session-routing.test.ts@@ -14,6 +14,7 @@ import {hasPinnedRegistrySessionSource,isAllProfilesAggregateRequest,isAllProfilesSessionListRequest,+ isRemoteSessionRequestPath,mergeProfileSessionWindow,pathWithRemoteOwnerScope,remoteProfileQueryScope,@@ -24,6 +25,14 @@ import {tagRemoteSessionRows} from './profile-session-routing'+test('remote session routing includes the mutation snapshot read and no other child route', () => {+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session'), true)+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/messages'), true)+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/mutation-snapshot'), true)+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/timeline'), false)+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/mutation-snapshot/extra'), false)+})+test('all-profiles session routing is limited to read-only list endpoints', () => {assert.equal(isAllProfilesSessionListRequest('GET', '/api/profiles/sessions?profile=all'), true)assert.equal(isAllProfilesSessionListRequest('GET', '/api/profiles/sessions/sidebar?recents_profile=all'), true)diff --git a/apps/desktop/electron/profile-session-routing.ts b/apps/desktop/electron/profile-session-routing.tsindex 5fc6215713f..2d8610fb118 100644--- a/apps/desktop/electron/profile-session-routing.ts+++ b/apps/desktop/electron/profile-session-routing.ts@@ -51,6 +51,11 @@ export function isAllProfilesSessionListRequest(method: string | undefined, path)}+/** Paths whose session data must follow the legacy remote owner route. */+export function isRemoteSessionRequestPath(pathname: string): boolean {+ return /^\/api\/sessions\/[^/]+(?:\/(?:messages|mutation-snapshot))?$/.test(pathname)+}+function rowsOf(data: unknown): unknown[] {if (!data || typeof data !== 'object' || !('sessions' in data)) {return []