Skip to content

Codex instant starts sometimes on pasting text #5172

Closed as duplicate
Closed as duplicate

Description

@sckindvl

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

Activity

  1. added
    bug
    on Oct 14, 2025
  2. added
    windows-os
    on Oct 14, 2025
  3. github-actions commented on Oct 14, 2025

    @github-actions
    Contributor
  4. tibo-openai commented on Oct 16, 2025

    @tibo-openai
    Collaborator

    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.
  5. dylan-hurd-oai commented on Oct 18, 2025

    @dylan-hurd-oai
    Contributor

    Discussing a fix in #3371

  6. adsqx commented on Oct 22, 2025

    @adsqx

    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.

  7. etraut-openai commented on Nov 15, 2025

    @etraut-openai
    Contributor

    Closing in favor of #2137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugwindows-os

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions