Input broken in TUI when shell_snapshot is enabled (macOS Terminal.app)
What version of Codex is running?
codex-cli 0.87.0 (regression since 0.81.0; 0.80.0 works)
What subscription do you have?
codex business plan
Which model were you using?
gpt-5.2-codex xhigh
What platform is your computer?
Darwin 24.5.0 arm64 (Apple Silicon)
What terminal emulator and version are you using (if applicable)?
Terminal.app
What issue are you seeing?
When shell_snapshot is enabled, the TUI input breaks: Enter and Backspace stop working, / command menu doesn’t respond, and I sometimes see raw escape sequences like ^[[O (especially after alt‑tab). The CLI becomes unusable.
codex --disable shell_snapshot fixes it immediately.
What steps can reproduce the bug?
- Enable shell_snapshot (TUI /experimental → “Shell snapshot” or set [features].shell_snapshot = true in ~/.codex/config.toml and restart).
- In Terminal.app, use a .zshrc that touches the TTY (example below).
- Run codex.
- Observe Enter/Backspace not working and raw escape sequences appearing.
Repro setup:
mkdir -p /tmp/codex-tty-repro cat > /tmp/codex-tty-repro/.zshrc <<'EOF' stty sane 2>/dev/null EOF
ZDOTDIR=/tmp/codex-tty-repro codex
Workaround:
ZDOTDIR=/tmp/codex-tty-repro codex --disable shell_snapshot
What is the expected behavior?
Normal TUI input works: Enter sends messages, Backspace deletes, / menu opens.
Additional information
Regression starts at 0.81.0+. 0.80.0 is fine.
We haven't received any other reports like this, so I suspect this is something specific to your machine or configuration. Can you think of anything unusual about your configuration?
Just to confirm, you've tried reverting to 0.80.0 and this eliminates the problem? This is an important clue, so I want to verify that you've done this.
Yes, reverting fixes everything Please let me know what to share about my machine configuration (running macbook pro M4 latest OS)
Do you have any non-default terminal settings? Does it work if you try a different terminal emulator?
Some info (asked codex 0.80.0 for it ;) )
OS: macOS 15.5 (24F74) uname -a: Darwin 24.5.0 arm64 (Kernel 24.5.0, RELEASE_ARM64_T8132) codex --version: codex-cli 0.81.0 which codex: /opt/homebrew/bin/codex shell: /bin/zsh; zsh 5.9 (arm64-apple-darwin24.0) Terminal.app: 2.14 TERM/TERM_PROGRAM: TERM=xterm-256color; TERM_PROGRAM=Apple_Terminal; TERM_PROGRAM_VERSION=455.1 SecureKeyboardEntry (Terminal): 1 (enabled) tmux/screen: TMUX=, STY= (not in use) locale: LANG/LC_* all C.UTF-8 stty -a: speed 9600 baud; 24 rows; 80 columns; lflags: icanon isig iexten echo echoe ...; iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ...; oflags: opost onlcr ...; cflags: cread cs8 -parenb ...; erase=^?; intr=^C; kill=^U; eof=^D infocmp $TERM: standard macOS /usr/share/terminfo/78/xterm-256color (full output available on request)
Since we don't have any repro and haven't received any other reports of this, you'll likely need to do some debugging and diagnosis on your own to figure out what's different about your system or configuration. You might want to use ChatGPT to help think of things to try. Let us know if you find any good clues.
Okay, investigating
I find it so weird that it's not really widespread... Reverting (using "npm install -g @openai/[email protected]") fixes it all (which ofc leads me to believe it's a pure code issue)
Running on 0.87.0 with 'codex --disable shell_snapshot' fixes the issue (still investigating)
@etraut-openai Opened a detailed PR (#9388), you have there the repro to replicate it yourself
It definitely is an edge case - but this was introduced in 0.81.0 by #9150 and the #9388 is fixing it
Thanks for the analysis and fix. Yes, shell_snapshot is an experimental feature that is still under active development.
@kfiramar, are you still seeing this issue with the latest version of the CLI?
(response from codex)
Thanks for isolating this to stty sane in your zsh startup file. The CLI now launches shell snapshots without inheriting the TUI's stdin; on Unix the child receives /dev/null in a separate session. That addresses the posted repro where stty resets the live TUI's input mode. The change is present in CLI 0.162.1, and there has been no later reproduction here after the retest request, so we're closing this report. If a current version still fails, please open a new issue with the startup-file repro, terminal version and a /feedback upload.