fix(proxy): strip stale content encoding after reserialization - #1464
fix(proxy): strip stale content encoding after reserialization#1464ROOOO wants to merge 1 commit into
Conversation
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough本次修改在非 raw 请求重新序列化后移除过期的 Changes请求体编码头处理
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The proxy now keeps forwarded encoding metadata aligned with reserialized request bytes while preserving raw passthrough behavior. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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. The guard is correctly placed after all header-building and body-serialization branches (standard, Gemini, multipart, raw passthrough) and before init construction, so every forwarded request path sees the stripped headers. The condition asymmetry with the raw-passthrough branch (which additionally requires session.request.buffer) is unreachable in practice: ProxySession is only constructed via fromContext, which always sets request.buffer for body-carrying methods.
PR Size: S
- Lines changed: 87
- Files changed: 2
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean
- Error handling - Clean (strip action is logged at debug level with provider context)
- Type safety - Clean
- Documentation accuracy - Clean (log message matches behavior)
- Test coverage - Adequate (both new tests verified passing locally: 7/7 in the target file)
- Code clarity - Good
Automated review by Claude AI
Summary
content-encodingafter non-raw request bodies are reserializedcontent-encodingand exact request bytes for raw passthrough endpointscontent-lengthhandling on the existing outbound transport blacklistThis is a narrow follow-up to #1238.
Why
#1238 strips
content-encodingafter successful decompression, but an encoding retained or reintroduced later can still reach the final forwarded headers. Non-raw paths serialize a new JSON or multipart body, so that encoding no longer describes the transmitted bytes and can make the upstream decode plaintext. Raw passthrough paths still need the original encoding header.Tests
content-encodingandcontent-lengthcontent-encodingand exact request bytesbun run buildbun run lintbun run lint:fixbun run typecheckbun run test(879 test files passed; 8795 tests passed)git diff --checkGreptile Summary
The PR removes stale
content-encodingmetadata from reserialized outbound request bodies while preserving the header and exact bytes for raw-passthrough endpoints.content-encodingafter non-raw body serialization.Confidence Score: 5/5
The PR appears safe to merge, with the changed header handling aligned to the distinction between reserialized and raw-passthrough request bodies.
Non-raw outbound bodies are newly serialized before the encoding header is removed, while raw-passthrough bodies retain both their original bytes and encoding metadata; no actionable failure remains.
Important Files Changed
content-encodingonly when a defined request body has passed through the normal preprocessing and serialization path.Reviews (1): Last reviewed commit: "fix(proxy): strip stale content encoding..." | Re-trigger Greptile