You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linux regression in 0.158.0: mouse selection no longer supports middle-click paste #49162
CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working
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
Run Codex CLI 0.158.0 in GNOME Terminal on Linux.
Select text with the mouse.
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.
Reacted by J Biel, Henrik R. Larsson, Uwe Jugel, toppk, melkorm and Ev Dolzhenko
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.
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.)
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:
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
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.
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.
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.
CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working
Activity
github-actions commentedon Sep 29, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
ronny-rentner commentedon Sep 29, 2026
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.
jbiel commentedon Sep 30, 2026
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.)
etraut-openai commentedon Oct 2, 2026
(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-clipboardfor 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:
For now, the maintenance and dependency cost does not feel justified for this fix.
etraut-openai commentedon Oct 2, 2026
You can fall back to scrollback mode using
/tuias a workaround.toppk commentedon Oct 8, 2026
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
ronny-rentner commentedon Nov 7, 2026
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.
dolzenko commentedon Nov 12, 2026
I tested a capability-gated approach for Wayland PRIMARY: prototype patch.
It probes PRIMARY support through the
wl-clipboard-rsbackend 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.etraut-openai commentedon Nov 26, 2026
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.