Go SDK leaks an uploaded Browserbase extension when upload-response validation fails
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in packages/sdk-go/browserbase_session.go at the upload and extension.validate() path, then review deleteExtensionBestEffort and the cleanup paths that follow session creation. Add the focused case to packages/sdk-go/browserbase_session_test.go using fakeBrowserbaseAPI and an invalid response with a usable ID. Done means validation still fails, deleteExtensionCalls records the uploaded extension, and cleanup uses a non-canceled context while preserving any errors.
Written by the indexing model from the issue text.
Description
Description
The Go Browserbase launch path uploads an owned Stagehand extension and then validates the full upload response. If validation fails while the response still contains a usable extension ID (for example, createdAt is missing or fileName is empty), createSession() returns immediately without deleting the extension that was just created.
Other failure paths after a successful upload call deleteExtensionBestEffort, but the response-validation path does not. Repeated transient/malformed API responses can therefore accumulate orphaned extensions on the Browserbase account.
Code reference
packages/sdk-go/browserbase_session.go:85-97uploads the extension and returns directly onextension.validate()failure.packages/sdk-go/browserbase_session.go:106-115correctly deletes the owned extension when session creation fails.packages/sdk-go/browserbase_session.go:117-130also cleans up after an invalid session response.packages/sdk-go/browserbase_client.go:724-748shows that validation can fail for fields other thanid, leaving a valid ID available for cleanup.
Reproduction
Add a focused test using fakeBrowserbaseAPI in packages/sdk-go/browserbase_session_test.go:
- Make
uploadExtensionFuncreturn a response withID: testPointer("ext_orphaned")but one invalid/missing metadata field, such asCreatedAt: nil. - Call
client.createSession(context.Background(), BrowserbaseLaunchOptions{}). - Assert that creation fails validation.
- Inspect
api.deleteExtensionCalls.
deleteExtensionCalls remains 0, although the server-side extension ID is known.
Expected behavior
When an upload succeeded and returned a non-empty extension ID, every subsequent local validation failure should make a best-effort deletion using a non-canceled cleanup context, while preserving the validation error (and joining any cleanup error).
Actual behavior
The function returns the validation error and leaves the uploaded extension behind.
Why it matters
Browserbase extensions are account resources. A malformed or partially incompatible API response should not turn a failed browser launch into a persistent resource leak, especially for applications that retry launch automatically.
Duplicate/history check
I searched open and closed issues/PRs for Browserbase extension cleanup, invalid upload responses, and extension leaks. Existing tests cover upload errors, empty IDs, session-creation cleanup, and retrying failed deletion, but I found no issue or PR covering cleanup after upload-response validation fails.
- Dominant language
- TypeScript
- Stars
- 24.6k
- Forks
- 1.7k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 62
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from browserbase/stagehand
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
browserbase/stagehand#2918 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
browserbase/stagehand#2910 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
browserbase/stagehand#2844 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
browserbase/stagehand#2735 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
browserbase/stagehand#2734 ·
All issues in browserbase/stagehand
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100