Codex instant starts sometimes on pasting text

Resolved 💬 5 comments Opened Oct 14, 2025 by sckindvl Closed Nov 15, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.46.0

Which model were you using?

gpt-5-codex

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

Copy a text with spaces and breaks and press CTRL+V (Paste). In some not understandable situations its just starting the request

What is the expected behavior?

Just start on explicit press ENTER

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 10 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #5168
  • #4994
  • #4130

Powered by Codex Action

tibo-openai collaborator · 10 months ago

Codex analysis

--------------------

• Likely Cause

  • On Windows the terminal normally ignores the bracketed‑paste mode that we request (tui/src/tui.rs:49), so pastes fall back to per‑character key events instead of the single Event::Paste path that handle_paste

expects.

  • When that happens our “paste burst” heuristic tries to detect a paste by watching how quickly characters arrive (tui/src/bottom_pane/paste_burst.rs:4-123). The threshold is only 8 ms between characters, and the

burst window closes after 120 ms. Windows consoles often deliver the characters—especially the trailing newline—more slowly than that, so the burst finishes before the newline shows up.

  • Once the burst has closed, the newline is treated as a real Enter keypress inside handle_key_event_without_popup (tui/src/bottom_pane/chat_composer.rs:906-972), which immediately submits the request. That

matches the behavior you’re seeing: pasting multi-line text sometimes triggers a send even though you didn’t press Enter.

Next Step Ideas

  1. Relax the paste-burst timing on Windows (or detect the platform) so the newline still lands inside the burst window.
  2. Add an option to disable “Enter submits” when the paste buffer just flushed, so stray newlines turn into literal newlines instead of submissions.
dylan-hurd-oai contributor · 10 months ago

Discussing a fix in #3371

adsqx · 10 months ago

But most terminals support bracketed paste — I’ve checked it in various ways, and it seems the culprit is requery_default_colors() in tui.rs.
All observations and measurements are included in the PR above; I’ve described them in detail. I also conducted a more in-depth analysis, though I didn’t include everything in the description.

etraut-openai contributor · 9 months ago

Closing in favor of #2137