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

Closed
opened 2026-02-16 17:29:04 -05:00 by yindo · 6 comments
Owner

Originally created by @sam-fredrickson on GitHub (Jul 31, 2025).

Originally assigned to: @adamdotdevin on GitHub.

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.

Originally created by @sam-fredrickson on GitHub (Jul 31, 2025). Originally assigned to: @adamdotdevin on GitHub. 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 ```bash $ 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: ```bash $ 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.
yindo closed this issue 2026-02-16 17:29:04 -05:00
Author
Owner

@hgoumner commented on GitHub (Aug 6, 2025):

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

@hgoumner commented on GitHub (Aug 6, 2025): I have the same issue on Fedora + kitty + zsh + opencode 0.3.131. Thanks for the tip with the workaround :).
Author
Owner

@ThomasGHenry commented on GitHub (Aug 19, 2025):

macos, wezterm, tmux, fish

cursor animation leaks to shell after closing opencode

@ThomasGHenry commented on GitHub (Aug 19, 2025): macos, wezterm, tmux, fish cursor animation leaks to shell after closing opencode
Author
Owner

@benjivm commented on GitHub (Oct 25, 2025):

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.

@benjivm commented on GitHub (Oct 25, 2025): 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.
Author
Owner

@rekram1-node commented on GitHub (Oct 25, 2025):

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

@rekram1-node commented on GitHub (Oct 25, 2025): about to ship a rewrite of the tui and it should address these issues
Author
Owner

@benjivm commented on GitHub (Nov 4, 2025):

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

@benjivm commented on GitHub (Nov 4, 2025): @rekram1-node The update with the TUI changes resolved these issues for me, thanks!
Author
Owner

@rekram1-node commented on GitHub (Nov 4, 2025):

Nice

@rekram1-node commented on GitHub (Nov 4, 2025): Nice
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1006