Repository navigation
feat: make gateway request size limit configurable - #21
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0100aeae87
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .max_message_size(gateway.max_request_bytes) | ||
| .max_frame_size(gateway.max_request_bytes) |
There was a problem hiding this comment.
Apply the configured limit to native WebSockets
When a client uses a fallback WebSocket route such as /codex/guardian, /codex/guardian-classifier, or /backend-api/wham/remote/control/server, the connection is upgraded in native::handle, whose two ws.protocols(...).on_upgrade(...) branches never call max_message_size or max_frame_size. Consequently, --max-request-bytes only affects the Responses and Realtime WebSocket handlers: a smaller configured limit is not enforced on these native sockets, while a larger value cannot override Axum's defaults. Apply the same limits to the upgrade paths in src/native.rs.
Useful? React with 👍 / 👎.
The gateway currently hardcodes a 16 MiB ingress limit. Add
--max-request-bytesandCODEX_GATEWAY_MAX_REQUEST_BYTESso operators can raise or lower it without rebuilding; the CLI flag takes precedence and the default is raised to 64 MiB.The setting applies to HTTP request bodies (including multipart overhead), decoded native zstd bodies, and downstream Responses/Realtime WebSocket messages and frames. Reject zero, invalid and oversized configuration values. Model catalog and buffered response limits remain independent. Document a 64 MiB configuration example.
Validation:
cargo test --locked --bin codex-api-gateway --test gateway --test catalogon latest main: 61 passed, 6 ignored before the default change; after changing the default, both CLI tests passed, including the new 64 MiB default assertion. Includes CLI validation and configured HTTP/zstd boundary rejection tests.git diff --checkpassed. No deployment or live upstream calls.Related: #20 separately raises only Responses HTTP limits to a fixed 64 MiB. This PR also defaults to 64 MiB and introduces operator configuration across the shared ingress limits; the overlapping server changes will need reconciliation if both are merged.