Skip to content

fix(core): read product sockets with the Bun.connect WebSocket client - #667

Merged
klNuno merged 4 commits into
mainfrom
fix/product-cdp-client
Oct 19, 2026
Merged

klNuno merged 4 commits into
mainfrom
fix/product-cdp-client

Conversation

@klNuno

@klNuno klNuno commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Note

Clanker Claude Opus 5.5 is responding on behalf of meetsu

The agent browser on Windows, the boite commands and the group relay stop losing their connection when Bun's WebSocket client drops a frame.

what changed

  • the Bun.connect client from test(e2e): speak CDP without Bun's WebSocket client and explain a shell page left blank #650 moves into the core, shared with the E2E harness, and gains headers, wss://, close reasons and permessage-deflate (packages/core/src/ws-client.ts)
  • it runs what one message started before the next message of the same read, as Bun's message events do
  • a listener that throws is reported through reportError and reading goes on; a closed socket drops its send queue (bufferedAmount shows it)
  • it refuses an upgrade answer without Upgrade and Connection or with an unoffered subprotocol, ends a forbidden close code with 1002 and text that is not UTF-8 with 1007
  • client.ts again clears the waiter and timer of a call whose params do not serialize
  • the Windows DevTools socket, the core client and the relay upstream use it (browser/cdp.ts, client.ts, group/relay.ts)
  • a guard fails while a product module still opens new WebSocket( (product-sockets.test.ts)
  • a project list waits for a folder check still pending from before the list, then checks again; one past the deadline is still skipped (projects.ts, failed Core Linux arm64 on this PR)

to question

No test makes Bun's client fail: replays of #613's dumps and byte-cut sweeps passed on Bun 1.4.3. The evidence is the #650 and #662 loops and the 1011 closes of the core client on macOS arm64 (jobs 117880160622, 117938889719).

The #658 macOS hang does not use this client: macOS and Linux read DevTools over --remote-debugging-pipe.

verified

  • product-sockets.test.ts: the guard fails on main's sockets, 3 pass here
  • microtask test fails without the drain; the terminals burst test failed 4 of 4 without it, passes 4 of 4 with it
  • new projects-git.test.ts case fails on main's projects.ts and on a fix that only waits for the pending check, passes here
  • the review tests fail on 6a028a8 (6 in ws-client.test.ts, 2 in client-timeout.test.ts) and pass here
  • bun run check passes; Windows core suite 2704 pass, audio-sessions.test.ts flaky on main too
  • headless Edge on Windows driven through browser.command: 4 sockets, 71 messages through the new client
  • not verified: Bun's fault itself

Bundle size

Core JavaScript grows about 10.7 KB: ws-client.ts now ships in the core.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: beboite/boite/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 020daf03-4b24-49e7-82c3-1a9021ae300f
📥 Commits

Reviewing files that changed from the base of the PR and between 156e44c and 787c116.

📒 Files selected for processing: 14
  • docs/browser.md
  • packages/core/src/browser/cdp.ts
  • packages/core/src/client.ts
  • packages/core/src/group/relay.ts
  • packages/core/src/projects.ts
  • packages/core/src/ws-client.ts
  • packages/core/test/browser/fixture.ts
  • packages/core/test/client-timeout.test.ts
  • packages/core/test/fixtures/journal-rpc-trace.ts
  • packages/core/test/product-sockets.test.ts
  • packages/core/test/projects-git.test.ts
  • packages/core/test/ws-client.test.ts
  • tests/e2e/lib/cdp.ts
  • tests/e2e/ws-client.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added documentation Improvements or additions to documentation core packages/core and packages/contracts labels Oct 19, 2026
@klNuno
klNuno marked this pull request as ready for review October 19, 2026 20:31
@klNuno
klNuno merged commit 83fbd18 into main Oct 19, 2026
33 of 34 checks passed
@klNuno
klNuno deleted the fix/product-cdp-client branch October 19, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core packages/core and packages/contracts documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant