orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: Scrolling in agent/terminal panes causes duplicated/garbled text and panel content overlap (Windows + WSL)

Open jrleyva opened this issue 5 months ago • 6 comments

Operating system

Windows

Orca version

v1.4.66.0

Details

Windows + WSL2 (Ubuntu) — Ubuntu 22.04.2 LTS

When scrolling inside an agent conversation pane (and also inside a terminal pane running an interactive TUI such as OpenCode), the rendered text becomes visually corrupted. This happens on a project opened from the WSL filesystem mapped to the Windows drive (path /mnt/c/Users//Documents/Proyectos/).

Two distinct visual glitches were captured in the same scroll session:

Duplicated lines — every visible line of the agent's response gets rendered twice, one copy directly below the other, as if the previous frame wasn't cleared before the new scroll position was painted (see 01_text_duplicated_lines.png). Cross-panel content bleed / tearing — content from the right-hand sidebar (Context / Modified Files / MCP status) overlaps the main conversation/terminal pane at incorrect horizontal offsets, mixing text from different panels and different scroll positions into a torn/garbled mess (see 02_panel_content_bleed.png, 03_panel_content_bleed_2.png, and scroll_distortion.gif).

Steps to reproduce

Open a project located on the WSL filesystem under the Windows drive mount, e.g. /mnt/c/Users//Documents/Proyectos/. Open an agent conversation panel that has a long scrollback (many sections of text), and/or a terminal pane running an interactive TUI agent (e.g. opencode). Scroll up/down with the mouse wheel inside that pane, especially with the right sidebar panel also visible. Observe the rendering glitches described above appearing while scrolling.

Expected behavior Scrolling should redraw the pane cleanly — no duplicated lines, and no bleed-through from neighboring panels.

Actual behavior Text is duplicated and/or panels visually overlap/tear during and right after scrolling, as shown in the attached screen recording and screenshots.

Image Image Image Image

Video: https://pucp-42.wistia.com/s/e7brnteh2daf2bm

jrleyva avatar Jun 14 '26 07:06 jrleyva

Got a root cause on this one. It's a ConPTY/xterm wrap mismatch, not a renderer problem.

On Windows builds below 21376, node-pty defaults to the system ConPTY, which doesn't emit soft-wrap markers. xterm gets handed the OS build number and falls back to its lossy wrap-reconstruction heuristic, which marks ANY full-width row as wrapped. Agent TUIs draw full-width status and box-drawing lines constantly, so those get mis-flagged. On resize, xterm reflows on the bad flag and splices neighboring rows into each other, then freezes that garble into scrollback. The live viewport looks fine. Only scrolled-back content is wrecked.

I'm on Windows 10 build 19045, right in the affected range.

Repro:

  1. Open an agent pane (or any pwsh pane with a full-width prompt).
  2. Print a line wider than the window: python -c "print('X'*400)"
  3. Drag the window narrower, then wider.
  4. Scroll up. The X line and the prompt/status row are spliced together.

Candidate fix is two parts, and you need both:

  1. Renderer: stop passing buildNumber to xterm when it's below 21376, so xterm's wrap heuristic stays off. The guard in CoreTerminal _handleWindowsPtyOptionChange only arms the heuristic when buildNumber is defined and < 21376.
  2. Daemon spawn: set useConptyDll: true on the win32 pty.spawn, so node-pty uses its bundled modern ConPTY, which actually emits wrap markers.

Renderer-only isn't enough. I tested it. With the heuristic off but the system ConPTY still emitting no markers, xterm has nothing to reflow with and the wide line still garbles on resize. The marker source has to change too.

One thing I haven't confirmed: that node-pty 1.1.0's bundled conpty.dll actually emits soft-wrap markers at runtime. The option exists in the typings and it's the obvious lever, but I couldn't get a clean live verification (my build kept freezing before I could test a fresh spawn). If someone with a stable setup can confirm the bundled DLL marks wraps, that closes it.

Happy to open a PR if the approach looks right.

Thanks!

VibeCodyH avatar Jun 19 '26 18:06 VibeCodyH

@CodyPHarris if this is still happening, I would be happy to review any PR to resolve this! Otherwise will try to reproduce and fix this myself when I get the chance

Jinwoo-H avatar Jun 26 '26 00:06 Jinwoo-H

Still reproduces on Orca v1.4.101 (current stable). Flagging it since you asked today whether it's still happening — the recent 1.4.100/101 terminal work (the link-detection ReDoS freeze) doesn't touch this one.

I'm hitting it on native Windows, no WSL anywhere in my setup, which backs up @CodyPHarris's read that it's the ConPTY soft-wrap mismatch and not the WSL /mnt/c path mapping from the original report:

  • Windows 10, build 19045 — below the 21376 cutoff, so xterm's wrap heuristic is always armed here
  • Pane running Claude Code's TUI: constant full-width status and box-drawing rows, exactly the input that trips the heuristic

The signature matches: the live view at the bottom stays clean, and the garble only shows in scrollback when I scroll up, with box-drawing/status rows spliced into their neighbours. It appears right after a window resize / maximize / split-divider drag, which fits the reflow-on-bad-wrap-flag mechanism Cody described.

Both levers check out against current source: xterm's _handleWindowsPtyOptionChange arms the heuristic on backend === 'conpty' && buildNumber < 21376, and node-pty does expose useConptyDll to swap in its bundled conpty.dll. So the two-part fix looks right. I couldn't verify the bundled DLL actually emits wrap markers at runtime though, hit the same freeze Cody mentioned.

taifunk avatar Jun 26 '26 20:06 taifunk

Quick check-in for anyone still hitting this:

Since this was filed we’ve landed a lot of Windows terminal rendering work aimed at the ConPTY/xterm wrap/CJK failure mode (including #6890 — stop feeding old build numbers into xterm’s windowsPty wrap heuristic, force viewport refresh for East Asian wide glyphs from agent output, and use bundled ConPTY for daemon-owned Windows PTYs so wrap markers stay consistent).

If you’re on a recent Orca build, are scrolling / full-width status lines / CJK agent panes still garbled or duplicated for you?

  • If yes: please reply with current Orca version, Windows build (winver), native vs WSL project path, and whether it’s still reproducible on the latest stable — that’ll help us tell residual cases from the pre-fix ones.
  • If no / much better: a short “looks good on …” is enough and we can close this out.

nwparker avatar Jul 16 '26 06:07 nwparker

Agent reproduction package (Windows orchestration 2026-07-16)

Host context: Windows 11 / Orca 1.4.143.0 / repo path used: docs/bug-reproductions/
Labels applied: see issue labels (has_repro or cannot_repro).
Security: Do not run user-uploaded binaries from issue attachments. Recreate fixtures from the steps/scripts below.


Issue 5345 — Scrolling causes duplicated/garbled text (Windows)

Status: fixed_candidate (this host / current tree)
Host: Windows 11 build 26200.8875, Orca 1.4.143.0
Label: (not has_repro — original failure mode gated off here)
URL: https://github.com/stablyai/orca/issues/5345

Summary

Original: scroll/resize garble, duplicated lines, panel bleed (WSL path report). Community RCA: ConPTY soft-wrap mismatch + xterm wrap heuristic when windowsPty.buildNumber < 21376.

Maintainer check-in (nwparker, 2026-07-16): Windows terminal work including #6890 — stop feeding old build numbers into xterm wrap heuristic; bundled ConPTY for daemon PTYs.

Verification on this host

Check Result
OS build 26200 (≥ 21376) → xterm wrap heuristic not armed when buildNumber is passed
useConptyDll: true Present in pty-subprocess.ts and local-pty-utils.ts
buildXtermWindowsPtyOptions Omits buildNumber when < 21376 or undefined; this host passes buildNumber (safe)
Unit tests windows-pty-compatibility.test.ts — 18/18 passed (includes “omits old Windows build numbers that enable xterm legacy wrap heuristics”)

Evidence:

  • docs/bug-reproductions/evidence/5345-meta-*.json
  • Vitest run on 2026-07-16 (local)

Manual garble stress (partial)

Printed a wide line via python -c "print('X'*400)" in a PowerShell pane. Full resize/scroll visual check needs human eyes / screenshot permission (computer-use screenshot failed on this desktop).

Expected vs actual (current main + Win11 26200)

Pre-fix (Win10 < 21376 + system ConPTY) Scrollback garble after resize
This host Fix path present; unit coverage green; not in the classic build-number failure window

Residual risk

  • Hosts still on Windows build < 21376 without bundled ConPTY path active.
  • Non-wrap glitches (WebGL overlay #8289, tab-reveal #7240) are separate.
  • Reporter feedback still requested on issue for residual cases on latest stable.

Label

Do not mark has_repro on this machine. Prefer closing after field confirmation, or keep open for residual reports only.


How another agent should use this

  1. Read this comment fully (status, expected vs actual, blockers).
  2. If a script is included above, copy it to a temp file and run it on a Windows 11 host with Orca installed (prefer production install under %LOCALAPPDATA%\Programs\orca).
  3. Capture evidence (CLI --json, screenshots, logs) under a local folder; optionally comment results back here.
  4. If status is cannot_repro / needs_setup, satisfy the listed prerequisites first, then re-attempt and flip labels: remove cannot_repro, add has_repro when conclusive.

OrcaWin avatar Jul 17 '26 00:07 OrcaWin

Closing for now because the July 16 follow-up asking for current Orca version, Windows build, native/WSL path and latest-stable reproduction has not received an affected-user reply in over three months. The earlier Windows wrap/CJK work shipped in #6890, but the later test-host comment did not exercise the original older-Windows failure window, so this closure does not claim every reported rendering glitch is fixed.

If scrolling or resize still causes garbled/duplicated text on a current build, please reply with those details and fresh reproduction steps and we can reopen.

nwparker avatar Oct 18 '26 09:10 nwparker