Repository navigation
Description
TUI composer wedges on tmux paste-buffer + immediate Enter: bracketed-paste state not exited before submit (codex-cli 0.139.0)
What version of Codex is running?
codex-cli 0.139.0
What platform is your computer?
Linux Ubuntu 24.04.4 LTS, kernel 6.17.0-35-generic, x86_64
What terminal / environment?
- tmux 3.4 (with
mouse on,allow-passthrough on) - TERM=xterm-256color, COLORTERM=truecolor
- codex-cli launched as:
codex -C <repo> --sandbox read-only --ask-for-approval never - (terminal emulator not relevant to the bug; reproduced inside a tmux session)
What steps reproduce the bug?
# 1. In a tmux session with a running codex-cli TUI pane, build a
# multi-line payload (any text > ~1 KB triggers reliably; small
# payloads can also trigger under fast conditions).
PAYLOAD='hello test
this is a multi-line test message
line 3
line 4'
# 2. Load + paste via tmux (standard multi-line delivery pattern).
tmux load-buffer -b repro - <<<"$PAYLOAD"
tmux paste-buffer -b repro -t %pane
# 3. Send submit immediately (this is the trigger).
tmux send-keys -t %pane EnterWhat is the expected behavior?
The submit gesture sent after the paste is treated as a clean submit. The composer clears, the placeholder returns, and the message is processed.
What actually happens?
The composer renders [Pasted Content NNNN chars] #2 (and #3, #4, ... if multiple submit gestures are sent). Submit gestures (Enter, C-m) are interpreted as additional paste events — the #N counter increments. The composer is wedged; no message is submitted. The wedge persists across C-a + C-k clears of the visible composer line and is only reliably cleared by killing and relaunching the codex-cli process.
Workaround (verified)
Insert a sleep of approximately 5 seconds between the paste-buffer call and the submit gesture. The TUI then exits bracketed-paste state and accepts a clean submit:
tmux paste-buffer -b repro -t %pane
sleep 5 # required delay; TUI exits paste state here
tmux send-keys -t %pane EnterThis is functional but inelegant. The required delay appears to scale with payload size; 5–10 seconds is a workable default.
Diagnostic observations
- The issue is reproducible across multiple cycles.
- A codex-cli session in the affected environment self-diagnosed: the TUI remains in (or re-enters) bracketed-paste input handling, and the submit gesture is routed through the paste path as a continuation / replay event rather than as a clean submit.
- Web search at the time of this report returned no known openai/codex issue for the same symptom. Search performed:
site:github.com/openai/codex codex-cli 0.139.0 paste Enter bracketed paste tmux.
Potentially related issues
- Enter key stops responding after task completion in tmux (TUI input stuck) #12645: "Enter key stops responding after task completion in tmux" — similar symptom (Enter stuck in tmux context), root cause traced to
KeyboardEnhancementFlagsintui.rs:73-79. May share an underlying input-mode state-machine mechanism. - [FEATURE] Add setting to control pasted-text placeholder collapse in the TUI composer #17332: feature request for paste-placeholder settings — adjacent, not the same bug.
- Codex Desktop
/goalignores auto-createdPasted text.txtattachments and treats the goal as empty #25346: referenceschat_composer.rslines 62–70 and thepending_pastes→prepare_submission_text_with_optionspipeline — the same code path. That issue is about Desktop ignoring pasted attachments; this issue is about the TUI submit not expandingpending_pastes. Both involve the placeholder → submit pipeline.
What I haven't tested yet
- Whether the bug reproduces outside tmux (plain terminal paste followed by immediate Enter).
- Whether the bug reproduces with small pastes (a single line, a single word, a few bytes) — i.e., is there a size threshold?
- Whether the bug reproduces with middle-click paste inside tmux (which may use a different code path than
paste-buffer). - Whether
codex --no-tuiis supported and whether the bug is TUI-specific. - codex CLI debug-level logs during reproduction.
- Whether the fix for Enter key stops responding after task completion in tmux (TUI input stuck) #12645 (
PushKeyboardEnhancementFlagsintui.rs:73-79) is in 0.139.0; if it is, this bug is a different manifestation of the same input-mode state-machine issue.
Suggested fix surface
The TUI's input state machine should ensure that:
- A submit gesture (Enter / C-m) received after a bracketed-paste payload is always routed to the submit handler, not the paste handler.
- The TUI exits bracketed-paste mode within a bounded time after the paste ends, regardless of payload size.
- Multiple submit gestures do not produce multiple paste events (the
#Ncounter should not increment on a submit).
A small fix in the input state machine — distinguishing "submit during settling paste" from "new paste" — would resolve this without affecting normal interactive use.
Contact
- Submitter: Nicholas Francis O'Brien
- Email: [email protected]
- GitHub: nicholasob7
- Website: https://nicko.obrienai.com
Happy to provide additional reproduction details, session logs, or testing on a candidate patch if helpful.
Activity
github-actions commentedon Jun 14, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
tokio-tungstenite poll_nextloops onWouldBlock) #28116Powered by Codex Action
nicholasob7 commentedon Jun 14, 2026
Reviewed #28116. This is related, but I do not think #28167 is a straight duplicate unless maintainers confirm the same input-state failure.
#28116 appears to describe a broader long multi-line paste freeze, with diagnostic evidence pointing to a WebSocket read loop / WouldBlock hang after submission.
The distinguishing condition in #28167 is the tmux paste-buffer + immediate Enter sequence. The suspected failure is that the TUI composer does not fully exit bracketed-paste handling before submit, so Enter is routed through paste continuation/replay behavior rather than ordinary submit handling.
So I am leaving #28167 open as a narrower bracketed-paste/tmux race report unless maintainers prefer consolidation.
JJLiebig commentedon Sep 2, 2026
Windows/ConPTY confirmation on upstream Codex 0.152.1
I reproduced the same failure without tmux.
Environment:
codex-cli 0.152.1bundled with the OpenAI Codex Windows appReproduction:
Observed:
agent_prompt_stalledafter 5.37 seconds.[Pasted Content 4053 chars].This matches Codex’s paste-burst behavior. In 0.152.1, Windows uses a 60 ms idle timeout and a 120 ms Enter-suppression window. Enter received while the burst is active is appended to the paste instead of submitting it:
https://github.com/openai/codex/blob/rust-v0.152.1/codex-rs/tui/src/bottom_pane/paste_burst.rs#L155-L168
https://github.com/openai/codex/blob/rust-v0.152.1/codex-rs/tui/src/bottom_pane/chat_composer.rs#L3152-L3169
The important timing detail is that a successful ConPTY write/flush only means Windows accepted the bytes. It does not mean Codex has processed the final character. For sufficiently large input, the synthetic Enter can therefore reach Codex while its paste burst is still active.
I also tested
disable_paste_burst=true:Therefore, disabling paste-burst detection is not a safe workaround for general prompt automation.
The downstream Herdr report is:
herdrdev/herdr#3187
pdinc-oss commentedon Oct 16, 2026
While #28434 , #28116 , #27405 seem to describe my issues, this issue does it better. Our internal tracker: PDINC-13912
codex-cli 0.162.1 does not resolve the issue.
Out typical invocation is On WSL1 (Ubuntu 22.04.5 LTS), via cygwin bash/Mintty (
wsl -d Ubuntu-22.04 -u username) thenscript -f -q -O codex.typescript -c 'codex -a never -s danger-full-access --no-alt-screen resume session-guid'I accidentally pasted a large single line text string, which the TUI presented as
[Pasted Content 1024 chars](hex dump below).hitting backspace, then after 12 hours/overnight (redacted):
after kill -9 from other terminal, vt100 reinitialization, the same Mintty window can be re-used.