Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(rpc-proxy): release the session rename upstream call when the client leaves

Alfredo Lopez70b7ef4ec1d2
diff --git a/external-rest-api/src/releaseManifest.ts b/external-rest-api/src/releaseManifest.ts
index f08d649c3..f159b47b7 100644
--- a/external-rest-api/src/releaseManifest.ts
+++ b/external-rest-api/src/releaseManifest.ts
@@ -9,7 +9,7 @@ export type ReleaseManifest = {
export const releaseManifest: ReleaseManifest = {
releaseId: 'v0.10.0',
externalRestApiVersion: '0.1.85',
- rpcProxyVersion: '0.1.110',
+ rpcProxyVersion: '0.1.111',
desktopVersion: '0.10.0',
minimumDesktopVersion: '0.1.252',
}
diff --git a/rpc-proxy/package-lock.json b/rpc-proxy/package-lock.json
index ef76e0d81..5bb586f38 100644
--- a/rpc-proxy/package-lock.json
+++ b/rpc-proxy/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.110",
+ "version": "0.1.111",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-rpc-proxy",
- "version": "0.1.110",
+ "version": "0.1.111",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.2",
diff --git a/rpc-proxy/package.json b/rpc-proxy/package.json
index c0c83626f..7544d37ea 100644
--- a/rpc-proxy/package.json
+++ b/rpc-proxy/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.110",
+ "version": "0.1.111",
"description": "External-facing RPC proxy for tenant-scoped MCP access",
"main": "dist/main.js",
"engines": {
diff --git a/rpc-proxy/src/__tests__/route-upstream-deadlines.real-http.test.ts b/rpc-proxy/src/__tests__/route-upstream-deadlines.real-http.test.ts
index 783974e2a..b0c08cfa9 100644
--- a/rpc-proxy/src/__tests__/route-upstream-deadlines.real-http.test.ts
+++ b/rpc-proxy/src/__tests__/route-upstream-deadlines.real-http.test.ts
@@ -63,6 +63,7 @@ const ALL_SCOPES = [
'host:approval:write',
'host:model:write',
'host:session:read',
+ 'host:session:write',
'host:task:read',
'host:message:invoke',
'host:wake:write',
@@ -751,13 +752,21 @@ describe.each(HELD_ROUTES)('R3-L7 $label pins the hold deadline before host reso
// abort after the upstream applied it would answer 504 for a change that took
// effect), but a client that is gone must still release the upstream socket.
const DISCONNECT_ROUTES = [
- ...MUTATING_ROUTES,
+ ...MUTATING_ROUTES.map(route => ({ ...route, method: 'POST' as const })),
{
label: 'cancel task',
+ method: 'POST',
path: '/rpc/hosts/chatllm/tasks/task-1/cancel',
body: {},
upstreamPath: '/v1/runtime/tasks/task-1/cancel',
},
+ {
+ label: 'rename session',
+ method: 'PATCH',
+ path: '/rpc/hosts/chatllm/sessions/chatllm/chat-1/name',
+ body: { title: 'Renamed chat' },
+ upstreamPath: '/v1/runtime/sessions/chatllm/chat-1/name',
+ },
] as const
const CLIENT_GONE_RELEASE_MS = 500
@@ -784,7 +793,7 @@ describe.each(DISCONNECT_ROUTES)(
const clientReq = httpRequest({
host: '127.0.0.1',
port,
- method: 'POST',
+ method: route.method,
path: route.path,
headers: {
authorization: 'Bearer tok',
@@ -809,7 +818,7 @@ describe.each(DISCONNECT_ROUTES)(
expect(Date.now() - disconnectedAt).toBeLessThan(CLIENT_GONE_RELEASE_MS)
expect(clientErrors).toEqual(['socket hang up'])
expect(seen.map(entry => `${entry.method} ${entry.url}`)).toEqual([
- `POST ${route.upstreamPath}`,
+ `${route.method} ${route.upstreamPath}`,
])
expect(controlApiMock.requestHostWakeFromControlApi).not.toHaveBeenCalled()
} finally {
@@ -848,7 +857,7 @@ describe.each(DISCONNECT_ROUTES)(
const clientReq = httpRequest({
host: '127.0.0.1',
port,
- method: 'POST',
+ method: route.method,
path: route.path,
headers: {
authorization: 'Bearer tok',
diff --git a/rpc-proxy/src/routes/rpc.ts b/rpc-proxy/src/routes/rpc.ts
index 3856287fc..99efa5c80 100644
--- a/rpc-proxy/src/routes/rpc.ts
+++ b/rpc-proxy/src/routes/rpc.ts
@@ -192,7 +192,8 @@ export function respondControlApiHostAccessRejection(
* cancel). The first attempt has no client-side timeout by design: aborting a
* request the upstream may already have applied would answer 504 for a change
* that took effect, and the user's retry would then hit "No pending approval".
- * Only a wake-and-hold retry passes `timeoutMs`, bounded by the hold deadline.
+ * Only a wake-and-hold retry passes `timeoutMs`, bounded by the hold deadline;
+ * session rename, which has no wake retry, passes its plain upstream timeout.
* A client that disconnects before the response is written aborts the call on
* every attempt, so a gone client never pins the upstream socket.
*/
@@ -1132,7 +1133,9 @@ export function createRpcRouter(): Router {
method: 'PATCH',
headers: { 'content-type': 'application/json', ...host.headers },
body: JSON.stringify(req.body),
- signal: AbortSignal.timeout(config.upstreamTimeoutMs),
+ // No wake retry re-issues a rename, so the timeout stays; a client
+ // that leaves still releases the upstream call.
+ signal: mutatingCallSignal(config.upstreamTimeoutMs, res),
}
)
const body = await response.text()