Skip to content

The agent that grows with you

fix(desktop): keep the two-argument call shape for session RPCs without a deadline

Brooklyn Nicholson12d438ceb363
diff --git a/apps/desktop/src/store/gateway.ts b/apps/desktop/src/store/gateway.ts
index 3cf35be66c0..05a7920bf5a 100644
--- a/apps/desktop/src/store/gateway.ts
+++ b/apps/desktop/src/store/gateway.ts
@@ -586,7 +586,12 @@ export async function requestGatewayForProfile<T>(
const routedParams = route.scopeProfile ? { ...params, profile: route.key } : params
- return await route.gateway.request<T>(method, routedParams, timeoutMs, signal)
+ // Same arity contract as the ambient path in session-request-router: only
+ // pass the deadline args through when the caller set them, so a plain
+ // profile-routed RPC keeps its two-argument call shape.
+ return await (timeoutMs === undefined && signal === undefined
+ ? route.gateway.request<T>(method, routedParams)
+ : route.gateway.request<T>(method, routedParams, timeoutMs, signal))
} finally {
route.release()
}
diff --git a/apps/desktop/src/store/session-request-router.ts b/apps/desktop/src/store/session-request-router.ts
index 82de324a1b5..dd55aaf52ce 100644
--- a/apps/desktop/src/store/session-request-router.ts
+++ b/apps/desktop/src/store/session-request-router.ts
@@ -52,7 +52,15 @@ export function requestForSessionProfile<T>(
signal?: AbortSignal
): Promise<T> {
if (!sessionRpcNeedsProfileRoute(ownerProfile)) {
- return ambientRequest<T>(method, params, timeoutMs, signal)
+ // Forward the extra args only when the caller actually supplied them. The
+ // ambient dispatcher is a plain gateway request whose arity callers assert
+ // on; handing it a trailing `undefined, undefined` on every session RPC
+ // changes the observed call shape for the many callers that never asked
+ // for a deadline (the plugin host bridge in contrib/wiring is the only one
+ // that does).
+ return timeoutMs === undefined && signal === undefined
+ ? ambientRequest<T>(method, params)
+ : ambientRequest<T>(method, params, timeoutMs, signal)
}
return requestGatewayForProfile<T>(normKey(ownerProfile), method, params, timeoutMs, signal)