fix: track SDK language in Go Browserbase session metadata - #2477
Merged
Conversation
|
shrey150
commented
Jul 28, 2026
Contributor
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant GoSDK as BrowserbaseSessionClient
participant Metadata as stagehandSessionMetadata
participant BBAPI as Browserbase API
Note over GoSDK,BBAPI: Session creation with Stagehand attribution
GoSDK->>GoSDK: caller provides userMetadata<br/>(may contain spoofed "stagehand" keys)
GoSDK->>Metadata: stagehandSessionMetadata(userMetadata)
Metadata->>Metadata: clone userMetadata map
Metadata->>Metadata: merge authoritative keys:<br/>"stagehand"="true",<br/>"stagehand_sdk_language"="go"
Note over Metadata: Authoritative keys always win –<br/>any caller values for these keys are overridden
Metadata-->>GoSDK: merged metadata
GoSDK->>BBAPI: POST /sessions with merged userMetadata
alt Authoritative keys preserved
BBAPI-->>GoSDK: Session created with attribution
else Spoofed caller keys present
Note over GoSDK: Spoofed keys silently overwritten<br/>(no error)
end
shrey150
force-pushed
the
shrey/stg-2714-go-sdk-language
branch
from
July 28, 2026 18:42
43c0bb6 to
692d09f
Compare
Stamp every Browserbase session the Go SDK creates with authoritative stagehand/stagehand_sdk_language user metadata, mirroring the TypeScript SDK's session-metadata attribution. Attribution is applied after the caller's userMetadata so it cannot be spoofed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Addresses review feedback from shrey150
shrey150
force-pushed
the
shrey/stg-2714-go-sdk-language
branch
from
July 28, 2026 18:46
692d09f to
4b2b857
Compare
monadoid
approved these changes
Jul 28, 2026
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.
Summary
stagehandandstagehand_sdk_languageuser metadata, mirroring the TypeScript SDKWhy
Stagehand v3 identifies its SDK language with the
x-languagerequest header. V4 no longer routes SDK work through the hosted Stagehand API, so Browserbase session metadata is the durable, queryable equivalent for cloud sessions. #2467 added this for the TypeScript and Python SDKs. The Go SDK has since landed onv4-spike, so this PR completes the follow-up for Go.E2E Test Matrix
v4-spike.BROWSERBASE_SMOKE=1 go test -run TestStagehandBrowserbaseIntegration→ create a real Browserbase session through the Go SDK → retrieve it through the Browserbase API{"stagehand":"true","stagehand_sdk_language":"go","suite":"stagehand-v4-go-public-smoke"}; the session was released.