BlogResearchturno-browser
A person step that outlived the tool call
In turno-browser 0.8.0 a call to browser_request_human waited for the whole step, up to 10 minutes, while a client built on the MCP TypeScript SDK fails a request after 60 seconds by default. Since 0.9.0 the call returns after 50 seconds with a "still open" result, and the agent calls again to keep waiting for the same step.
- Shipped in
- Author
- William Monroy
turno-browser 0.8.0 added browser_request_human, the tool an agent calls to hand the browser to the person for a step only they may do: a password, a captcha, a code from an email, a second factor, accepting terms. The tab comes to the front with a banner that shows the instruction and a Done button, and every call of every session waits until the step ends. The step's timeout was 5 minutes by default and 10 at most, and the call that asked for the step waited for all of it.
That could outlast the call. A client built on the MCP TypeScript SDK fails a request after 60 seconds by default, and a person who opens their email, finds the code and types it back can take longer. turno-browser 0.9.0, released the same day as 0.8.0, changed the call and left the step as it was.
Two limits
The comment at the top of step-wait.ts names the two limits the change was written for: a client built on the MCP TypeScript SDK fails a request after 60 s unless it opts in to progress resetting it, and Codex stops a call after its tool_timeout_sec.
The SDK side is in its own source, read at version 1.32.2: DEFAULT_REQUEST_TIMEOUT_MSEC is 60000, and resetTimeoutOnProgress defaults to false. Progress resets the 60 s only when the client sets resetTimeoutOnProgress and also passes an onprogress handler; without a handler no progress token is sent. Codex's documentation gives 60 s as the default of tool_timeout_sec; its source sets 300 s.
The 0.8.0 step already sent progress: every 15 seconds, a client that asked for progress heard that the step was still waiting. That kept no call alive in a client that had not opted in to let progress reset its timer. And when a client gave up on the call, the step went with it, because in 0.8.0 a cancelled call ended the step as cancelled. In the words of the same comment, "a call cut off by its client used to end the step with it."
Waiting in pieces
Since 0.9.0 the step and the call that waits for it are separate. The step starts and runs on its own: the banner stays up and every other call is held. A call waits for it at most waitMs:
export const DEFAULT_STEP_WAIT_MS = 50_000;
export const MAX_STEP_WAIT_MS = 240_000;The default of 50 seconds is under 60 s, the SDK's default and the lower of the two values given for Codex. If the step has not ended by then, the call returns a result that says the step is still open. As JSON, it carries what the agent needs for its next call:
const data = {
waiting: true,
step: step.id,
by: step.info.by,
instruction: step.info.instruction,
waitedMs: elapsedMs,
timeoutMs: step.info.timeoutMs,
next: { tool: HUMAN_STEP_TOOL, arguments: next },
};Here next is { continue: true }. The text form says the same in sentences, with the time left before the step times out. The agent calls browser_request_human again with { "continue": true }, or with the step's id, and waits another piece. Continuing is an argument of the tool the agent already called, described in that tool's description, and the 0.9.0 release notes say there is nothing to change in a setup.
With the defaults, a person who needs about two minutes to fetch an emailed code goes through three calls:
| Call | Returns | The person |
|---|---|---|
browser_request_human with the instruction | after 50 s: still open, with the step's id | sees the banner, opens their email |
browser_request_human with { "continue": true } | after another 50 s: still open | finds the code |
browser_request_human with { "continue": true } | when the person presses Done | types the code, presses Done |
The last call returns what the single call of 0.8.0 returned: why the step ended, the tab's URL and title, and how many times the person clicked and how many fields they changed, never what they typed.
What keeps the step whole
Three rules keep the step whole across several calls.
A call with a new instruction while a step is open is refused, and the error names the open step's id and instruction. The banner shows only the first instruction, so the agent waits for that step and asks for the next one after it.
The step's timeout counts from when the step began, not from the latest call. A 5-minute step stays 5 minutes however many pieces it is waited in.
A call that returns after its piece leaves the step up. A call that is cancelled still ends it, since nobody is left to wait. 0.9.0 keeps that rule; the call now returns before a 60 s client gives up on it:
// A cancelled call (the agent stopped) ends the step: nobody is left to wait for it.
const wait = async (step: OpenStep<StepResultOf>) => {
const waited = await this.steps.wait(step, parsed.waitMs, {
cancelOnAbort: true,
...(signal ? { signal } : {}),
...(progress ? { progress: stepProgress(progress) } : {}),
});
return waited.kind === "ended" ? waited.result(json) : stillWaitingResult(step, waited.elapsedMs, json);
};The unit test of the step table, step-wait.test.ts, runs these cases with fake timers: a call that returns after 50,000 ms while the step goes on, a second step refused while the first runs, and a cancelled call that ends the step.
The passkey prompt, also new in 0.9.0, waits in the same pieces. When a click starts Chrome's passkey window, that click waits 50 seconds and then the agent continues with browser_request_human. There a cancelled call only stops waiting, because the prompt is the page's.
What is still not solved
The server does not read the client's limit. The default fits a client that allows 60 seconds, and the tool's description tells the agent to keep waitMs under its client's tool call timeout. An agent whose client allows less has to pass a smaller value itself.
Each piece costs a turn. With the default 5-minute timeout and 50-second pieces, a step that runs to its timeout takes about six calls, each a result the model reads and a call it makes. Within each piece, a client that asked for progress still hears from the step every 15 seconds.
The step itself is still capped at 10 minutes, and with a headless Chrome it needs the live view open.
Sources
- The change: pull request 150, released in turno-browser 0.9.0. The tool: pull request 135, released in turno-browser 0.8.0.
- The three excerpts are the same at turno-browser 0.9.0 and 0.13.1:
step-wait.ts,human-step.tsandhost.ts.