Skip to content

The agent that grows with you

fix(desktop): legacy remote session reads follow the owner route too

Teknium8d78a877d858
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 8434c32040b..2bc62374eef 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -15972,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|/mutation-snapshot] → read from remote
+// GET /api/sessions/{id}[/messages|/mutation-snapshot|/timeline|/messages/around] → read from remote
// DELETE /api/sessions/{id} → delete on remote
// PATCH /api/sessions/{id} → rename/archive on remote
async function interceptSessionRequestForRemote(request, registryConnectionId = null) {
diff --git a/apps/desktop/electron/profile-session-routing.test.ts b/apps/desktop/electron/profile-session-routing.test.ts
index 22b553e8dfa..311a24bf658 100644
--- a/apps/desktop/electron/profile-session-routing.test.ts
+++ b/apps/desktop/electron/profile-session-routing.test.ts
@@ -25,11 +25,14 @@ import {
tagRemoteSessionRows
} from './profile-session-routing'
-test('remote session routing includes the mutation snapshot read and no other child route', () => {
+test('remote session routing includes the mutation snapshot and session reads, 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/timeline'), true)
+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/messages/around'), true)
+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/export'), false)
+ assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/messages/extra'), false)
assert.equal(isRemoteSessionRequestPath('/api/sessions/stored-session/mutation-snapshot/extra'), false)
})
diff --git a/apps/desktop/electron/profile-session-routing.ts b/apps/desktop/electron/profile-session-routing.ts
index 2d8610fb118..0756a3daca4 100644
--- a/apps/desktop/electron/profile-session-routing.ts
+++ b/apps/desktop/electron/profile-session-routing.ts
@@ -51,9 +51,11 @@ export function isAllProfilesSessionListRequest(method: string | undefined, path
)
}
-/** Paths whose session data must follow the legacy remote owner route. */
+/** Paths whose session data must follow the legacy remote owner route. The fenced
+ * edit reads `/mutation-snapshot` before its PATCH; both must reach the backend that
+ * owns the row, or the revision fence compares against the wrong store (#138905). */
export function isRemoteSessionRequestPath(pathname: string): boolean {
- return /^\/api\/sessions\/[^/]+(?:\/(?:messages|mutation-snapshot))?$/.test(pathname)
+ return /^\/api\/sessions\/[^/]+(?:\/(?:messages|messages\/around|mutation-snapshot|timeline))?$/.test(pathname)
}
function rowsOf(data: unknown): unknown[] {