[STG-1450] Fix Session init failing when no pages are open, falls back to opening about:blank
Merged
PI
9mo ago+97+97+01234567890123456789-8-8-0123456789
why
Stagehand API failures were caused on all routes /act, /observe, etc. when session init failed because a page was closed. This adds a fallback to open about:blank so at least the session remains usable instead of just crashing on init.
what changed
test plan
Summary by cubic
Fixes session init when connecting to a browser with zero pages by auto-creating an about:blank tab. Keeps Stagehand routes working after the last page closes and surfaces lint failures via a dedicated cancellation job. Addresses STG-1450.
-
Bug Fixes
- Replace waitForFirstTopLevelPage with ensureFirstTopLevelPage: check for an existing page, wait with timeout, then create about:blank if none.
- Simplify errors to a TimeoutError with clearer context; improve logging and add an integration test for zero-page init.
-
CI
- Run cancellation in a separate job only when lint fails, so failures are visible instead of marked skipped.
Mintlify
0 threads from 0 users in Mintlify
- No unresolved comments