anomalyco / anomalyco/opencode
TUI: stale/duplicated text after long sessions in embedded terminals (Orca); full buffer clear fixes it longer than partial redraw
@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:
ctrl+p(command list) — opens a dialog, forces a full TUI redraw; fixes the screen but only briefly.- 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:
- Run opencode in an embedded/web terminal (Orca, or any xterm.js-based embed)
- Have a long session with lots of streamed responses
- Watch for overlapping/stale text; confirm
ctrl+pfixes briefly, full terminal buffer clear fixes for longer
OpenCode version: 1.18.30
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.