fix(proxy): decode ArrayBuffer bodies for Responses WebSocket - #1432
fix(proxy): decode ArrayBuffer bodies for Responses WebSocket#1432ROOOO wants to merge 1 commit into
Conversation
Symptom: - Remote Compaction v2 requests with previous_response_id skipped the upstream WebSocket path and fell back to HTTP, where they were rejected. Cause: - Raw passthrough request bodies are stored as ArrayBuffer values. - Responses WebSocket body decoding did not support ArrayBuffer, so the upstream WebSocket frame was never sent. Solution: - Decode ArrayBuffer request bodies before constructing the upstream WebSocket frame. - Add regression coverage ensuring Remote Compaction v2 continues over WebSocket.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough该变更支持将 ChangesArrayBuffer 代理转发
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized fix is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Code Review Summary
No significant issues identified in this PR.
PR Size: S
- Lines changed: 80
- Files changed: 2
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean
- Error handling - Clean
- Type safety - Clean
- Documentation accuracy - Clean
- Test coverage - Adequate
- Code clarity - Good
Automated review by Claude AI
Summary
ArrayBufferrequest bodies before Responses WebSocket forwarding.Problem
Remote Compaction v2 requests carrying
previous_response_idcould skip upstream Responses WebSocket forwarding and fall back to HTTP. The upstream HTTP endpoint rejects that continuation parameter.Related
Root cause
Raw passthrough bodies are stored as
ArrayBuffervalues, whiledecodeRequestBodyAsJsononly handled strings, Buffers, and Uint8Arrays. Decoding therefore returnednulland the WebSocket attempt was skipped.Impact
Eligible Remote Compaction v2 requests continue through the upstream Responses WebSocket path instead of failing after HTTP fallback. Other request-body shapes retain existing behavior.
Validation
bun run build— passedbun run lint— passedbun run lint:fix— passed; no fixesbun run typecheck— passedbunx vitest run tests/unit/proxy/proxy-forwarder-raw-passthrough-regression.test.ts— passed (5 tests)bun run test— 8529 passed, 13 skipped, 1 failed. The failure is the existingLanguageSwitcher > keeps the pending refresh after remount when sessionStorage is blockedassertion; its test file is unchanged fromupstream/dev, and the isolated rerun reproduces the same failure.Greptile Summary
This PR adds JSON decoding for raw
ArrayBufferrequest bodies so eligible Remote Compaction v2 requests can continue through the Responses WebSocket path instead of falling back to HTTP.ArrayBufferbodies as UTF-8 alongside existing string, Buffer, and Uint8Array handling.Confidence Score: 5/5
The PR appears safe to merge, with the focused change correctly restoring WebSocket forwarding for raw ArrayBuffer request bodies.
Raw-passthrough bodies are normalized to native ArrayBuffers, the new branch decodes their complete byte range consistently with existing body types, and the regression test verifies that the resulting JSON reaches the WebSocket adapter without HTTP fallback.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(proxy): decode ArrayBuffer bodies fo..." | Re-trigger Greptile
Context used: