Files
orca/src/main/browser
Jinwoo Hong 1b0ee969bc fix(browser): stop the first browser command on a new Windows tab hanging until it fails (#24237)
* fix(browser): stop slow browser commands failing with "runtime closed the connection"

On Windows, the first helper-backed browser command on a fresh tab (snapshot,
screenshot, wait, get, capture start, ...) produced nothing for 30 s and then
failed with runtime_unavailable and "Restart Orca", which never helped.

Two defects combined:

- The local RPC transport destroyed any connection that had written nothing
  for 30 s, including one still waiting on our reply. Only long-poll methods
  sent keepalives, so every slower unary RPC (browser helper commands allow
  90 s, emulator 180 s, skill share 10 min) was cut off and the CLI reported
  the close as a dead runtime. The idle timer is now suspended while a
  dispatch is in flight and re-armed when none remain; the client's own
  deadline bounds the wait. No wire change.

- On Windows, agent-browser's daemon inherits the helper's stdio pipes
  (vercel-labs/agent-browser#1407), so EOF never arrives and execFile waited
  for the 90 s timeout even though the helper had printed its result and
  exited in ~300 ms. The bridge now releases the pipes shortly after the
  helper exits, so the call settles with its full output. Every new tab and
  every daemon restart after the 10-minute idle timeout hit this.

Fixes #23911
Fixes #18093

* test(browser): remove the raw-process test's temp dir; fix stale keepalive comment

* revert(runtime): move the RPC idle-timer change to its own branch

The browser fix alone resolves the ticket: with the pipe release, a fresh-tab
snapshot takes ~1.4 s, well under the 30 s idle window. Whether the server
should stop cutting off slow in-flight RPCs is a separate trade-off against
fail-fast on genuine hangs, now on sta-8934-rpc-idle-timeout.
2026-09-30 21:51:21 -04:00
..