Merge #24257 head c9b4dc0578 (prompted agent.launch is a long poll)

This commit is contained in:
Brennan Benson
2026-10-02 02:44:39 -07:00
2 changed files with 30 additions and 0 deletions
@@ -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({
@@ -26,6 +26,17 @@ 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 &&
'prompt' in request.params &&
request.params.prompt !== undefined
) {
return 'wait'
}
if (request.method === 'browser.clientHost.attach') {
return 'browser-host'
}