From 9e5108af501c65d1591b6f17da29fd7b5af28e31 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Fri, 2 Oct 2026 02:42:58 -0700 Subject: [PATCH 1/2] fix(agent-launch): keep the local socket alive while a prompted launch waits for its agent A launch with a prompt now waits up to 60 s for the terminal agent to be ready before it writes the prompt, and reports not-delivered when the agent never is. The local runtime socket closes a connection idle for 30 s unless the request is a long poll, so a launch whose agent exited at startup lost its reply and the caller saw 'runtime closed the connection' instead of not-delivered. Classify a prompted agent.launch and agent.launchReplay as a long poll, as orchestration.workerStart already is for the same wait. --- .../runtime-rpc-long-poll-transport.test.ts | 19 +++++++++++++++++++ .../runtime-rpc/runtime-rpc-long-poll.ts | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/main/runtime/runtime-rpc-long-poll-transport.test.ts b/src/main/runtime/runtime-rpc-long-poll-transport.test.ts index c17e045b466..c23b4e6b28b 100644 --- a/src/main/runtime/runtime-rpc-long-poll-transport.test.ts +++ b/src/main/runtime/runtime-rpc-long-poll-transport.test.ts @@ -44,6 +44,25 @@ describe('OrcaRuntimeRpcServer', () => { ).toBe('wait') }) + it.each(['agent.launch', 'agent.launchReplay'])( + 'keeps a prompted %s alive while it waits for the agent to be ready', + (method) => { + const prompt = { text: 'fix the build', delivery: 'submit' } + expect( + classifyRuntimeLongPoll({ + id: 'req_launch', + authToken: 'token', + method, + params: { prompt } + }) + ).toBe('wait') + // Without a prompt nothing waits on the agent, so the launch stays a short call. + expect( + classifyRuntimeLongPoll({ id: 'req_launch', authToken: 'token', method, params: {} }) + ).toBeNull() + } + ) + it('keeps agent-prompt submission sockets alive during verification', () => { expect( classifyRuntimeLongPoll({ diff --git a/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts b/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts index 02d8422547e..15fc3af44f2 100644 --- a/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts +++ b/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts @@ -26,6 +26,16 @@ export function classifyRuntimeLongPoll(request: RpcRequest): RuntimeLongPollCla if (request.method === 'orchestration.workerStart') { return 'wait' } + // A launch with a prompt waits for the agent's readiness before writing it, up to 60 s, and a + // reply lost to the 30 s idle timer reads as a dead runtime instead of an undelivered prompt. + if ( + (request.method === 'agent.launch' || request.method === 'agent.launchReplay') && + typeof request.params === 'object' && + request.params !== null && + (request.params as { prompt?: unknown }).prompt !== undefined + ) { + return 'wait' + } if (request.method === 'browser.clientHost.attach') { return 'browser-host' } From c9b4dc0578c3ff7dea91facdf71859140554abdd Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Fri, 2 Oct 2026 02:44:11 -0700 Subject: [PATCH 2/2] refactor(agent-launch): narrow the launch params by 'in' instead of a cast --- src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts b/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts index 15fc3af44f2..c1ddeb78a6e 100644 --- a/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts +++ b/src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts @@ -32,7 +32,8 @@ export function classifyRuntimeLongPoll(request: RpcRequest): RuntimeLongPollCla (request.method === 'agent.launch' || request.method === 'agent.launchReplay') && typeof request.params === 'object' && request.params !== null && - (request.params as { prompt?: unknown }).prompt !== undefined + 'prompt' in request.params && + request.params.prompt !== undefined ) { return 'wait' }