Skip to content

[TUI][macOS][Warp] Ctrl+V after copying plain terminal text freezes the TUI #27811

Closed

Description

@yuebozhang

What version of Codex is running?

codex-cli 0.139.0

Which model were you using?

Not known / not relevant. The freeze occurred while pasting into the TUI composer, before submitting a prompt.

What platform is your computer?

  • macOS 26.5.1 (25F80), Apple Silicon / arm64
  • Warp 0.2026.06.03.09.49.02
  • Terminal reported in Codex logs as WarpTerminal/v0.2026.06.03.09.49.stable_02

What steps can reproduce the bug?

  1. Run this command in Warp:

    ls /dev/tty.usb*
  2. Select and copy plain terminal output similar to:

    /dev/tty.usbserial-1130    /dev/tty.usbserial-11420
    
  3. Focus the Codex TUI composer.

  4. Press Ctrl+V.

What is the expected behavior?

The copied plain text should be pasted, or Ctrl+V should be ignored without affecting TUI responsiveness.

What do you see instead?

The Codex TUI becomes permanently unresponsive. I had to open a new Codex session to continue working. The original Codex process remained alive after the freeze.

Additional diagnostic information

I inspected the local Codex logs and processes after the incident:

  • No macOS Codex crash or hang report was generated.
  • No panic, error, SQLite lock error, clipboard event, or paste event appeared around the incident time.
  • The lack of a paste event may indicate that the freeze occurs early in TUI clipboard handling, before the event reaches normal logging.
  • Multiple Codex instances were running against the same default $CODEX_HOME at the time.
  • ~/.codex/logs_2.sqlite was approximately 106 MB, its WAL was approximately 7.5 MB, and SQLite reported busy_timeout=0.
  • A process sample of the surviving Codex process showed TUI render/event-loop paths and multiple sqlx-sqlite-worker threads, but did not reveal a conclusive deadlock location.

There appear to be two plausible interacting causes:

  1. Ctrl+V uses Codex's special clipboard/image handling path on macOS, and Warp's clipboard payload for selected terminal text triggers a freeze.
  2. Multi-instance SQLite contention stalls the TUI when clipboard handling triggers additional work.

Related issues:

This report differs from #3397 because copying normal text and pressing Ctrl+V caused a permanent TUI freeze rather than doing nothing.

Activity

  1. added
    bug
    CLI
    TUI
    on Jun 12, 2026
  2. cmg1987 commented on Jul 23, 2026

    @cmg1987

    Cross-platform confirmation on Linux with stronger clipboard-path evidence.

    Environment:

    • codex-cli 0.145.0 standalone
    • Linux aarch64
    • Wayland
    • VTE 6003

    Reproduction:

    1. Copy content that is expected to include an image.
    2. Focus the Codex TUI prompt.
    3. Press Ctrl+V once.

    Clipboard-state clarification: the user believed an image was present, but this was not independently verified at the time of the incident. The clipboard may have contained a valid image, an image representation unsupported by the TUI clipboard reader, or no readable image representation. The log error establishes only that Codex could not obtain the requested image format; it does not establish that the clipboard was empty.

    Observed behavior:

    • The user observed repeated red TUI errors conveying that no usable clipboard image was available; the exact on-screen wording was not independently captured.
    • The Codex log database records this exact failure text: failed to paste image: no image on clipboard: The clipboard contents were not available in the requested format or the clipboard is empty.
    • The TUI then remains effectively frozen and repeats the image-paste operation until the process is terminated.

    Evidence from ~/.codex/logs_2.sqlite:

    • On 2026-07-23 from 16:22:51 to 16:32:29 local time, codex_tui::clipboard_paste logged 33 image-read attempts and codex_tui::chatwidget::interaction logged 32 failures.
    • Each clipboard read blocked for approximately 18 seconds.
    • Each failure was followed almost immediately by another image-read attempt.
    • The same pattern occurred on 2026-07-14: 8 attempts and 7 failures.
    • codex doctor reported the state and log database integrity checks as OK, so this does not appear to require SQLite contention.

    Expected behavior: whether the clipboard contains no readable image or an unsupported/unavailable image representation, report the failure once and immediately return control to the prompt. Buffered Ctrl+V or key-repeat events should not be replayed after a blocking clipboard read.

    Codex diagnostic feedback and logs were uploaded under thread ID: 019f8e3f-f016-7d10-b110-e761a240b797.

  3. cmg1987 commented on Sep 29, 2026

    @cmg1987

    Follow-up to my Linux 0.145.0 reproduction: the same repeated Ctrl+V image-paste pattern recurred on Codex CLI 0.158.0, now with a successfully readable screenshot. This rules out an error-only retry path as the complete explanation.

    Environment: Linux aarch64, UKUI Wayland, MATE Terminal 1.24.0 / VTE 0.60.3, external HDMI display 2560×1440. At inspection, tui.alternate_screen = "never".

    The user copied a screenshot, briefly pressed Ctrl+V once in the TUI composer, and released it. The composer accumulated [image1], [image2], ... continuously. Each image read took roughly 15–16 seconds; the UI became unusable and the user ultimately had to force a reboot. In contrast, using the terminal's right-click Paste on the screenshot produced exactly one [image1] and worked normally.

    Sanitized excerpts from ~/.codex/logs_2.sqlite on 2026-09-29, local time:

    10:53:47.803 paste_image_as_png: attempting clipboard image read
    10:54:03.503 clipboard image opened from image: 2560x1440
    10:54:03.566 attach_image [temporary PNG #1]
    10:54:03.566 paste_image_as_png: attempting clipboard image read
    10:54:18.701 attach_image [temporary PNG #2]
    10:54:18.701 paste_image_as_png: attempting clipboard image read
    10:54:34.203 attach_image [temporary PNG #3]
    ...
    10:56:25.755 attach_image [temporary PNG #10]
    10:56:25.756 paste_image_as_png: attempting clipboard image read
    

    Ten image attachments completed in about 2 minutes 22 seconds and an 11th read began before shutdown. A fresh read starts within a millisecond after each attachment. The logs do not include raw key events, so they cannot establish whether the extra PasteImage actions originate in terminal key-event delivery, Codex event processing, or their interaction. The 0.158.0 key handler maps a Ctrl+V KeyEventKind::Press to KeyEventAction::PasteImage.

    The July reproduction had 18-second reads followed by repeated failures; this one has 15–16-second reads followed by repeated successful attachments. Please investigate duplicate or replayed Ctrl+V actions after a blocking clipboard read, and consider coalescing paste actions while a read is in progress. There was no kernel OOM event in the incident window; the precise cause of the overall system stall remains unconfirmed.

  4. etraut-openai commented on Oct 12, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Closing as likely improved by #51411, included in CLI v0.162.1, which suppresses repeated image-paste key events instead of repeatedly doing clipboard work. If one Ctrl+V still freezes the TUI on a current version, please reopen with the terminal and clipboard formats so we can investigate the remaining case.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLITUIbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions