Skip to content

feat(sdk-go): expose SessionID on Browserbase browser handles - #2674

Merged
miguelg719 merged 1 commit into
v4-spikefrom
miguel/browser-session-id-go
Aug 10, 2026
Merged

miguelg719 merged 1 commit into
v4-spikefrom
miguel/browser-session-id-go

Conversation

@miguelg719

@miguelg719 miguelg719 commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Go port of #2672 (TS contract) alongside the Python port #2673: nil-safe SessionID() accessor on Browser, sourced from the worker session metadata the handle already carries; empty string for local browsers.

Gate: gofmt clean, go vet clean, package tests pass (examples build failure in go test ./... is pre-existing on v4-spike; scripts/check-examples.sh passes).


Summary by cubic

Added a nil-safe SessionID() method to the Go SDK Browser to get the Browserbase session ID. It returns an empty string for local browsers or when the handle is nil.

Written for commit 72f3cb2. Summary will update on new commits.

Review in cubic

Go port of the TS change: nil-safe accessor over the worker session
metadata already held by the handle; empty string for local browsers.
@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 72f3cb2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 1 file

Confidence score: 5/5

  • In packages/sdk-go/browser.go, the new exported Browser.SessionID() method is currently untested, so a future refactor could break the public accessor without being caught and downstream SDK consumers might get incorrect session IDs — add a focused unit test in browser_test.go that asserts Browser.SessionID() directly.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/sdk-go/browser.go">

<violation number="1" location="packages/sdk-go/browser.go:70">
P3: The new exported `Browser.SessionID()` accessor has no unit coverage. The existing `browser_test.go` only reads the internal `claimed.workerBrowser.SessionID` field, so the public method's behavior is unverified — particularly the `""` fallback for local browsers and the nil-browser/nil-`workerBrowser` safety branches. Adding a couple of focused tests (a Browserbase handle returning its session id, and a local browser returning `""`, plus a nil-receiver call) would encode the contract and prevent regressions in the cross-language parity surface.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/sdk-go/browser.go Resolved
@miguelg719
miguelg719 merged commit 505fe4d into v4-spike Aug 10, 2026
20 checks passed
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