From 9dce9d2eae46a6b095bfe018324d5534d5e4e7e2 Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:31:04 +0000 Subject: [PATCH] fix(cli): cap the open window request at five seconds --- src/cli/runtime/client.ts | 2 +- src/cli/runtime/open-local-orca.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cli/runtime/client.ts b/src/cli/runtime/client.ts index f08ebc6e6ca..4c07a3fb815 100644 --- a/src/cli/runtime/client.ts +++ b/src/cli/runtime/client.ts @@ -309,7 +309,7 @@ export class RuntimeClient { } return openLocalOrca( () => this.getCliStatus(), - () => this.call<{ requested: boolean }>('desktop.openWindowInBackground'), + (options) => this.call<{ requested: boolean }>('desktop.openWindowInBackground', {}, options), timeoutMs ) } diff --git a/src/cli/runtime/open-local-orca.ts b/src/cli/runtime/open-local-orca.ts index 05286712547..aafbeab3f8f 100644 --- a/src/cli/runtime/open-local-orca.ts +++ b/src/cli/runtime/open-local-orca.ts @@ -3,7 +3,12 @@ import { launchOrcaApp } from './launch' import { RuntimeClientError, RuntimeRpcFailureError, type RuntimeRpcSuccess } from './types' type ReadStatus = () => Promise> -type OpenWindowInBackground = () => Promise> +type OpenWindowInBackground = (options: { + timeoutMs: number +}) => Promise> + +// The runtime only queues a window request; a stuck one must not hold `orca open` for a full RPC timeout. +const OPEN_WINDOW_RPC_TIMEOUT_MS = 5_000 export async function openLocalOrca( readStatus: ReadStatus, @@ -65,7 +70,8 @@ async function getStatusForOpen( async function askToOpenWindow(openWindowInBackground: OpenWindowInBackground): Promise { try { - return (await openWindowInBackground()).result.requested === true + const response = await openWindowInBackground({ timeoutMs: OPEN_WINDOW_RPC_TIMEOUT_MS }) + return response.result.requested === true } catch { // Older runtimes lack the method; any failure falls back to relaunching, as open always did. return false