Skip to content

Enforce user input length cap#12823

Merged
etraut-openai merged 5 commits intomainfrom
etraut/cap_input_length
Feb 26, 2026
Merged

Enforce user input length cap#12823
etraut-openai merged 5 commits intomainfrom
etraut/cap_input_length

Conversation

@etraut-openai
Copy link
Collaborator

@etraut-openai etraut-openai commented Feb 25, 2026

Currently there is no bound on the length of a user message submitted in the TUI or through the app server interface. That means users can paste many megabytes of text, which can lead to bad performance, hangs, and crashes. In extreme cases, it can lead to a kernel panic.

This PR limits the length of a user input to 2**20 (about 1M) characters. This value was chosen because it fills the entire context window on the latest models, so accepting longer inputs wouldn't make sense anyway.

Summary

  • add a shared MAX_USER_INPUT_TEXT_CHARS constant in codex-protocol and surface it in TUI and app server code
  • block oversized submissions in the TUI submit flow and emit error history cells when validation fails
  • reject heavy app-server requests with JSON-RPC -32602 and structured input_too_large data, plus document the behavior

Testing

  • ran the IDE extension with this change and verified that when I attempt to paste a user message that's several MB long, it correctly reports an error instead of crashing or making my computer hot.

@etraut-openai
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. 🎉

ℹ️ 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".

Copy link
Collaborator

@owenlin0 owenlin0 left a comment

Choose a reason for hiding this comment

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

small comments but lgtm

@etraut-openai etraut-openai merged commit 28bfbb8 into main Feb 26, 2026
88 of 98 checks passed
@etraut-openai etraut-openai deleted the etraut/cap_input_length branch February 26, 2026 06:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants