Skip to content

Linux regression in 0.158.0: mouse selection no longer supports middle-click paste #49162

Done

Description

@ronny-rentner

Since updating to Codex CLI 0.158.0 on September 28, selecting text in the TUI no longer makes it available for middle-click paste. Codex displays a message saying the text was copied, but middle-click paste does not paste the selected text.

Linux terminals already provide selection and middle-click paste. This worked before the update. Codex should preserve that standard terminal behavior.

Reproduction

  1. Run Codex CLI 0.158.0 in GNOME Terminal on Linux.
  2. Select text with the mouse.
  3. Middle-click to paste.

Expected: The selected text is pasted.

Actual: The selected text is not pasted, despite Codex’s copy confirmation.

Environment: GNOME Terminal, Wayland, VTE 0.80.1.

The 0.158.0 release notes list changes to copy-on-select behavior.

Activity

  1. added
    bug
    CLI
    TUI
    on Sep 29, 2026
  2. ronny-rentner commented on Sep 29, 2026

    @ronny-rentner
    Author

    Tested downgrade results: 0.157.0 is also affected. In 0.156.0, standard Linux mouse selection and middle-click paste work correctly. This places the regression between 0.156.0 and 0.157.0.

  3. jbiel commented on Sep 30, 2026

    @jbiel

    This is quite annoying and I bump into it often! My main problem is the reverse (I want to paste into Codex with middle click.) I'm am using Ghostty under Hyprland (Wayland.)

  4. etraut-openai commented on Oct 2, 2026

    @etraut-openai
    Contributor

    (response from codex)

    I prototyped a fix for this, but I’m going to pause it for now.

    The underlying problem is that our clipboard library prefers Wayland whenever it is available, but some compositors do not expose a usable PRIMARY selection through the Wayland data-control protocol. Supporting mixed Wayland/XWayland sessions would require explicitly falling back to X11.

    The prototype used x11-clipboard for that fallback. Although it worked, the crate is in maintenance mode, its latest release is missing relevant upstream fixes, and implementing the required X11 selection protocol ourselves would add a disproportionate amount of subtle ownership and event-loop code.

    This is worth revisiting if one of the following happens:

    • our existing clipboard library adds explicit per-operation X11 fallback;
    • a well-maintained X11 PRIMARY implementation becomes available; or
    • Wayland PRIMARY support becomes sufficiently consistent across compositors.

    For now, the maintenance and dependency cost does not feel justified for this fix.

  5. etraut-openai commented on Oct 2, 2026

    @etraut-openai
    Contributor

    You can fall back to scrollback mode using /tui as a workaround.

  6. toppk commented on Oct 8, 2026

    @toppk

    another workaround is unset WAYLAND_DISPLAY. obviously codex doesn't need that variable but actually wayland clients don't either because they'll just guess wayland-1. This will trick codex into behaving properly

    alias codex='env -u WAYLAND_DISPLAY codex'
  7. ronny-rentner commented on Nov 7, 2026

    @ronny-rentner
    Author

    In response to the decision to pause the fix: I did not ask Codex to replace native terminal selection. I asked it to preserve the selection and middle-click paste behavior that already worked before this regression.

    If maintaining Codex's replacement is too expensive, remove the interception and restore the terminal's native behavior. The maintenance cost of the replacement is a reason to reconsider that design, not a reason to leave standard terminal interaction broken.

    Please restore native selection and middle-click paste by default. Users should not need Shift-modified gestures, environment-variable changes, or a switch to scrollback mode to recover behavior Codex broke.

    The acceptance criterion is straightforward: in GNOME Terminal on Wayland, an ordinary mouse drag selects text through the terminal, and an ordinary middle-click pastes the primary selection, without Codex-specific workarounds.

  8. dolzenko commented on Nov 12, 2026

    @dolzenko

    I tested a capability-gated approach for Wayland PRIMARY: prototype patch.

    It probes PRIMARY support through the wl-clipboard-rs backend already used by Arboard, enabling it on supported compositors. Unsupported compositors remain disabled, and the existing remote-session exclusions are preserved.

    An isolated headless Ghostty/Niri A/B test reproduced the failure with stock Codex and successful fullscreen middle-click paste with the patch. Multiline Unicode, separate CLIPBOARD contents, and no automatic submission were verified; targeted regression tests passed.

    This prototype is based on v0.167.2, and has not been validated against current main. It demonstrates a native Wayland path that requires no X11 fallback.

  9. etraut-openai commented on Nov 26, 2026

    @etraut-openai
    Contributor

    Thanks for reporting this. We’ve merged a fix that will ship in an upcoming Codex CLI release.

    The copy confirmation was for the regular clipboard. Linux middle-click uses a separate selection called PRIMARY, which Codex had disabled on Wayland.

    I verified in GNOME Terminal on Wayland that you can once again drag to select text in Codex and middle-click to paste it into the prompt. Mouse capture stays enabled.

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

Metadata

Metadata

Assignees

Labels

CLITUIbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions