Skip to content

TUI leaves terminal in mouse-reporting/raw mode; keystrokes / mouse events print as ^[[<... after exit or crash #10610

Closed as duplicate

Description

@orangeswim

Description

Summary

After running opencode, my terminal sometimes ends up “stuck” in a broken state where input behaves incorrectly and mouse events / keystrokes print directly into the shell prompt (ex: ^[[<35;62;19M). This looks like the TUI enables mouse reporting / raw mode and doesn’t always restore terminal settings on exit/crash.

What happens

  • The TUI appears to “break” and input starts going outside of the UI.

  • After quitting or killing opencode, the terminal remains messed up:

    • Clicking/scrolling prints escape sequences like:

      ^[[<35;62;19M
      

      (This matches xterm SGR mouse reporting: ESC [ < b ; x ; y M)

    • Shell input becomes unusable until terminal is reset.

Expected behavior

When opencode exits (even after unexpected termination), terminal settings should be restored so the shell behaves normally.

Reproduction steps

  1. Run:

Unable to reproduce consistently. Opencode crash causes issue. I have to close the terminal to stop it.

Evidence / screenshot

After the issue triggers, the terminal prints sequences like:

^[[<35;62;19M ...

Environment

  • opencode version: 1.1.36
  • node: v24.12.0
  • bun: 1.3.6
  • TERM: xterm-256color
  • OS: Ubuntu WSL on Windows 11
  • Install method: bun global install

Notes / suspicion

This looks like terminal modes (raw input + mouse reporting) aren’t being cleaned up on some exit paths (crash, hang, SIGKILL, or parent/child process exit mismatch). The launcher process (node .../opencode) + native binary process might have separate lifecycle/TTY handling, leaving the terminal in mouse-reporting mode.

Plugins

No response

OpenCode version

1.1.36

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

Ubuntu 20.04.6 LTS (Focal Fossa) / WSL Windows 11

Terminal

vscode terminal bash

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 26, 2026
  2. github-actions commented on Jan 26, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    All of these appear to be related to the same root cause: terminal modes (mouse reporting and raw mode) not being properly cleaned up when opencode exits or crashes, particularly with process lifecycle mismatches between the launcher and native binary.

    Feel free to ignore if your specific case differs from these, but they may provide additional context or workarounds.

  3. orangeswim commented on Jan 26, 2026

    @orangeswim
    Author

    I've seen this happen twice now. The model I am using is GLM 4.7 on the z.ai coding plan.

  4. orangeswim commented on Jan 26, 2026

    @orangeswim
    Author

    It looks like my issue is a duplicate of #7861 #8908 #6912

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions