Skip to content

add BB session URL & debug URL accessors - #1281

Merged
monadoid merged 2 commits into
mainfrom
STG-966
Nov 18, 2025
Merged

monadoid merged 2 commits into
mainfrom
STG-966

Conversation

@monadoid

@monadoid monadoid commented Nov 18, 2025 •

Copy link
Copy Markdown
Contributor

why

currently, stagehand just logs the BB session URL and debug URL inline without storing this info on the stagehand object but we want getters for these.

If env = browserbase, we return the urls, if it's local we return an empty string currently as per the ticket. It seemed to me like returning undefined if env = local might be better DX, but i'll double check w/ sean.

what changed

Added getters and a small resetBrowserbaseSessionMetadata() helper.

test plan

Adde vitest tests that show that this works when running with env: "BROWSERBASE" and returns an empty string when env: "LOCAL".

@changeset-bot

changeset-bot Bot commented Nov 18, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7482e95

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals Patch

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

@greptile-apps

greptile-apps Bot commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Greptile Summary

  • Added public getter methods browserbaseSessionURL and browserbaseDebugURL to expose Browserbase session metadata that was previously only logged
  • Introduced resetBrowserbaseSessionMetadata() helper to centralize cleanup of session URLs and ID across local browser initialization and close operations

Confidence Score: 3/5

  • Safe to merge after fixing the indentation issue
  • The feature implementation is straightforward with good test coverage, but there's a syntax error with incorrect indentation in the local browser connection block that will likely fail linting/formatting checks
  • packages/core/lib/v3/v3.ts requires attention for the indentation fix at lines 681-693

Important Files Changed

Filename Overview
packages/core/lib/v3/v3.ts Added public getters for Browserbase session URL and debug URL, plus helper method to reset metadata; includes indentation fix in local browser connection block

Sequence Diagram

sequenceDiagram
    participant User
    participant V3
    participant Browserbase
    
    User->>V3: init() with env="BROWSERBASE"
    V3->>Browserbase: createBrowserbaseSession()
    Browserbase-->>V3: sessionId, ws, bb
    V3->>V3: store sessionId
    V3->>Browserbase: bb.sessions.debug(sessionId)
    Browserbase-->>V3: debuggerUrl
    V3->>V3: set browserbaseSessionUrl & browserbaseDebugUrl
    V3-->>User: initialization complete
    User->>V3: browserbaseSessionURL
    V3-->>User: return stored URL
    User->>V3: browserbaseDebugURL
    V3-->>User: return stored debug URL
Loading

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

Comment thread packages/core/lib/v3/v3.ts Outdated
Comment on lines +681 to +693
this.ctx.conn.onTransportClosed(this._onCdpClosed);
this.state = {
kind: "LOCAL",
// no LaunchedChrome when attaching externally; create a stub kill
chrome: {
kill: async () => {},
} as unknown as import("chrome-launcher").LaunchedChrome,
ws: lbo.cdpUrl,
};
this.resetBrowserbaseSessionMetadata();
// Post-connect settings (downloads and viewport) if provided
await this._applyPostConnectLocalOptions(lbo);
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: indentation lost here - should be indented to match the surrounding if block (12 spaces)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/lib/v3/v3.ts
Line: 681:693

Comment:
**syntax:** indentation lost here - should be indented to match the surrounding if block (12 spaces)

How can I resolve this? If you propose a fix, please make it concise.

@monadoid
monadoid merged commit fa18cfd into main Nov 18, 2025
seanmcguire12 pushed a commit that referenced this pull request Nov 24, 2025
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]

### Patch Changes

- [#1281](#1281)
[`fa18cfd`](fa18cfd)
Thanks [@monadoid](https://github.com/monadoid)! - Add Browserbase
session URL and debug URL accessors

- [#1264](#1264)
[`767d168`](767d168)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - feat: adding gpt
5.1 to stagehand

- [#1282](#1282)
[`f27a99c`](f27a99c)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for zod
4, while maintaining backwards compatibility for zod 3

- [#1295](#1295)
[`91a1ca0`](91a1ca0)
Thanks [@tkattkat](https://github.com/tkattkat)! - Patch zod handling of
non objects in extract

- [#1298](#1298)
[`1dd7d43`](1dd7d43)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - log
Browserbase session status when websocket is closed due to session
timeout

- [#1284](#1284)
[`c0f3b98`](c0f3b98)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix:
waitForDomNetworkQuiet() causing `act()` to hang indefinitely

- [#1246](#1246)
[`44bb4f5`](44bb4f5)
Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - make ci
faster

- [#1300](#1300)
[`2b70347`](2b70347)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support
for context.addInitScript()

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`fa18cfd`](fa18cfd),
[`767d168`](767d168),
[`f27a99c`](f27a99c),
[`91a1ca0`](91a1ca0),
[`1dd7d43`](1dd7d43),
[`c0f3b98`](c0f3b98),
[`44bb4f5`](44bb4f5),
[`2b70347`](2b70347)]:
    -   @browserbasehq/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
michaelfp930-WB added a commit to michaelfp930-WB/stagehand that referenced this pull request Jan 12, 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]

### Patch Changes

- [#1281](browserbase/stagehand#1281)
[`fa18cfd`](browserbase/stagehand@fa18cfd)
Thanks [@monadoid](https://github.com/monadoid)! - Add Browserbase
session URL and debug URL accessors

- [#1264](browserbase/stagehand#1264)
[`767d168`](browserbase/stagehand@767d168)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - feat: adding gpt
5.1 to stagehand

- [#1282](browserbase/stagehand#1282)
[`f27a99c`](browserbase/stagehand@f27a99c)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for zod
4, while maintaining backwards compatibility for zod 3

- [#1295](browserbase/stagehand#1295)
[`91a1ca0`](browserbase/stagehand@91a1ca0)
Thanks [@tkattkat](https://github.com/tkattkat)! - Patch zod handling of
non objects in extract

- [#1298](browserbase/stagehand#1298)
[`1dd7d43`](browserbase/stagehand@1dd7d43)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - log
Browserbase session status when websocket is closed due to session
timeout

- [#1284](browserbase/stagehand#1284)
[`c0f3b98`](browserbase/stagehand@c0f3b98)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix:
waitForDomNetworkQuiet() causing `act()` to hang indefinitely

- [#1246](browserbase/stagehand#1246)
[`44bb4f5`](browserbase/stagehand@44bb4f5)
Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - make ci
faster

- [#1300](browserbase/stagehand#1300)
[`2b70347`](browserbase/stagehand@2b70347)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support
for context.addInitScript()

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`fa18cfd`](browserbase/stagehand@fa18cfd),
[`767d168`](browserbase/stagehand@767d168),
[`f27a99c`](browserbase/stagehand@f27a99c),
[`91a1ca0`](browserbase/stagehand@91a1ca0),
[`1dd7d43`](browserbase/stagehand@1dd7d43),
[`c0f3b98`](browserbase/stagehand@c0f3b98),
[`44bb4f5`](browserbase/stagehand@44bb4f5),
[`2b70347`](browserbase/stagehand@2b70347)]:
    -   @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
# why
currently, stagehand just logs the BB session URL and debug URL inline
without storing this info on the stagehand object but we want getters
for these.

If env = browserbase, we return the urls, if it's local we return an
empty string currently as per the ticket. It seemed to me like returning
undefined if env = local might be better DX, but i'll double check w/
sean.

# what changed
Added getters and a small `resetBrowserbaseSessionMetadata()` helper.

# test plan
Adde vitest tests that show that this works when running with `env:
"BROWSERBASE"` and returns an empty string when `env: "LOCAL"`.
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]

### Patch Changes

- [browserbase#1281](browserbase#1281)
[`fa18cfd`](browserbase@fa18cfd)
Thanks [@monadoid](https://github.com/monadoid)! - Add Browserbase
session URL and debug URL accessors

- [browserbase#1264](browserbase#1264)
[`767d168`](browserbase@767d168)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - feat: adding gpt
5.1 to stagehand

- [browserbase#1282](browserbase#1282)
[`f27a99c`](browserbase@f27a99c)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for zod
4, while maintaining backwards compatibility for zod 3

- [browserbase#1295](browserbase#1295)
[`91a1ca0`](browserbase@91a1ca0)
Thanks [@tkattkat](https://github.com/tkattkat)! - Patch zod handling of
non objects in extract

- [browserbase#1298](browserbase#1298)
[`1dd7d43`](browserbase@1dd7d43)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - log
Browserbase session status when websocket is closed due to session
timeout

- [browserbase#1284](browserbase#1284)
[`c0f3b98`](browserbase@c0f3b98)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix:
waitForDomNetworkQuiet() causing `act()` to hang indefinitely

- [browserbase#1246](browserbase#1246)
[`44bb4f5`](browserbase@44bb4f5)
Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - make ci
faster

- [browserbase#1300](browserbase#1300)
[`2b70347`](browserbase@2b70347)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support
for context.addInitScript()

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`fa18cfd`](browserbase@fa18cfd),
[`767d168`](browserbase@767d168),
[`f27a99c`](browserbase@f27a99c),
[`91a1ca0`](browserbase@91a1ca0),
[`1dd7d43`](browserbase@1dd7d43),
[`c0f3b98`](browserbase@c0f3b98),
[`44bb4f5`](browserbase@44bb4f5),
[`2b70347`](browserbase@2b70347)]:
    -   @browserbasehq/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants