fix(coderouter): fail OpenCode uploads cleanly when the client body errors on Bun 1.3 - #16360
lawrencecchen wants to merge 1 commit into
Conversation
… errors on Bun 1.3 pinnedFetch fed the client request body to the provider through Readable.fromWeb. On Bun 1.3.14, the minimum Bun the web tests support and the version CI runs, fromWeb throws a source-stream error as an uncaught exception instead of handing it to pipeline, so "pinned fetch fails the upload when the client body fails" crashed the test process and blamed the next test. Read the body as an async iterable with Readable.from instead; pipeline then sees the error and destroys the upstream request on Bun 1.3, Bun 1.4 and Node alike. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthrough
ChangesProxy request stream
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The proxy continues to forward request bodies and reject stream failures; no concrete production regression is established. The change appears ready to merge, though Bun 1.3 validation is author-reported. 🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
All contributors have signed the CLA ✍️ ✅ |
CI failure attributionCI failed on
Not re-run automatically: Written by |
|
@lawrencecchen main already fixes this. #15154 (e96920b) replaced I merged main into this branch locally. The only conflict was that The same failure still cancels |
teamleaderleo
left a comment
There was a problem hiding this comment.
Superseded on main: #15154 (e96920b) replaced the Readable.fromWeb pipeline in pinnedFetch with writeWebRequestBody(body, outgoing, init.signal), which reads the web stream directly and rejects on a body error. That is why this branch now conflicts. If coderouter OpenCode Go proxy > pinned fetch fails the upload when the client body fails passes on Bun 1.3.14 at current main, this PR can close.
web / Web tests (2/4)fails onmainsince #16165:coderouter OpenCode Go proxy > pinned fetch fails the upload when the client body failsdies with an uncaughterror: client went away, and Bun blames the next test (routes around an unavailable OpenCode account) too (main run, job 110212202838).pinnedFetchstreamed the client body to the provider throughReadable.fromWeb(body). On Bun 1.3.14, which CI runs andweb/scripts/run-tests.shdeclares as the minimum,fromWebthrows a source-stream error as an uncaught exception instead of passing it topipeline; evenprocess.on("uncaughtException")doesn't see it and the process exits. Bun 1.4.2 and Node pass the error topipeline's callback, so the test passed locally on newer Bun. Production runs on Node, so live traffic wasn't affected, but the test is the spec and the code has to meet it on the supported runtime.The body is now read with
Readable.from(body, { objectMode: false }). A webReadableStreamis an async iterable, sopipelinereceives its error, destroys the upstream request and rejects the fetch on Bun 1.3.14, Bun 1.4.2 and Node.Testing
Readable.fromWebcrashes Bun 1.3.14;Readable.fromdelivers the error to thepipelinecallback on Bun 1.3.14, Bun 1.4.2 and Node 24. A happy-path POST throughReadable.fromechoes the exact body on Node and Bun 1.3.14.bun test tests/coderouter-opencode-proxy.test.tson Bun 1.3.14: 2 fail before, 15 pass / 0 fail after. Bun 1.4.2: 15 pass both before and after../scripts/run-tests.sh --shard 2/4on Bun 1.3.14: 1179 pass, 0 fail.tsc --noEmitandbun run lint:complexityclean.Changelog
none
🤖 Generated with Claude Code
Summary by cubic
Fixes a crash in the OpenCode Go proxy when a client body fails during upload on Bun 1.3.14, which was failing the web tests 2/4 shard.
Bug Fixes
Readable.fromWebmade Bun 1.3 throw source-stream errors as uncaught exceptions instead of passing them topipeline, crashing the test process and blaming the next test.Readable.fromas an async iterable, sopipelinereceives the error, destroys the upstream request, and rejects the fetch on Bun 1.3, Bun 1.4, and Node alike.Written for commit 2f675e7. Summary will update on new commits.
Summary by CodeRabbit