Kitty: Ctrl-C exit can leave keyboard protocol fragments in zsh
What version of Codex is running?
codex-cli 0.144.0
What platform is your computer?
macOS arm64
What terminal emulator and shell are you using?
- Terminal: Kitty
- Shell: zsh
codex doctor shows:
Codex Doctor v0.144.0 · macos-aarch64
terminal kitty
What issue are you seeing?
Sometimes after I exit Codex with Ctrl-C, the terminal seems to be left in a bad keyboard input state.
Right after Codex returns me to zsh, if I press Up and then Enter, zsh tries to run raw fragments like this:
~ v3.14.4 v25.9.0 8s
❯ 9;5:3u9;5u9;5:3u9;5u9;5:3uclear
zsh: command not found: 9
zsh: command not found: 5:3u9
zsh: command not found: 5u9
zsh: command not found: 5:3u9
zsh: command not found: 5u9
zsh: command not found: 5:3uclear
~ v3.14.4 v25.9.0
❯
The 9;5:3u / 9;5u pieces look like tails of Kitty keyboard protocol / CSI-u sequences. My guess is that Codex enables enhanced keyboard reporting while the TUI is running, but does not always restore it cleanly when exiting via Ctrl-C.
Steps to reproduce
I do not have a perfect minimal repro yet, but this is the path where I see it:
- Open Kitty with zsh.
- Run:
``bash``
codex
- Use Codex normally for a bit.
- Press Ctrl-C to exit/interupt the Codex TUI.
- Back at the zsh prompt, press Up.
- Press Enter.
Expected behavior
After Codex exits, zsh should behave normally.
Pressing Up should recall shell history. It should not insert or execute raw keyboard protocol fragments.
Actual behavior
zsh receives raw fragments such as:
9;5:3u
9;5u
and tries to execute parts of them as shell commands.
Extra context
This looks related to these existing reports, but my environment is native Kitty locally rather than VS Code Remote SSH or iTerm2:
- #24026
- #19553
Running one of these manually gets the terminal back to normal:
printf '\033[<10u'
or:
reset
So this seems like a terminal cleanup issue on Codex exit, especially the Ctrl-C path.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗