Skip to content

[Bug] Terminal corrupted with raw ANSI escape sequences after killing Node processes on Windows (PowerShell) #20224

Description

@ogarridojimenez

Description

Describe the bug
When OpenCode exits or kills Node processes (e.g., when closing a session),
the terminal becomes corrupted. Raw ANSI escape sequences like
16M[555;35;24M[555;37 are printed directly to the terminal instead of
being interpreted as colors/formatting. The terminal becomes unusable and
the only fix is to open a new terminal window.

To Reproduce

  1. Open OpenCode in PowerShell on Windows
  2. Run a session that spawns Node processes
  3. Kill or close the session (Ctrl+C or taskkill)
  4. Observe terminal output flooding with raw ANSI sequences

Expected behavior
OpenCode should restore the terminal state on exit by calling the
appropriate cleanup (e.g., tput reset equivalent or restoring the
alternate screen buffer with \033[?1049l and resetting color with \033[0m).

Actual behavior
Terminal is left in a broken state with raw ANSI escape sequences
printed as plain text. reset and tput are not available on Windows
PowerShell, so recovery requires opening a new terminal.

Environment

  • OS: Windows 11
  • Terminal: PowerShell
  • OpenCode version: [your version here]

Screenshots
[attach your screenshots here]

Plugins

No response

OpenCode version

1.2.25

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Power Shell

Activity

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