Dead keys break in VS Code Remote SSH terminal on Linux
What issue are you seeing?
Follow-up to #13638: dead-key accent composition can still fail inside Codex when VS Code is attached to a native Linux host through Remote SSH. The new report in https://github.com/openai/codex/issues/13638#issuecomment-4458442938 reproduces this on an aarch64 Raspberry Pi + VS Code Remote SSH session, where the escape sequence ^[[13;1:3u leaks into the terminal and dead keys such as circumflex and grave do not produce accented characters.
What steps can reproduce the bug?
- Connect to a native Linux host through VS Code Remote SSH.
- Open the integrated terminal on that remote host.
- Run
codex. - Type a dead-key combination such as circumflex or grave followed by a vowel.
What is the expected behavior?
Dead-key composition should match the same VS Code terminal outside Codex.
Additional information
The current workaround is CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codex. The suspected follow-up is to skip crossterm keyboard enhancement flags for Linux VS Code terminals, not just the original WSL + VS Code path fixed by #18741.
I tried to reproduce this more narrowly on an Ubuntu 24.04 ARM64 VM with the desktop set to US International dead keys.
Tested:
- VS Code running locally on the Ubuntu VM
- VS Code Remote SSH from that Ubuntu VS Code instance back to
[email protected] - the patched branch
- the forced old path with
CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=0 - stable Codex
Dead-key composition worked in both the local and Remote SSH VS Code terminals on that setup, so I still do not have evidence that all Linux VS Code terminals need the WSL workaround.
Could you share the exact failing setup:
- client OS/distro and desktop session on the Raspberry Pi
- keyboard layout/input source
- VS Code version/build
- whether
CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codexfixes it - the output of
echo "$TERM_PROGRAM" - and, if possible, the raw bytes from a failing terminal with
cat -vafter pressing the dead-key sequence
If we can get one distinguishing detail from the failing Raspberry Pi path, we can target the fix instead of widening the current WSL-only workaround speculatively.
Thanks for investigating, @fcoury-oai. Here's the exact failing setup and what we discovered:
Exact Failing Setup
- Client: Windows 11 (native, not WSL) via Remote SSH
- Remote Host: Debian GNU/Linux Bookworm, aarch64 (Raspberry Pi)
- Kernel: 6.12.75+rpt-rpi-2712
- Keyboard Layout: French AZERTY with dead keys (circumflex
^, grave`, etc.) - VS Code: Latest (via Remote SSH shell integration)
- TERM_PROGRAM:
vscode
The Problem
Dead keys didn't work in Codex CLI on this setup. Typing ^ o would leak escape sequences and produce just o instead of ô.
Root Cause
The keyboard_modes.rs code had this logic:
let is_vscode_terminal = is_wsl && running_in_vscode_terminal();
On a native Linux system (like this Debian Pi), is_wsl() returns false. So even though running_in_vscode_terminal() would correctly detect VSCode, the entire condition evaluated to false, leaving keyboard enhancement enabled.
With keyboard enhancement active in VSCode Remote SSH, the kitty protocol breaks dead key composition in the PTY forwarding through SSH.
The Fix (from PR #13638)
Removing the is_wsl && guard:
let is_vscode_terminal = running_in_vscode_terminal();
Now it correctly detects VSCode on any Linux system, not just WSL. When running in VSCode (with TERM_PROGRAM=vscode present), keyboard enhancement disables automatically, and dead keys compose correctly.
Confirmation
✅ With the patch: ^ o → ô (works correctly)
✅ TERM_PROGRAM=vscode is properly detected on Remote SSH
✅ No WSL involved — issue applies to any VSCode Remote SSH session to native Linux
Why Your Ubuntu Test Succeeded
On Ubuntu, the same detection would have worked if TERM_PROGRAM=vscode was set. The distinguishing detail is that the guard condition was the blocker, not the detection itself — it only worked on WSL, not on native Linux Remote SSH.
The patch broadens the fix to cover all VSCode terminal scenarios, not just WSL-specific ones.
Does this cover all the details you needed? Let me know if you need any additional information to validate the fix.
(response from codex)
Thanks for narrowing this down, @yaco16. Updating VS Code on your Windows machine to 1.123.0 or later should fix this. That release includes an xterm.js fix for how the terminal reports keystrokes.
I replayed ^ then o with Codex’s default keyboard settings. The terminal library in VS Code 1.122.0 dropped ô and sent the exact ESC[13;1:3u sequence you saw when Enter was released. In 1.123.0 and 1.147.0, the same replay produced ô and sent nothing on Enter release.
I tested with simulated keystrokes, so I haven’t verified the full Windows AZERTY → Remote SSH → Raspberry Pi setup. If you can’t update yet, CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codex is a workaround, though Shift+Enter may behave like Enter.
I’m closing this as fixed upstream. If it still happens in a fresh Remote SSH terminal after updating, please comment with your exact VS Code version and what ^ then o produces with the workaround unset.