Repository navigation
[STG-1450] Fix Session init failing when no pages are open, falls back to opening about:blank - #1749
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 45ed6dc The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Greptile SummaryFixed session initialization failures by adding a fallback that creates an
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 254ae6e |
pirate
force-pushed
the
session-init-fixes
branch
from
February 24, 2026 23:29
c75ce07 to
f71b43b
Compare
pirate
force-pushed
the
session-init-fixes
branch
from
February 24, 2026 23:30
f71b43b to
8950c76
Compare
seanmcguire12
approved these changes
Feb 25, 2026
This was referenced Feb 25, 2026
Merged
This was referenced Mar 4, 2026
This was referenced Mar 2, 2025
miguelg719
pushed a commit
that referenced
this pull request
Mar 18, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Minor Changes - [#1816](#1816) [`687d54a`](687d54a) Thanks [@shrey150](https://github.com/shrey150)! - Add `--context-id` and `--persist` flags to `browse open` for loading and persisting Browserbase Contexts across sessions - [#1793](#1793) [`e38c13b`](e38c13b) Thanks [@shrey150](https://github.com/shrey150)! - Initial release of browse CLI - browser automation for AI agents ### Patch Changes - [#1806](#1806) [`f8c7738`](f8c7738) Thanks [@shrey150](https://github.com/shrey150)! - Fix `browse env` showing stale mode after `browse env remote` - Updated dependencies \[[`505e8c6`](505e8c6), [`2f43ffa`](2f43ffa), [`63ee247`](63ee247), [`7dc35f5`](7dc35f5), [`335cf47`](335cf47), [`6ba0a1d`](6ba0a1d), [`4ff3bb8`](4ff3bb8), [`c27054b`](c27054b), [`2abf5b9`](2abf5b9), [`7817fcc`](7817fcc), [`7390508`](7390508), [`611f43a`](611f43a), [`521a10e`](521a10e), [`2402a3c`](2402a3c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Minor Changes - [#1779](#1779) [`2f43ffa`](2f43ffa) Thanks [@shrey150](https://github.com/shrey150)! - feat: add `cdpHeaders` option to `localBrowserLaunchOptions` for passing custom HTTP headers when connecting to an existing browser via CDP URL - [#1834](#1834) [`63ee247`](63ee247) Thanks [@tkattkat](https://github.com/tkattkat)! - Update stagehand agents search tool - [#1774](#1774) [`521a10e`](521a10e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add new page.setExtraHTTPHeaders() method ### Patch Changes - [#1759](#1759) [`505e8c6`](505e8c6) Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the provider enum in model configuration schemas and regenerate OpenAPI spec. - [#1814](#1814) [`7dc35f5`](7dc35f5) Thanks [@tkattkat](https://github.com/tkattkat)! - Change usage of openai provider in agent to default to store:false - [#1846](#1846) [`335cf47`](335cf47) Thanks [@aq17](https://github.com/aq17)! - Fix streaming finished event being silently dropped. The final SSE event containing the result payload (success status, message, actions, usage, and messages) was previously discarded instead of being yielded to the caller. - [#1764](#1764) [`6ba0a1d`](6ba0a1d) Thanks [@shrey150](https://github.com/shrey150)! - Expose `headers` in `GoogleVertexProviderSettings` so model configs can pass custom provider headers (for example `X-Goog-Priority`) without TypeScript errors. - [#1847](#1847) [`4ff3bb8`](4ff3bb8) Thanks [@miguelg719](https://github.com/miguelg719)! - Enable FlowLogger on BROWSERBASE_FLOW_LOGS=1 - [#1752](#1752) [`c27054b`](c27054b) Thanks [@derekmeegan](https://github.com/derekmeegan)! - fix: pause Browserbase agents while captcha solving is active and improve CUA recovery after the solve completes - [#1800](#1800) [`2abf5b9`](2abf5b9) Thanks [@shrey150](https://github.com/shrey150)! - Make projectId optional for Browserbase sessions — only BROWSERBASE_API_KEY is required - [#1766](#1766) [`7817fcc`](7817fcc) Thanks [@tkattkat](https://github.com/tkattkat)! - Add configurable timeout to tools in agent - [#1749](#1749) [`7390508`](7390508) Thanks [@pirate](https://github.com/pirate)! - When connecting to a browser session that has zero open tabs, Stagehand now automatically creates an initial `about:blank` tab so the connection can continue. - [#1761](#1761) [`611f43a`](611f43a) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where handlePossibleNavigation was producing unnecessary error logs on clicks that trigger page close - [#1817](#1817) [`2402a3c`](2402a3c) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for passing custom headers in clientOptions ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`505e8c6`](505e8c6), [`2f43ffa`](2f43ffa), [`63ee247`](63ee247), [`7dc35f5`](7dc35f5), [`335cf47`](335cf47), [`6ba0a1d`](6ba0a1d), [`4ff3bb8`](4ff3bb8), [`c27054b`](c27054b), [`2abf5b9`](2abf5b9), [`7817fcc`](7817fcc), [`7390508`](7390508), [`611f43a`](611f43a), [`521a10e`](521a10e), [`2402a3c`](2402a3c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - [#1759](#1759) [`505e8c6`](505e8c6) Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the provider enum in model configuration schemas and regenerate OpenAPI spec. - Updated dependencies \[[`505e8c6`](505e8c6), [`2f43ffa`](2f43ffa), [`63ee247`](63ee247), [`7dc35f5`](7dc35f5), [`335cf47`](335cf47), [`6ba0a1d`](6ba0a1d), [`4ff3bb8`](4ff3bb8), [`c27054b`](c27054b), [`2abf5b9`](2abf5b9), [`7817fcc`](7817fcc), [`7390508`](7390508), [`611f43a`](611f43a), [`521a10e`](521a10e), [`2402a3c`](2402a3c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`505e8c6`](505e8c6), [`2f43ffa`](2f43ffa), [`63ee247`](63ee247), [`7dc35f5`](7dc35f5), [`335cf47`](335cf47), [`6ba0a1d`](6ba0a1d), [`4ff3bb8`](4ff3bb8), [`c27054b`](c27054b), [`2abf5b9`](2abf5b9), [`7817fcc`](7817fcc), [`7390508`](7390508), [`611f43a`](611f43a), [`521a10e`](521a10e), [`2402a3c`](2402a3c)]: - @browserbasehq/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
felipeofdev-ai
pushed a commit
to felipeofdev-ai/stagehand
that referenced
this pull request
Aug 4, 2026
…k to opening about:blank (browserbase#1749) # 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 <!-- This is an auto-generated description by cubic. --> --- ## 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. <sup>Written for commit 45ed6dc. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1749">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. --> <!-- mintlify-editor-comments:start --> Mintlify --- 0 threads from 0 users in Mintlify - No unresolved comments <!-- mintlify-editor-comments:end --> <!-- mintlify-comment--> <a href="https://dashboard.mintlify.com/browserbase/stagehand/editor/session-init-fixes?source=pr_comment" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-light.svg"><img src="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-light.svg" alt="Open in Mintlify Editor"></picture></a> <!-- /mintlify-comment -->
felipeofdev-ai
pushed a commit
to felipeofdev-ai/stagehand
that referenced
this pull request
Aug 4, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Minor Changes - [browserbase#1816](browserbase#1816) [`687d54a`](browserbase@687d54a) Thanks [@shrey150](https://github.com/shrey150)! - Add `--context-id` and `--persist` flags to `browse open` for loading and persisting Browserbase Contexts across sessions - [browserbase#1793](browserbase#1793) [`e38c13b`](browserbase@e38c13b) Thanks [@shrey150](https://github.com/shrey150)! - Initial release of browse CLI - browser automation for AI agents ### Patch Changes - [browserbase#1806](browserbase#1806) [`f8c7738`](browserbase@f8c7738) Thanks [@shrey150](https://github.com/shrey150)! - Fix `browse env` showing stale mode after `browse env remote` - Updated dependencies \[[`505e8c6`](browserbase@505e8c6), [`2f43ffa`](browserbase@2f43ffa), [`63ee247`](browserbase@63ee247), [`7dc35f5`](browserbase@7dc35f5), [`335cf47`](browserbase@335cf47), [`6ba0a1d`](browserbase@6ba0a1d), [`4ff3bb8`](browserbase@4ff3bb8), [`c27054b`](browserbase@c27054b), [`2abf5b9`](browserbase@2abf5b9), [`7817fcc`](browserbase@7817fcc), [`7390508`](browserbase@7390508), [`611f43a`](browserbase@611f43a), [`521a10e`](browserbase@521a10e), [`2402a3c`](browserbase@2402a3c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Minor Changes - [browserbase#1779](browserbase#1779) [`2f43ffa`](browserbase@2f43ffa) Thanks [@shrey150](https://github.com/shrey150)! - feat: add `cdpHeaders` option to `localBrowserLaunchOptions` for passing custom HTTP headers when connecting to an existing browser via CDP URL - [browserbase#1834](browserbase#1834) [`63ee247`](browserbase@63ee247) Thanks [@tkattkat](https://github.com/tkattkat)! - Update stagehand agents search tool - [browserbase#1774](browserbase#1774) [`521a10e`](browserbase@521a10e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add new page.setExtraHTTPHeaders() method ### Patch Changes - [browserbase#1759](browserbase#1759) [`505e8c6`](browserbase@505e8c6) Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the provider enum in model configuration schemas and regenerate OpenAPI spec. - [browserbase#1814](browserbase#1814) [`7dc35f5`](browserbase@7dc35f5) Thanks [@tkattkat](https://github.com/tkattkat)! - Change usage of openai provider in agent to default to store:false - [browserbase#1846](browserbase#1846) [`335cf47`](browserbase@335cf47) Thanks [@aq17](https://github.com/aq17)! - Fix streaming finished event being silently dropped. The final SSE event containing the result payload (success status, message, actions, usage, and messages) was previously discarded instead of being yielded to the caller. - [browserbase#1764](browserbase#1764) [`6ba0a1d`](browserbase@6ba0a1d) Thanks [@shrey150](https://github.com/shrey150)! - Expose `headers` in `GoogleVertexProviderSettings` so model configs can pass custom provider headers (for example `X-Goog-Priority`) without TypeScript errors. - [browserbase#1847](browserbase#1847) [`4ff3bb8`](browserbase@4ff3bb8) Thanks [@miguelg719](https://github.com/miguelg719)! - Enable FlowLogger on BROWSERBASE_FLOW_LOGS=1 - [browserbase#1752](browserbase#1752) [`c27054b`](browserbase@c27054b) Thanks [@derekmeegan](https://github.com/derekmeegan)! - fix: pause Browserbase agents while captcha solving is active and improve CUA recovery after the solve completes - [browserbase#1800](browserbase#1800) [`2abf5b9`](browserbase@2abf5b9) Thanks [@shrey150](https://github.com/shrey150)! - Make projectId optional for Browserbase sessions — only BROWSERBASE_API_KEY is required - [browserbase#1766](browserbase#1766) [`7817fcc`](browserbase@7817fcc) Thanks [@tkattkat](https://github.com/tkattkat)! - Add configurable timeout to tools in agent - [browserbase#1749](browserbase#1749) [`7390508`](browserbase@7390508) Thanks [@pirate](https://github.com/pirate)! - When connecting to a browser session that has zero open tabs, Stagehand now automatically creates an initial `about:blank` tab so the connection can continue. - [browserbase#1761](browserbase#1761) [`611f43a`](browserbase@611f43a) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where handlePossibleNavigation was producing unnecessary error logs on clicks that trigger page close - [browserbase#1817](browserbase#1817) [`2402a3c`](browserbase@2402a3c) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for passing custom headers in clientOptions ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`505e8c6`](browserbase@505e8c6), [`2f43ffa`](browserbase@2f43ffa), [`63ee247`](browserbase@63ee247), [`7dc35f5`](browserbase@7dc35f5), [`335cf47`](browserbase@335cf47), [`6ba0a1d`](browserbase@6ba0a1d), [`4ff3bb8`](browserbase@4ff3bb8), [`c27054b`](browserbase@c27054b), [`2abf5b9`](browserbase@2abf5b9), [`7817fcc`](browserbase@7817fcc), [`7390508`](browserbase@7390508), [`611f43a`](browserbase@611f43a), [`521a10e`](browserbase@521a10e), [`2402a3c`](browserbase@2402a3c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - [browserbase#1759](browserbase#1759) [`505e8c6`](browserbase@505e8c6) Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the provider enum in model configuration schemas and regenerate OpenAPI spec. - Updated dependencies \[[`505e8c6`](browserbase@505e8c6), [`2f43ffa`](browserbase@2f43ffa), [`63ee247`](browserbase@63ee247), [`7dc35f5`](browserbase@7dc35f5), [`335cf47`](browserbase@335cf47), [`6ba0a1d`](browserbase@6ba0a1d), [`4ff3bb8`](browserbase@4ff3bb8), [`c27054b`](browserbase@c27054b), [`2abf5b9`](browserbase@2abf5b9), [`7817fcc`](browserbase@7817fcc), [`7390508`](browserbase@7390508), [`611f43a`](browserbase@611f43a), [`521a10e`](browserbase@521a10e), [`2402a3c`](browserbase@2402a3c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`505e8c6`](browserbase@505e8c6), [`2f43ffa`](browserbase@2f43ffa), [`63ee247`](browserbase@63ee247), [`7dc35f5`](browserbase@7dc35f5), [`335cf47`](browserbase@335cf47), [`6ba0a1d`](browserbase@6ba0a1d), [`4ff3bb8`](browserbase@4ff3bb8), [`c27054b`](browserbase@c27054b), [`2abf5b9`](browserbase@2abf5b9), [`7817fcc`](browserbase@7817fcc), [`7390508`](browserbase@7390508), [`611f43a`](browserbase@611f43a), [`521a10e`](browserbase@521a10e), [`2402a3c`](browserbase@2402a3c)]: - @browserbasehq/[email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CI
Written for commit 45ed6dc. Summary will update on new commits. Review in cubic
Mintlify
0 threads from 0 users in Mintlify