Skip to content

VS Code integrated terminal over SSH leaks kitty keyboard protocol sequences after exiting Codex (e.g. 9;1:3u) #24026

Description

@Wunrry

What version of Codex is running?

codex-cli 0.133.0

What platform is your computer?

Local machine:

  • VS Code integrated terminal over Remote SSH
  • VS Code terminal setting: terminal.integrated.enableKittyKeyboardProtocol = true
  • TERM_PROGRAM_VERSION=1.121.0

Remote machine:

  • Debian GNU/Linux 13 (trixie)
  • Linux 6.12.88+deb13-amd64 x86_64
  • Shell: bash
  • TERM=xterm-256color
  • TERM_PROGRAM=vscode

What steps can reproduce the bug?

  1. Open a fresh VS Code integrated terminal connected to a Linux host via SSH.
  2. Start codex.
  3. Exit codex.
  4. Press Tab in the shell.

This reproduces consistently in a fresh SSH session.

What is the expected behavior?

After exiting Codex, the shell should return to normal terminal input behavior and pressing keys like Tab should not print raw escape-sequence fragments.

What do you see instead?

After exiting Codex, the shell prints raw fragments such as:

9;1:3u

Sometimes I also see:

9;5:3u

These appear to correspond to kitty keyboard protocol key release events leaking into the shell instead of being fully cleaned up on exit.

Additional information

  • This does not appear to be a VPS locale/encoding problem.
  • The issue disappears if I disable the local VS Code setting:
"terminal.integrated.enableKittyKeyboardProtocol": false
  • I tested this in a fresh SSH session and can reproduce it reliably by entering and exiting Codex.
  • I also tested a Bash-side workaround that tried to reset keyboard enhancement flags on each prompt, but it did not reliably fix the problem in VS Code's integrated terminal.
  • This suggests an interoperability issue between Codex terminal cleanup on exit and VS Code/xterm.js kitty keyboard protocol handling.

Minimal environment evidence

codex-cli 0.133.0
Debian GNU/Linux 13 (trixie)
Linux 6.12.88+deb13-amd64 x86_64 GNU/Linux
TERM=xterm-256color
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.121.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't workingremote

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions