fix(combo): strip content-encoding on re-serialized child requests#230
Conversation
Combo failover clones the already-decoded request body as plain JSON but kept the parent Content-Encoding header. When Codex sends zstd-compressed bodies, the child path then tries to decompress uncompressed JSON, which surfaces as "Unknown frame descriptor" / Invalid JSON body and stops failover before later targets run. Drop content-encoding alongside content-length when building the child Request, and add a focused regression for that header rewrite.
|
✅ Target branch corrected This pull request now targets The |
|
Thanks for the fix — the header logic itself is right: once the child body is re-serialized from decoded JSON, One review note before this can be absorbed: the added test re-implements the header-cloning logic inside the test instead of exercising the real |
|
Reviewed the combo request path and security impact. Removing content-encoding is the correct fix because the child body has already been decoded and re-serialized. No malicious behavior or credential risk found. The Windows failure is an unrelated CLI timeout; I am merging this and will strengthen the regression coverage on dev so it exercises the production helper rather than duplicating the header rewrite in the test. |
Summary
content-lengthand left the parent'sContent-Encodingheader in place.content-encoding: zstd, the combo child path then tries to zstd-decompress uncompressed JSON. That fails asUnknown frame descriptor, gets mapped toInvalid JSON body, and combo failover stops before later targets run.combo/xai_grok_fallback: first attempt (xai/grok-4.5) failed in ~1ms withsendCount: 0, and Cursor never got a turn even though directcursor/grok-4.5worked.Fix
handleComboResponses, also deletecontent-encodingwhen building the childRequest.Test plan
bun test --isolate tests/request-decompress.test.ts tests/combo-child-headers.test.ts tests/combos.test.tsbun x tsc --noEmitPOST /v1/responseswithmodel=combo/xai_grok_fallbackreturned200andCOMBO_OKafter the local patchNotes
main/v2.7.31still has the bug.