Skip to content

[FEATURE] opt-out for the Kitty keyboard protocol (env or config) — terminals that mishandle it corrupt input #51086

Closed as not planned

Description

@benjaminbelaga

Problem

OpenCode 1.18.32 (OpenTUI) always pushes the Kitty keyboard protocol at startup. In packages/tui/src/app.tsx:199 the option is hardcoded:

useKittyKeyboard: {}

There is no flag, env var, or config key to disable it.

Some terminals acknowledge the negotiation but still emit legacy key encodings. In those, arrow keys arrive as ESC[A / ESC[B and are inserted into the prompt as literal text (^[[A), and Enter submission becomes unreliable. Concrete, reproducible case: cmux 0.64.25 → manaflow-ai/cmux#14197.

OPENCODE_DISABLE_MOUSE already exists as the precedent for this kind of escape hatch. A keyboard equivalent would let users work around terminals that mishandle the protocol instead of being blocked.

Proposed

Add an opt-out, e.g.:

  • env OPENCODE_DISABLE_KITTY_KEYBOARD=1, and/or
  • a tui.json key such as {"keyboard": {"kitty": false}}.

Environment

  • OpenCode 1.18.32, macOS (Apple Silicon)
  • Terminal: cmux 0.64.25 (bundled Ghostty pin 4a0e9e1)
  • Same OpenCode version works in iTerm2.

References

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up and the link to the cmux bug.

    This report is about OpenCode 1.18.32, which is v1. v1 now only gets fixes for critical bugs such as data loss, security issues or crashes with no workaround. Here the bug is on the terminal side (manaflow-ai/cmux#14197) and other terminals like iTerm2 work, so a new opt-out in v1 is unlikely to be added.

    We'd encourage you to upgrade to v2 (@opencode/cli, the opencode command). v2 also turns on the Kitty keyboard protocol by default and doesn't have an opt-out yet. If you see the same input problem in cmux on v2, please reply here with your v2 version (opencode --version), and the request can be considered for v2. Please also reply if you think this is critical for v1.

  2. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Closing this as not planned. The report is about OpenCode 1.18.32 (v1), which only gets fixes for critical bugs. A Kitty keyboard opt-out for a terminal-side bug (manaflow-ai/cmux#14197) isn't one of those, and we haven't heard back since the last comment.

    v2 also turns on the Kitty keyboard protocol by default. If you hit the same input problem in cmux on v2, please open a new issue with your opencode --version output and we can consider an opt-out there. Thanks again for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions