Repository navigation
Description
What version of Codex CLI is running?
codex-cli 0.145.0
What subscription do you have?
Not relevant to terminal input handling.
Which model were you using?
Not model-dependent.
What platform is your computer?
Linux 6.17.0-122035-tuxedo x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
A terminal implementing Kitty keyboard enhancement with alternate-key reporting. The original runtime observation was captured with Shitty 2026.07.23, but the failure can be reproduced directly from the CSI-u input below and does not depend on terminal-specific behavior.
No terminal multiplexer is involved.
Codex doctor report
Not collected; the failure is reproducible in the keyboard-event parser pinned by Codex.
What issue are you seeing?
With a Cyrillic keyboard layout active, physical Ctrl+C and Ctrl+D are not recognized by the Codex TUI when the terminal reports Kitty base-layout keys.
The protocol-level inputs are:
- physical Ctrl+C under the Russian layout:
ESC[1089::99;5:1u - physical Ctrl+D under the Russian layout:
ESC[1074::100;5:1u
In these packets, 1089 and 1074 are the active-layout characters с and в; 99 and 100 are the base-layout characters c and d.
Codex 0.145.0 pins Crossterm 0.28.1 from nornagon/crossterm revision 87db8bfa6dc99427fd3b071681b07fc31c6ce995. Its CSI-u parser reads the primary codepoint but does not retain the third base-layout component. The resulting events are Ctrl+с and Ctrl+в, while Codex matches the shortcuts against ASCII Ctrl+c and Ctrl+d.
The same physical keys work through legacy keyboard encoding when keyboard enhancement is disabled.
What steps can reproduce the bug?
Parser-level reproduction against the Crossterm revision pinned by Codex:
- Pass
b"\x1b[1089::99;5:1u"toparse_csi_u_encoded_key_code. - Observe a Ctrl+с key event; base-layout codepoint
99is not represented in the result. - Pass
b"\x1b[1074::100;5:1u"through the same parser. - Observe a Ctrl+в key event; base-layout codepoint
100is not represented in the result.
Runtime reproduction:
- Run Codex in a terminal that implements Kitty alternate-key reporting.
- Switch to a Russian keyboard layout.
- Press the physical Ctrl+C or Ctrl+D key.
- Observe that the corresponding Codex action is not triggered.
- Start Codex with
CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codexand repeat. The shortcuts are recognized through legacy keyboard encoding.
What is the expected behavior?
Ctrl+C and Ctrl+D shortcuts should remain usable when a non-Latin keyboard layout is active and the terminal supplies the corresponding base-layout key.
Additional information
The missing base-layout support is tracked upstream in Crossterm:
Kitty defines unicode-key-code::base-layout-key and explicitly describes Cyrillic Ctrl+C as a use case:
Pinned parser implementation:
Activity
stdcall commentedon Sep 6, 2026
Still reproducible with Codex CLI 0.153.4 in Ghostty, on both Linux and macOS. The Linux installation is the Ghostty snap package
1.3.2-main-+7e567c3; the macOS Ghostty version was not recorded.Interactive observations:
CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codexrestores the shortcuts in Ghostty. This is a useful diagnostic/workaround, but disables enhanced keyboard handling for other shortcuts too.This also persists with the newer Crossterm fork/revision. The installed Codex binary contains source paths for revision
45fecb9, and current Codex Cargo.toml pinsopenai-oss-forks/crosstermat45fecb9508105988f42fe6ff0441783ed3717f92. Its CSI-u parser still reads the primary codepoint and optionally the shifted codepoint, but does not retain the base-layout codepoint.Separately from the interactive observations, I reproduced the following encoding behavior using the installed Ghostty
libghostty-vtkey-encoder API with synthetic Russian-layout key events (these are encoder outputs, not a capture of live keypresses):DISAMBIGUATE_ESCAPE_CODES | REPORT_ALTERNATE_KEYSс)\x03\x1b[1089::99;5uв)\x04\x1b[1074::100;5uGhostty supplies the base-layout
c/dcorrectly. The same information is lost by the pinned parser even without an explicit:1event type. Codex's current Ghostty-specific keyboard setup requests alternate keys and omits key-event-type reporting for Ghostty.A complete fix should preserve the base-layout code in Crossterm and make it available for Codex shortcut matching while retaining the active-layout character for text input. That would keep Kitty enhancements enabled and avoid per-letter terminal remappings or hardcoded Cyrillic-to-Latin substitutions. The upstream API discussion in crossterm-rs/crossterm#968 is still relevant.
kroekkarawit commentedon Oct 8, 2026
Local fallback tested against the captured packet: A Codex-only selection-copy fallback for
Super+แnow handles the liveESC[3649;9upacket without relying on missing base-layout metadata. Source patch and regression coverage. This is explicitly a Thai-specific compatibility fallback, not a complete keyboard-layout solution.An isolated PTY test with a local mock model metadata server (no real credentials or external model calls) selects fixture draft text, injects the captured packet, and reads the native macOS clipboard. Results:
Copied 15 chars to host clipboard). Existing pasteboard item data is restored after each test.just fmtpassed; all 4 targeted regression tests passed, covering transcript copy delivery, composer copy completion, press/repeat/release, and preservation of plain Thai/other modifier chords.0.0.0while this release builds as0.160.1; reconnect tests also failed, and a nextest reporting error stopped the run. Recorded partial summary: 670 passed, 5 failed, 8 skipped, 4,938 not run. No broad-suite success is claimed.A physical retry of the new binary in Ghostty remains pending. The crossterm Draft PR is a separate alternate-field parser candidate and does not solve the captured no-base-key packet.
Captured live keys: The reporter captured
ESC[99;9ufor English andESC[3649;9ufor Thai in Ghostty 1.3.1 using the same Kitty flags as Codex. These are Super/Cmd events (;9), and the Thai packet has no base-layout field. Consequently this parser candidate cannot fix that captured case. A narrowly scoped Codex selection-copy fallback for Thai Super+แ is being tested locally; this PR remains only a candidate for the independently reproduced alternate-field parser limitation.Live-test update: The reporter tried the patched Codex binary in Ghostty and reports that it still does not resolve the copy failure. The synthetic parser/PTY tests below remain valid, but do not establish the root cause of the live clipboard problem. Keep this as an unconfirmed compatibility candidate while physical key bytes and selection/clipboard behavior are investigated.
I can add a Thai-layout reproduction of this problem on Codex CLI 0.160.1, Ghostty 1.3.1, macOS 27.0 arm64.
My interactive observation concerns copying selected transcript text with the physical Ctrl+C key while the Thai layout is active (Ctrl+แ). It worked before the recent TUI update; I did not record the last known-good version. My comparison:
Separately, I reproduced the parser/shortcut failure with synthetic protocol input. This is not a capture of my physical keyboard:
3649is Thaiแ; the base-layout field99is ASCIIc. Codex 0.160.1 pinsopenai-oss-forks/crosstermatefa177859fd9623d57b9fe7ae9bf491ae1ac6ec4. Its CSI-u parser discards the third field, while the owned-transcript selection copy matcher requiresc.Relevant source:
I built a local candidate patch that uses the printable ASCII base-layout key for non-ASCII Control/Super chords without Alt. An isolated PTY test shows stock Codex ignoring the Thai sequence and exiting on the English sequence; the patched CLI exits successfully on the Thai sequence. Parser unit tests pass: 127 with default features, 139 with
event-stream,serde,osc52(7 ignored in each).I submitted the candidate as a draft against the exact branch Codex pins: openai-oss-forks/crossterm#13
It is deliberately a draft: substituting
KeyEvent.codechanges the semantics of explicit non-ASCII modifier bindings. Preserving both key codes as in crossterm-rs/crossterm#1074 would be a more general solution. Live physical-key capture and patched Ghostty transcript selection-to-clipboard verification are still pending; the successful PTY result verifies shortcut recognition, not clipboard delivery.fix(terminals): send Ctrl+C/V as C0 bytes on the UA layout for kitty-…
etraut-openai commentedon Nov 22, 2026
#35599 — Ctrl+C and Ctrl+D with a Russian keyboard layout
Decision — Defer the Crossterm update. The first fix belongs in Crossterm’s Unix keyboard parser. No Ghostty change is needed for the reported Russian inputs.
Root cause — With Kitty keyboard enhancement enabled, the terminal reports both the active character and the base key. For physical Ctrl+D, Ghostty sends
ESC[1074::100;5u, which includes Cyrillicвand Latind. Crossterm drops the base key, so the TUI sees only Ctrl+вand misses its Ctrl+D binding. Ctrl+C fails the same way because Cyrillicсand Latincare distinct characters.What we verified — We replayed both shortcuts against the parser shipped with Codex CLI 0.171.0. Both failed with and without an explicit key-press type. Applying fork PR #13 to a temporary copy produced the expected Ctrl+C and Ctrl+D events in all four cases and preserved plain Cyrillic input. We tested decoding only, without a live keyboard or clipboard.
Recommended approach when we revisit
в.Scope — The Thai Cmd+C copy report has no base key in the captured packet, so this approach won’t fix it. Windows #55688 uses a separate parser.
Workaround — Reporters restored both Russian shortcuts with
CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codex. This also disables enhanced handling for other shortcuts.issue-proofs: 5 port tests for upstream TUI issues (openai#12882, ope…
land w2-c: openai#35599 Cyrillic ctrl+c tests un-ignored (green on th…