Summary
In the TUI, Ctrl+V currently behaves as an image-paste shortcut if it reaches Codex as a key event.
That means when the clipboard contains text, and the terminal does not convert the paste into a bracketed Paste(...) event, Codex tries to
paste an image instead and shows an error like:
Failed to paste image: no image on clipboard: ...
Root cause
There are currently two different paste paths:
- text paste: relies on terminal/crossterm
Event::Paste(...)
Ctrl+V: handled as clipboard image paste in the TUI keybinding layer
So if the terminal forwards Ctrl+V as a keypress instead of surfacing a paste event, text paste does not happen inside Codex.
Proposed behavior
Ctrl+V in local desktop sessions:
- try clipboard text first
- if non-empty text exists, route it through the existing composer paste path
- if no text exists, fall back to image paste
Alt+V:
- remain explicit image paste
- SSH/remote sessions:
- do not do process-local text clipboard reads
- rely on terminal-owned paste
- if
Ctrl+V reaches Codex as a key event, show a short hint instead of reading the remote process clipboard
Why this shape
- preserves terminal-native
Paste(...) handling
- preserves explicit image paste
- avoids incorrect clipboard semantics in SSH sessions
- makes
Ctrl+V symmetric for local users whose terminal forwards the keypress
Local implementation + verification
I implemented this in a local clone and verified with:
just fmt
cargo clippy -p codex-tui --tests
cargo test -p codex-tui
The change includes:
- text clipboard read helper
- WSL text fallback
Ctrl+V text-first shortcut policy
Alt+V image-only policy
- SSH hint path
- updated footer/snapshots/tests
If this approach matches the intended direction, I can turn it into a PR if invited.
Summary
In the TUI,
Ctrl+Vcurrently behaves as an image-paste shortcut if it reaches Codex as a key event.That means when the clipboard contains text, and the terminal does not convert the paste into a bracketed
Paste(...)event, Codex tries topaste an image instead and shows an error like:
Root cause
There are currently two different paste paths:
Event::Paste(...)Ctrl+V: handled as clipboard image paste in the TUI keybinding layerSo if the terminal forwards
Ctrl+Vas a keypress instead of surfacing a paste event, text paste does not happen inside Codex.Proposed behavior
Ctrl+Vin local desktop sessions:Alt+V:Ctrl+Vreaches Codex as a key event, show a short hint instead of reading the remote process clipboardWhy this shape
Paste(...)handlingCtrl+Vsymmetric for local users whose terminal forwards the keypressLocal implementation + verification
I implemented this in a local clone and verified with:
just fmtcargo clippy -p codex-tui --testscargo test -p codex-tuiThe change includes:
Ctrl+Vtext-first shortcut policyAlt+Vimage-only policyIf this approach matches the intended direction, I can turn it into a PR if invited.