fix(tui): avoid modifyOtherKeys for unknown tmux formats#24371
Merged
Conversation
This comment was marked as spam.
This comment was marked as spam.
canvrno-oai
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Codex 0.131 started enabling tmux
modifyOtherKeysmode 2 when the active tmux session reportedextended-keys-format csi-u, and also when that format could not be queried. The fallback was meant to help compatible tmux panes enter extended-key mode, but it breaks iTerm2 control-mode sessions on older tmux.Issue #23711 reproduces with:
ssh -t ubuntu@192.168.68.149 'tmux -CC new -A -s main'On tmux 3.2a,
extended-keys-formatis not available. With mode 2 enabled,Ctrl-Cis delivered as^[[27;5;99~instead of the normal interrupt/control key path, so Codex does not handle it. Running withCODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1restoresCtrl-C, which points at keyboard mode setup rather than chat input routing.What Changed
modifyOtherKeysmode 2 when tmux explicitly reportsextended-keys-format csi-u.Noneno longer opts intomodifyOtherKeys.This preserves the explicit modern tmux
csi-upath from #21943 while avoiding the unsafe fallback on older or unqueryable tmux setups.How to Test
Regression path from #23711:
ssh -t ubuntu@192.168.68.149 'tmux -CC new -A -s main'/keymap debug, press a regular key, then pressCtrl-C.Ctrl-Ccloses the inspector and Codex remains responsive withoutCODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1.Shift+Enterstill inserts a newline in the same session.Modern tmux compatibility path:
csi-u:mode=Ext 2:tmux -L codex-csiu list-panes -a -F '#{pane_id} mode=#{pane_key_mode} cmd=#{pane_current_command}'one, pressShift+Enter, typetwo, and confirm the composer shows two lines without submitting.Ctrl-Cand confirm Codex handles it normally.Targeted tests:
./tools/argument-comment-lint/run.py -p codex-tui -- --libjust test -p codex-tuiruns the new keyboard mode test successfully; the full run currently reports two unrelated guardian feature-flag test failures:app::tests::update_feature_flags_disabling_guardian_clears_manual_review_policy_without_historyapp::tests::update_feature_flags_disabling_guardian_clears_review_policy_and_restores_defaultNo documentation update is needed.