Skip to content

Bug: Ctrl+C interruption in opencode causes terminal corruption with ANSI escape sequences #5990

@estudiochapunov

Description

@estudiochapunov

Description

When using opencode CLI, pressing Ctrl+C (intended as Esc) interrupts the session, leading to terminal corruption. After interruption, cursor/mouse movements display corrupted ANSI escape sequences (e.g., [^[[H for cursor home, [^[[2J for clear screen). The screen remains with opencode content, but keyboard partially loses control.

Upon closing and reopening the terminal, opencode is no longer in PATH (even though set persistently), requiring manual re-addition.

Steps to Reproduce

  1. Start opencode in CMD or PowerShell.
  2. During session, press Ctrl+C to interrupt.
  3. Observe terminal corruption (ANSI escape codes on cursor/mouse input).
  4. Close and reopen terminal.
  5. opencode command not found.

Environment

  • OS: Windows 11 Home (build 10.0.26220)
  • Terminal: CMD / PowerShell 7.5.4
  • opencode version: 1.0.186
  • PATH includes opencode via setx

Expected Behavior

Ctrl+C should cleanly exit without corrupting terminal or affecting PATH persistence.

Actual Behavior

Terminal corrupted with ANSI escapes, PATH changes not applied after restart.

Additional Notes

Issue may relate to signal handling or terminal integration on Windows. PATH persistence via setx works in normal cases.

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentuiwindows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions