Skip to content

Terminal state corruption after opencode exit - spurious sequences on Ctrl-* inputs #1455

Closed

Description

@sam-fredrickson

After launching opencode and exiting, pressing control key combinations (Ctrl-C, Ctrl-D, etc.) produces spurious sequences like 9;5u 0;5u 7;5u 6;5u ;5u. Regular typing works normally.

Reproduction

$ opencode
# Exit opencode
# Press Ctrl-C, Ctrl-D, or other Ctrl-* combinations
$ 9;5u 0;5u 7;5u 6;5u ;5u
# Running reset resolves the problem
$ reset
$ ^C
$

This occurs even in minimal shell environments:

$ env -i PATH="/etc/profiles/per-user/sam/bin" bash --norc --noprofile
bash-5.3$ opencode
# Press Ctrl-C
bash-5.3$ 9;5u

Environment

  • opencode version: 0.3.85
  • OS: macOS
  • Terminal: Alacritty
  • Package manager: Nix (unstable)

Shell compatibility

  • ✅ Affected: bash, zsh, sh
  • ❌ Not affected: fish

Workaround

Running reset restores normal terminal behavior.

Technical note

The sequences suggest enhanced keyboard reporting mode isn't being properly disabled on exit, specifically affecting how control sequences are interpreted.

Activity

  1. hgoumner commented on Aug 6, 2025

    @hgoumner

    I have the same issue on Fedora + kitty + zsh + opencode 0.3.131. Thanks for the tip with the workaround :).

  2. ThomasGHenry commented on Aug 19, 2025

    @ThomasGHenry

    macos, wezterm, tmux, fish

    cursor animation leaks to shell after closing opencode

  3. benjivm commented on Oct 25, 2025

    @benjivm

    I believe this is the same thing causing the inability to use arrow keys after exit (WezTerm on macOS) after exit, since the cursor is animated the way it is in the OpenCode UI.

    Typing reset fixes these issues.

  4. rekram1-node commented on Oct 25, 2025

    @rekram1-node
    Collaborator

    about to ship a rewrite of the tui and it should address these issues

  5. benjivm commented on Nov 4, 2025

    @benjivm

    @rekram1-node The update with the TUI changes resolved these issues for me, thanks!

  6. rekram1-node commented on Nov 4, 2025

    @rekram1-node
    Collaborator

    Nice

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions