Repository navigation
fix(serve): keep relay streams alive on the Cloudflare runtime - #2807
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 149a72a8c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Workerd defaults to Blob delivery; the synchronous frame parser requires bytes. | ||
| socket.binaryType = "arraybuffer"; |
There was a problem hiding this comment.
Add the relay fix to the changelog
This restores production-visible Cloudflare relay behavior, but the commit does not add an entry under CHANGELOG.md's Unreleased fixes. Repository policy requires agents and maintainers to record user-visible fixes as they land, so add a concise relay-fix bullet there.
AGENTS.md reference: AGENTS.md:L60-L60
Useful? React with 👍 / 👎.
Problem
The serve relay from #2797 failed on the production (Cloudflare) coordinator. A live Worker tail showed sessions minted (
POST …/relay200) and both…/clientand…/agentWebSockets attaching, then both ending ascanceledwithin ~2–3s. The client re-minted sessions in a loop and the SSH transport never came up. The same relay passed end to end on the Node runtime.Root cause
workerd delivers binary WebSocket messages as
Blobby default on accepted sockets; Node delivers bytes. The relay's synchronous frame parser (data/ack framing with a 32 KiB window) expects bytes, so acknowledgements never parsed and both sides tore the session down.Fix
Set
socket.binaryType = "arraybuffer"on each relay socket before acceptance. A regression test exercises the Cloudflare acceptance path with Blob-default sockets, full-size bidirectional frames, acknowledgements and close propagation; it fails without the fix and passes with it.Verification
Worker gate (format, lint,
check,check:node,test,build,build:node). Go vet/race for serve and the CLI relay subset. Local end to end on workerd (wrangler dev) and on Node:serve route: relay→RELAY_OK, and a held session cut on stop. Codex review (P1): scoped-clean. The production cross-machine relay test follows after deploy.