Skip to content

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

@RaymondGuoCGI

Description

@RaymondGuoCGI

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

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