core-agent-ide/codex-rs/tui
Eric Traut 28bfbb8f2b
Enforce user input length cap (#12823)
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](https://github.com/openai/codex/issues/12323).

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.
2026-02-25 22:23:51 -08:00
..
frames Login flow polish (#3632) 2025-09-15 00:42:53 -07:00
src Enforce user input length cap (#12823) 2026-02-25 22:23:51 -08:00
tests Disable very flaky tests (#11394) 2026-02-10 18:50:11 -08:00
BUILD.bazel fix: integration test for #9011 (#9166) 2026-01-13 23:39:34 +00:00
Cargo.toml voice transcription (#3381) 2026-02-23 22:15:18 +00:00
prompt_for_init_command.md chore: rename INIT.md to prompt_for_init_command.md and move closer to usage (#1886) 2025-08-06 11:58:57 -07:00
styles.md fix: stop using ANSI blue (#2421) 2025-08-18 16:02:25 +00:00
tooltips.txt Add /statusline tooltip entry (#12005) 2026-02-17 18:04:33 +00:00