Files
orca/docs/reference
Jinwoo-H 2bba8e17f5 fix(browser): close the reclaim gaps three independent reviewers found
Three fresh gpt-5.6-luna reviewers took lifecycle, resources and compatibility.
Two of their high findings were the ones the previous commit already fixed
(session snapshot, worktree teardown), which is a useful cross-check. Four were
real and new:

- `tab switch --index` resolved the index *after* target resolution had already
  woken the most recently used parked page. Waking makes that page live, which
  moves it to the front of the listing, so index 0 selected a different tab than
  the caller had just read. Indices are now resolved before any wake.
- An in-flight command was only pinned while the queue was executing it.
  `enqueueTargetedCommand` awaits `ensureSession` first, and that can spend up
  to EXEC_TIMEOUT_MS (90s) closing a stale helper session — far past the 30s
  grace — so a sweep could destroy the renderer mid-setup. A page is now claimed
  from target resolution through completion.
- A renderer lost on its own never told the bridge, so a crash loop leaked one
  helper session, CDP proxy and listening port per page. It now routes through
  the same teardown as park and close, and stops the sweep when the last page
  goes. Reading `win.webContents` in that handler throws once the contents are
  destroyed, which wedged the whole main process — the id is captured up front.
  `CdpWsProxy.stop()` also closes its socket even when detaching the debugger
  throws, which is exactly the case a crashed renderer produces.
- Parking a page mid-navigation snapshotted the uncommitted `about:blank`
  address over the URL the agent asked for, so the wake loaded the wrong page.
  A loading page is no longer parkable and an uncommitted address is ignored.

Also bounds the last unbounded thing: parking caps renderer processes but not
the page records behind them, so past a generous retention limit the oldest
parked pages are closed outright and logged.

Each fix has a regression test that was mutation-checked against the exact
defect. The `tab switch` case is covered at the runtime layer rather than e2e
because driving a real switch needs the agent-browser binary, which cannot run
in the sandboxed e2e HOME.
2026-08-19 19:07:11 -04:00
..