Terminal output becomes garbled after running for a while and also when pressing Ctrl+C #8814

Closed
opened 2026-02-16 18:10:55 -05:00 by yindo · 2 comments
Owner

Originally created by @RaymondGuoCGI on GitHub (Feb 8, 2026).

Originally assigned to: @kommander on GitHub.

Description

The terminal output becomes garbled in two different situations:

  1. After Opencode has been running for a period of time, even without any interruption
  2. When pressing Ctrl+C to interrupt the process

In both cases, the terminal starts printing raw ANSI escape sequences, and the screen becomes unreadable.

Image

Steps to reproduce

Case 1: After running for a while

  1. Run Opencode in a Windows terminal
  2. Let it run for some time during normal operation
  3. Observe that the terminal output gradually becomes garbled

Case 2: After pressing Ctrl+C

  1. Run Opencode in a Windows terminal
  2. Press Ctrl+C while it is running
  3. Observe that the terminal output immediately becomes garbled

Expected behavior

The terminal output should remain readable during long-running sessions,
and the terminal state should be properly restored after Ctrl+C.

Actual behavior

The terminal enters a corrupted state and continues printing raw ANSI escape codes.

Environment

  • OS: Windows
  • Terminal: Windows Terminal (or cmd / PowerShell)
  • Opencode version: (please fill in)
  • Model / Agent: GPT-5.3 Codex / Sisyphus

Additional notes

This appears to be related to terminal state management.
The terminal may be left in raw mode or not properly reset,
both during long-running execution and after handling SIGINT.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @RaymondGuoCGI on GitHub (Feb 8, 2026). Originally assigned to: @kommander on GitHub. ### Description The terminal output becomes garbled in two different situations: 1. After Opencode has been running for a period of time, even without any interruption 2. When pressing **Ctrl+C** to interrupt the process In both cases, the terminal starts printing raw ANSI escape sequences, and the screen becomes unreadable. <img width="1113" height="626" alt="Image" src="https://github.com/user-attachments/assets/c92d5e1d-8918-44b4-9647-9743afee1a97" /> ### Steps to reproduce #### Case 1: After running for a while 1. Run Opencode in a Windows terminal 2. Let it run for some time during normal operation 3. Observe that the terminal output gradually becomes garbled #### Case 2: After pressing Ctrl+C 1. Run Opencode in a Windows terminal 2. Press **Ctrl+C** while it is running 3. Observe that the terminal output immediately becomes garbled ### Expected behavior The terminal output should remain readable during long-running sessions, and the terminal state should be properly restored after Ctrl+C. ### Actual behavior The terminal enters a corrupted state and continues printing raw ANSI escape codes. ### Environment - OS: Windows - Terminal: Windows Terminal (or cmd / PowerShell) - Opencode version: (please fill in) - Model / Agent: GPT-5.3 Codex / Sisyphus ### Additional notes This appears to be related to terminal state management. The terminal may be left in raw mode or not properly reset, both during long-running execution and after handling SIGINT. ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the windowsopentuibug labels 2026-02-16 18:10:55 -05:00
yindo closed this issue 2026-02-16 18:10:55 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 8, 2026):

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

  • #12663: Terminal output becomes garbled after running for a while and also when pressing Ctrl+C (closed)
  • #6912: Ctrl+C does not disable mouse tracking, causing raw escape sequences to flood terminal (Windows)
  • #8159: Bug: Ctrl+C causes terminal UI rendering overlap on Windows Terminal (v1.1.16)
  • #10719: Terminal state not restored when exiting with ctrl+c on windows (git bash)
  • #7861: macOS: Terminal becomes unusable after opencode exits ("dead terminal")
  • #10265: Ctrl+C during response causes terminal to print endless garbage and become unresponsive
  • #5181: Input sometimes starts to only show ASCII escape codes
  • #7062: Pressing Ctrl+C in input field outputs ANSI escape sequences/garbled text
  • #10783: OpenCode Crashes then outputs garbled tokens
  • #11748: After closing the OpenCode CLI, scrolling the mouse wheel and moving the mouse in the powershell will cause garbled characters

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 8, 2026): This issue might be a duplicate of existing issues. Please check: - #12663: Terminal output becomes garbled after running for a while and also when pressing Ctrl+C (closed) - #6912: Ctrl+C does not disable mouse tracking, causing raw escape sequences to flood terminal (Windows) - #8159: Bug: Ctrl+C causes terminal UI rendering overlap on Windows Terminal (v1.1.16) - #10719: Terminal state not restored when exiting with ctrl+c on windows (git bash) - #7861: macOS: Terminal becomes unusable after opencode exits ("dead terminal") - #10265: Ctrl+C during response causes terminal to print endless garbage and become unresponsive - #5181: Input sometimes starts to only show ASCII escape codes - #7062: Pressing Ctrl+C in input field outputs ANSI escape sequences/garbled text - #10783: OpenCode Crashes then outputs garbled tokens - #11748: After closing the OpenCode CLI, scrolling the mouse wheel and moving the mouse in the powershell will cause garbled characters Feel free to ignore if none of these address your specific case.
Author
Owner

@Hona commented on GitHub (Feb 12, 2026):

ctrl+c handling is now in as of 1.1.60

@Hona commented on GitHub (Feb 12, 2026): ctrl+c handling is now in as of 1.1.60
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8814