Area
Proxy and routing
What are you trying to accomplish?
With the GPT-5.6 1M (922k opt-in) context window configured, a long session eventually triggers Codex's automatic remote compaction. That compaction request replays the full conversation history to the compaction model, and once the session passes roughly 700-800k tokens the serialized request body exceeds the proxy's hard-coded 256 MiB inbound limit. The compact task then fails with:
Error running remote compact task: unexpected status 413 Payload Too Large: Decompressed request body exceeds 268435456 bytes, url: http://127.0.0.1:10100/v1/responses
Users on the large opt-in window cannot use automatic (or late manual) compaction at all, because the compaction request itself is what crosses the limit. I want the body limit to be configurable (or scaled with the model window) so large-context sessions can compact.
What prevents this today?
- src/server/request-decompress.ts hard-codes MAX_DECOMPRESSED_BODY_BYTES = 256 * 1024 * 1024 for /v1/responses inbound bodies (readJsonRequestBody always uses it; there is no config lever).
- A 922k-token session history serializes to well over 256 MiB of JSON, so remote compact (and any full-history request) returns 413 before parsing.
- Manual /compact suffers the same 413 once the history is large enough - the user is stuck until they abandon the session.
- The limit is independent of the configured context window: smaller windows (e.g. 272k) stay far below it, which is why this only bites the opt-in large-window setups.
What should OpenCodex do?
- Make the inbound decompressed-body limit configurable (e.g. a config key with a sensible default), and/or
- Derive it from the routed model's configured context window (limit >= window size serialized with headroom), so enabling the 1M opt-in does not silently break compaction, and/or
- At minimum, return a clearer error explaining that the session is too large to compact through the proxy (instead of an opaque 413), and suggest a smaller window or manual compaction earlier.
Example usage or interface
# config.json
"inboundRequestBodyLimitBytes": 536870912 # 512 MiB opt-in
# or per-model auto-scaling when the 922k window is enabled
"providers": { "openai": { "modelContextWindows": { "gpt-5.6-sol": 922000 } } }
# -> inbound limit scales to cover the window, compaction works
Alternatives or workarounds
- Manually /compact before the session exceeds ~600k tokens (works, but easy to forget; automatic compaction still 413s if it fires late).
- Revert to the 272k default window (compaction always safe, but the large-window capability is lost).
Additional context
Related: the 1M opt-in mechanism for gpt-5.6 (NATIVE_GPT56_MAX_INPUT_TOKENS / modelContextWindows), and #3196 which added an opt-in ceiling for oversized outbound passthrough bodies - this is the inbound analogue. Reproduced on 2.42.0.
Checks
Area
Proxy and routing
What are you trying to accomplish?
With the GPT-5.6 1M (922k opt-in) context window configured, a long session eventually triggers Codex's automatic remote compaction. That compaction request replays the full conversation history to the compaction model, and once the session passes roughly 700-800k tokens the serialized request body exceeds the proxy's hard-coded 256 MiB inbound limit. The compact task then fails with:
Users on the large opt-in window cannot use automatic (or late manual) compaction at all, because the compaction request itself is what crosses the limit. I want the body limit to be configurable (or scaled with the model window) so large-context sessions can compact.
What prevents this today?
What should OpenCodex do?
Example usage or interface
Alternatives or workarounds
Additional context
Related: the 1M opt-in mechanism for gpt-5.6 (NATIVE_GPT56_MAX_INPUT_TOKENS / modelContextWindows), and #3196 which added an opt-in ceiling for oversized outbound passthrough bodies - this is the inbound analogue. Reproduced on 2.42.0.
Checks