mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
## Why Sanitizing user messages and pasted text always allocated a new string, even when the input contained no terminal control characters. ## What changed - Return a `Cow<str>` from `sanitize_user_text` so clean borrowed input remains borrowed. - Reuse owned input buffers when sanitization leaves the text intact or only removes content at the edges. - Update transcript rendering, history cells, and paste handling to consume the borrowed-or-owned result without unnecessary cloning. ## Testing Add sanitizer coverage for clean text, control sequences, Unicode control characters, incomplete escape sequences, buffer reuse, and multi-fragment output. GitOrigin-RevId: 9e39cbc0d83c5791941b37a7eb4bb918c1a05f68