Skip to content

feat: make gateway request size limit configurable - #21

Merged
reonokiy merged 4 commits into
mainfrom
feat/configurable-request-limit
Oct 20, 2026
Merged

reonokiy merged 4 commits into
mainfrom
feat/configurable-request-limit

Conversation

@reonokiy

@reonokiy reonokiy commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

The gateway currently hardcodes a 16 MiB ingress limit. Add --max-request-bytes and CODEX_GATEWAY_MAX_REQUEST_BYTES so 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 catalog on 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 --check passed. 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T04:35:56.454838Z 0100aea PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/websocket.rs
Comment on lines +56 to +57
.max_message_size(gateway.max_request_bytes)
.max_frame_size(gateway.max_request_bytes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@reonokiy
reonokiy merged commit 92dd2b3 into main Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant