fix(skills): correct cloud-browser stop body and cdpUrl resolution#46
Merged
Alezander9 merged 1 commit intomainfrom May 9, 2026
Merged
fix(skills): correct cloud-browser stop body and cdpUrl resolution#46Alezander9 merged 1 commit intomainfrom
Alezander9 merged 1 commit intomainfrom
Conversation
Two bugs surfaced by an agent testing Way 3 cloud browsers end-to-end,
verified against the v3 OpenAPI spec at docs.browser-use.com.
1. Stop body was `{state: "stop"}`. The v3 `PATCH /browsers/{id}`
schema (UpdateBrowserSessionRequest) requires `{action: "stop"}` —
field name and enum both wrong before. Fixed in BROWSER.md (no
instance), cloud-browser.md (Stop section, Swap section, workspace
helper).
2. `cdpUrl` from BU was passed straight as `wsUrl`. BU returns the
HTTP discovery endpoint (e.g. https://cdpN.browser-use.com), same
shape as Chrome's :9222, not a WebSocket URL. Resolve via
`/json/version` and use `webSocketDebuggerUrl` — same fix that
the v0.1.0 Way 2 polish landed for raw Chrome. Updated all three
call sites: BROWSER.md inline Way 3, cloud-browser.md Connect
section, workspace helper now does the resolution once and returns
wsUrl directly.
Cleanups while here: `{id, cdpUrl, liveUrl} = await r.json()` (was
hand-destructured snake-OR-camel; v3 spec is unambiguously camelCase).
Inline comments updated profile_id/proxy_country_code -> profileId/
proxyCountryCode to match.
No behavior change in source code; skill files only. Skills
materialization tests still pass — content shape unchanged, just
correct now. Typecheck clean, 8 pass + 5 chrome-gated skip.
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.
Two bugs surfaced by an agent testing Way 3 end-to-end
Both verified against the canonical v3 spec at https://docs.browser-use.com/cloud/openapi/v3.json (
UpdateBrowserSessionRequest,BrowserSessionItemView).1. Stop body —
{state: "stop"}→{action: "stop"}The v3
PATCH /browsers/{id}schema requires:{ "action": "stop" }Field name was wrong (
statevs.action); enum value happened to match. Fixed in three places: cloud-browser.md Stop section, Swap section, and the workspacestop()helper.2. cdpUrl resolution — pass through →
/json/versionBU's
cdpUrlis the HTTP discovery endpoint (e.g.https://cdpN.browser-use.com), not a WebSocket URL. Same shape as Chrome's:9222. The v0.1.0 Way 2 polish (PR #44) landed exactly this fix for raw Chrome; cloud-browser docs missed the same step.Fix:
fetch(${cdpUrl}/json/version)→ usewebSocketDebuggerUrl. Applied at three call sites: BROWSER.md inline Way 3 example, cloud-browser.md Connect section, and the workspaceprovision()helper (now does the resolution once internally and returnswsUrldirectly so callers cansession.connect({ wsUrl })).Cleanups while here
body.cdp_url ?? body.cdpUrl). The v3 OpenAPI spec is unambiguously camelCase — old comment claiming "some regions return snake_case" wasn't backed by spec or any test. Use straight destructuring:const { id, cdpUrl, liveUrl } = await r.json().profile_id/proxy_country_code→profileId/proxyCountryCodeto match the v3 request schema.Scope
Docs only — no source code changes. Two
.mdfiles:packages/bcode-browser/skills/BROWSER.md— Way 3 inline example.packages/bcode-browser/skills/cloud-browser.md— Provision, Connect, Stop, Swap, workspace helper, helper usage example.+26 / −26 lines.
Verified
bun typecheckclean.bun testfrompackages/bcode-browser/: 8 pass + 5 chrome-gated skip — skills materialization regression tests still cover that on-disk skill files contain no literal{{SKILLS_DIR}}and the substituted target paths land intact.Why no test for the API call shape
Mocking BU's HTTP responses to assert
{action:"stop"}lands in the body would test the test, not the agent. The actual contract is between the agent's snippet and BU's API server — both are now lined up against the published OpenAPI schema. Agent retest will catch any remaining drift faster than a unit-mock would.Stacks
Independent of #45 (BU_CDP_WS env var). Both can land in either order.