Skip to content

fix(browser): resolve HTTP CDP URLs#113

Open
MagMueller wants to merge 2 commits into
mainfrom
resolve-cdp-url
Open

fix(browser): resolve HTTP CDP URLs#113
MagMueller wants to merge 2 commits into
mainfrom
resolve-cdp-url

Conversation

@MagMueller

@MagMueller MagMueller commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • treat BU_CDP_URL=http://... as a DevTools HTTP endpoint and resolve its WebSocket URL through /json/version
  • retry discovery within the caller’s existing connection timeout so a browser that is still starting can become ready
  • surface HTTP 403 as an immediate remote-debugging permission error
  • preserve BU_CDP_URL=ws://... compatibility and keep BU_CDP_WS as the highest-priority direct WebSocket setting

Previously an HTTP BU_CDP_URL was passed directly to new WebSocket, which attempted an upgrade on the HTTP root instead of querying /json/version. This matches the public browser-harness endpoint contract.

Validation

  • bun test in packages/bcode-browser: 16 pass, 8 environment-gated skips
  • deterministic tests cover HTTP discovery, cold-start retries, permission denial, WebSocket compatibility, and env precedence
  • package typecheck and root filtered typecheck: pass
  • bunx oxlint packages/bcode-browser/test/connect-env.test.ts: clean

Summary by cubic

Fixes connection to Chrome when BU_CDP_URL is an HTTP DevTools endpoint by resolving its WebSocket URL via /json/version. Uses a single connection deadline for discovery and WebSocket open, adds retries until the deadline, and clearer 403 permission errors, while keeping BU_CDP_WS priority and BU_CDP_URL WebSocket compatibility.

  • Bug Fixes
    • Resolve HTTP BU_CDP_URL through /json/version to obtain webSocketDebuggerUrl.
    • Keep discovery within the caller’s deadline with retries; WebSocket open uses remaining time.
    • Surface HTTP 403 as an immediate remote-debugging permission error.
    • Preserve precedence: BU_CDP_WS over BU_CDP_URL; accept WebSocket values in BU_CDP_URL.

Written for commit d3e7b76. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

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

Fix all with cubic | Re-trigger cubic

Comment thread packages/bcode-browser/src/cdp/session.ts Outdated
Comment thread packages/bcode-browser/src/cdp/session.ts
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.

1 participant