anomalyco / anomalyco/opencode

TUI: stale/duplicated text after long sessions in embedded terminals (Orca); full buffer clear fixes it longer than partial redraw

Open
#49,307 0 comments 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Sep 16, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

During long sessions the TUI screen gradually "falls apart": duplicated/stale fragments of text overlap current content, similar to #41458, #47255, #48714, but it appears after a long session (lots of streamed output) rather than immediately.

Observed environment:

  • macOS (Apple Silicon), Orca (Electron-based IDE with an embedded xterm.js terminal), Orca terminal pane as the only "terminal"
  • opencode 1.18.30 (Homebrew, brew install opencode)
  • No tmux, no plugins involved in the rendering itself

Workarounds and their effect:

  1. ctrl+p (command list) — opens a dialog, forces a full TUI redraw; fixes the screen but only briefly.
  2. Full terminal buffer clear (Orca keybinding terminal.clear, Mod+K — clears the xterm.js pane incl. scrollback via the PTY) — fixes it for a much longer time.

The difference between (1) and (2) suggests the corruption accumulates in the terminal emulator's scrollback buffer (garbage from many incremental TUI redraws), and a TUI-side redraw alone can't get rid of it — only wiping the emulator buffer does.

Questions / hypotheses:

  • Is there a way to force a full repaint from a clean screen state (e.g. re-emit the whole screen instead of relative cursor updates) via a keybind or env var?
  • Should the TUI periodically do a full absolute re-render, or emit a clear-sequence when it detects its cursor model may have desynced from the terminal?

Steps to reproduce:

  1. Run opencode in an embedded/web terminal (Orca, or any xterm.js-based embed)
  2. Have a long session with lots of streamed responses
  3. Watch for overlapping/stale text; confirm ctrl+p fixes briefly, full terminal buffer clear fixes for longer

OpenCode version: 1.18.30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.