-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Single Esc/Enter get duplicated in TUI, making undo unreliable #16306
Description
What issue are you seeing?
In one specific Linux server environment, Codex CLI appears to handle a single Esc or Enter keypress as if it were received twice.
A single Esc can behave like two escapes, and a single Enter can behave like a double submit. When trying to use undo / rollback, I also intermittently hit:
Error: thread/rollback failed in app-server TUI
This makes undo unreliable in practice, which is a blocker for my workflow because undo is one of the main reasons I rely on Codex CLI.
I do not see this on my other servers, so this looks environment-specific rather than a general usage issue.
What steps can reproduce the bug?
- Use a Linux server desktop session.
- In my case the environment is Ubuntu 24.04.1 with Xorg + i3 + Alacritty, accessed via RustDesk.
- Launch
codex-cli 0.117.0in the terminal. - Press
Esconce orEnteronce inside the TUI. - Observe that the action can be interpreted as if the key was received twice.
- Try to use undo / rollback and note that it can fail intermittently with
thread/rollback failed in app-server TUI.
What is the expected behavior?
A single keypress should be handled exactly once, and undo / rollback should work reliably.
Additional information
I did some debugging on the affected server and found:
- In a plain terminal raw-byte capture, one
Escproduced a single0x1b, and oneEnterproduced a single0x0d. - After enabling a startup sequence that mimics Codex TUI keyboard negotiation, the same environment produced:
- one
Esc->ESC [ 27 ufollowed by a separate rawESC - one
Enter->0d0d
- one
- I also observed startup terminal replies such as focus / cursor / device responses during the same session.
Because of that, my current guess is that this is related to the TUI keyboard-enhancement / terminal-negotiation path in this environment, rather than a generic remote-control problem or a generic terminal problem.
The key point is that by the time Codex sees the input in this environment, a single Esc / Enter may already have become multiple input events, which then makes undo especially hard to use safely.