Skip to content

Terminal output renders garbled on wide/complex TUI content (Windows/WebView2, tiled mixed-repo terminals) #1017

Description

@SmolSmolStar

Summary

Worktree terminal output renders garbled / column-misaligned on wide or complex TUI content (markdown tables, box-drawing, wide Claude Code output). The garble can also re-render into a different misaligned state on its own, with no user input. Reproduced on a clean 0.1.21 install.

Environment

  • Agent Workspace 0.1.21 (fresh Windows NSIS install)
  • Windows 11, desktop app (Tauri / WebView2)
  • Mixed-repo workspace with several tiled worktree terminals (5 worktrees, agent+server pairs)
  • xterm.js 5.3.0 (loaded from CDN)

Symptoms

  • Wide/complex output (tables, box-drawing) renders with misaligned columns / broken layout.
  • Historically it "cleaned up" when scrolling the terminal up and back down (i.e. a repaint fixed it).
  • It can spontaneously re-render into a different garbled state — not user-triggered — consistent with a re-fit/reflow happening in the background.
  • The auto-heal from fix: auto-heal terminal PTY/grid desync (garbled TUI output in worktree terminals) #1003 does not resolve it, and the spontaneous re-render is not auto-heal fixing it.

Possible contributing factors (investigated, not confirmed as root cause)

  1. Renderer fallback to DOM. client/terminal.js (and client/commander-panel.js) pass rendererType: 'canvas', but xterm 5.x removed that option, so terminals fall back to the DOM renderer — which is prone to leaving damaged rows unrepainted until a scroll forces a redraw. That matches the "fixes on scroll" behaviour. (PR fix: use Canvas renderer for terminals so output isn't intermittently garbled #1011 loads the Canvas renderer addon for this; unclear whether it also fixes the wide-content column misalignment, which looks more like a sizing/wrapping problem than a repaint one.)
  2. PTY size vs rendered grid mismatch. The "columns don't line up / jumps on its own" pattern is consistent with the PTY's cols/rows disagreeing with the actual rendered grid width, so the agent wraps at the wrong column. The auto-heal re-fit (client/terminal.js, ~15s interval + on focus/visibility change) may itself re-wrap content into a new (still-wrong) state, which would explain the spontaneous "jumping."
  3. Environment-specific. Windows 11 + WebView2 + a tiled multi-terminal grid; possible fit/measurement timing issues when many terminals share the grid and get resized together.

Best-effort repro

  1. Open a mixed-repo workspace with several tiled worktree terminals on Windows (WebView2 build).
  2. Have an agent emit wide/complex output (a markdown table or a boxed TUI).
  3. Observe misaligned columns; note the layout can change on its own after a few seconds (around the auto-heal interval).

Notes

Happy to gather more detail if useful — e.g. which xterm renderer is actually active at runtime, and the PTY cols/rows vs the terminal element's measured width at the moment of garbling. Filing this from field experience where I couldn't reliably reproduce it outside the packaged Windows/WebView2 build, so a maintainer with more environments may be able to pin the exact cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions