Make browser session ownership and facade mounts explicit

Merged
MI
2mo ago
+2031-134

Makes browser ownership explicit across the eval mount, facade process, and SDK. The tool-owned Browserbase lease stays alive across transport loss and is explicitly released on cleanup; a newly created session is also released when initial CDP attachment fails. Existing-session attachment retains caller ownership. Shared extension uploads retry explicit rate-limit rejections, avoid replaying ambiguous creates, and release their lease if bridge startup fails.

Closes the owned browser after a completed batch requests browser.close(), confines screenshot artifacts to the owned directory, and separates runner-only session metadata from the agent relay. Terminal loss is established by host telemetry, never by an agent-written error prefix. Validates provider settings before acquiring resources and keeps explicit environment inputs isolated.

Exposes typed tool invocation, browser-loss and evidence contracts for later adapters. The legacy prompt is available through direct stdio here; harness selection is added in the later adapter PRs. The inherited shutdown window before initialization returns a session handle remains documented; this change does not introduce a cancellation API.

Validation: 344 runtime/SDK tests and 60 focused eval tests, SDK/core/eval typechecks, core build, formatting, and built stdio dispatch coverage.

Stack position: 2/11 in the current review scope through #2901. Base: evals/consolidation-01-hardbench. Each PR contains the change relative to its immediate predecessor.

Reviewer entry points:

CLI startup validation: general help now defers harness/tool registry imports, and CLI test subprocesses have bounded cleanup with a consistent cold-start deadline. This fixes the cold-help CI failure at this layer. The 66 CLI/help tests and eval typecheck pass locally; fresh full GitHub CI passed on this head.

Readiness: CI passed on 0679a58b1f. Review threads are triaged and resolved.