[Bug]: Terminal pane renders garbled/overlapping TUI after tab-switch reveal (Claude Code, Windows); Ctrl+L fixes
Summary
When a terminal pane running a full-screen TUI (Claude Code) is hidden and then re-revealed by switching tabs, the pane renders garbled / overlapping content. The stale frame persists until the app itself repaints. Pressing Ctrl+L (Claude Code's redraw), drag-selecting text in the pane, or resizing the pane all restore it cleanly.
This looks like the schedulePaneRevealRepaint path not catching this reveal case: the buffer-diff on reveal reports cells unchanged, so the canvas keeps compositing pre-hide pixels until a selection/resize/app-redraw forces a full rebuild.
Environment
- OS: Windows 11 Pro (26200)
- Orca: 1.4.120 (latest)
- Setup: This PC runs as the Orca runtime server (paired via Settings → Mobile). Two desktop (PC) clients paired to it.
- Agent in pane: Claude Code (full-screen TUI)
Steps to reproduce
- Open a worktree terminal running Claude Code (full-screen TUI).
- Switch to another tab.
- Switch back to the Claude Code tab.
- → Pane shows garbled / overlapping text (stale composited frame).
Workarounds that restore it
Ctrl+L(app-level redraw) — cleanest- Drag-select text inside the pane
- Resize the pane (drag split divider)
All three force a full buffer rebuild, consistent with the reveal-repaint gap.
Notes
- GPU Acceleration = Off (Settings → Terminal → Rendering, DOM renderer) does not help — so this is not the WebGL glyph-atlas corruption (#5031); it's the reveal repaint path.
- Likely related but distinct from #6632 (general "display artifacts in Claude Code full screen TUI", macOS). This report isolates it to tab-switch reveal with a clean repro + the Ctrl+L/select/resize recovery signal.
- Relevant code:
src/renderer/src/lib/pane-manager/pane-reveal-repaint.ts(schedulePaneRevealRepaint),terminal-visibility-resume.ts.
Investigated the schedulePaneRevealRepaint hypothesis at the source level. The root-cause analysis in this issue is correct, but Orca already ships the corresponding force-refresh-on-reveal fix, so I could not reproduce a remaining gap on current main.
Mechanism (as hypothesized, confirmed): while a pane is hidden, parsed output updates xterm's per-cell model without presenting a frame. On reveal a plain refresh() diffs the model, sees cells "unchanged," and skips them — stale pixels persist until drag-select/resize/Ctrl+L. There's a second layer: even a forced refresh() can be swallowed because xterm's RenderService gates refreshRows() on its IntersectionObserver (_isPaused can lag a frame on reveal, worse under load).
The fix already in place:
src/renderer/src/components/terminal-pane/terminal-visibility-resume.tscallsscheduleRevealRepaint()unconditionally on tab-switch reveal.- →
schedulePaneRevealRepaint(src/renderer/src/lib/pane-manager/pane-reveal-repaint.ts) → per pane on the settled frame →resetWebglTextureAtlas. resetWebglTextureAtlascallsclearTextureAtlas()(forces a full rebuild from the buffer — defeats the "cells unchanged" diff, no PTY resize needed), thenforceRepaintThroughRenderPause(src/renderer/src/lib/pane-manager/terminal-render-pause-release.ts) clears the_isPaused/_needsFullRefreshlatch and drives a synchronousrefreshRows(0, rows-1, true); falls back toterminal.refresh(0, rows-1)when not gated.
Why GPU-off doesn't matter (matches the report): the pause gate is in xterm core above the renderer, and the refresh fallback fires even with no WebGL addon — so both the WebGL and DOM renderers recover. It's a forced full-rebuild + pause-gate release, not a GPU-atlas-only patch.
Tests (12 passing on current tree):
npx vitest run --config config/vitest.config.ts src/renderer/src/lib/pane-manager/pane-reveal-repaint.test.ts src/renderer/src/lib/pane-manager/terminal-render-pause-release.test.ts
plus e2e tests/e2e/terminal-reveal-paused-render-repro.spec.ts proving pre-fix bug and post-fix pixel recovery against a real xterm RenderService.
The report was against 1.4.120; the fix is present on main. Caveat: your setup is a paired runtime-server + paired desktop clients — if the stale frame still shows on a current build, it may be a paired-client render-path issue (cf. #8696) rather than the local reveal-repaint path. If so, please attach the exact version and whether it's the host window or a paired client, and we'll track that path specifically.
Full analysis in docs/bug-reproductions/7240-reveal-repaint-stale-frame.md.
🔁 Attempted via automated Windows bug-reproduction pass — cannot_repro on current main (fix already shipped).
Closing because force-repaint-on-reveal is on main; this report predates it. Disagree? Please respond! I will re-visit this ticket in 5 days. If you respond, I will re-open it 🙏.
Responding, as the close invited. I think this should be reopened, and I have measurements rather than just a theory — including one that contradicts the mechanism in the original report, and one that limits what my PR can claim.
Why reopening is justified even though the close was correct on the day
The close reasoned that force-repaint-on-reveal is on main and this report predates it. True:
a6cbd3102 (#7614, 2026-07-06) added it, and this report is 2026-07-03.
But on 2026-08-24 — the day after the close — afd76a4df ("preserve synchronized frames on reveal",
#16026) took two repaints back off the intra-worktree tab-reveal path, which is exactly the path
this report describes:
- scheduleTabRevealWebglAtlasRecovery()
...
- manager.scheduleRevealRepaint()
+ if (shouldUseLightTabResume) {
+ manager.scheduleRevealPresent()
+ } else {
+ manager.scheduleRevealRepaint()
+ }
#16026's reasons are good ones (don't publish a half-built DEC 2026 frame on reveal; keep atlas
rebuilds off a path that races the tab overlay's delayed geometry fit), so a plain revert is not the
answer. But "the fix is on main" stopped being true for this path one day after it was written down.
The reported mechanism cannot be what is happening
The report (and the pane-reveal-repaint.ts comment it quotes) says the reveal diff reports cells
unchanged, so plain refreshes skip them. Reading the pinned xterm sources, that cannot produce stale
pixels:
RenderService.refreshRowschecks_isPausedbefore anything else and returns, so a hidden pane's render model never drifts from its buffer — it is uniformly behind. I measured this: 8/8 sampled cells mismatch while hidden, 0 after reveal.- The per-cell diff in
WebglRenderer._updateModelonly decides which vertex attributes get rewritten, not whether a draw happens.GlyphRenderer.render()redraws the whole viewport every completed frame, over a full-viewport clear rect thatRectangleRendereremits unconditionally.
So a completed renderRows cannot leave old pixels. Stale pixels mean no frame completed, which
is a different bug with a different fix.
What I measured
An Electron harness driving the real light tab-resume path (two terminal tabs in one worktree, store-driven activation, DEC 2026 frame written to the hidden pane) reaches the state the code's own field trace records:
| phase | _isPaused |
_needsFullRefresh |
pane display:none |
DEC 2026 held | model-vs-buffer mismatches |
|---|---|---|---|---|---|
| hidden, after write | true | true | true | true | 8 |
| revealed | false | false | false | false | 0 |
It recovers — one full-viewport renderRows, ~18.6k cells rewritten, 95% pixel change — on both the
WebGL and DOM arms. Two things follow:
- The repair is xterm's, not Orca's. Removing
manager.scheduleRevealPresent()from the light path leaves the harness green:RenderService._handleIntersectionChangesees!_isPaused && _needsFullRefreshand issues the full refresh itself. A permanent stale canvas therefore requires that repair to be defeated, not merely "no repaint scheduled". - One place can defeat it.
_needsFullRefreshhas exactly one writer in this repository:releaseRenderPause, which clears it before driving its own synchronous render, deliberately, to avoid a redundant second repaint. The observer only fires on a change, so nothing re-owes the repaint. If that render does not paint, the pane is stuck until a selection or resize rebuilds the model — which is precisely the recovery signal in this report.
Where that leaves the WebGL/DOM split, honestly
WebglRenderer.renderRows returns without drawing while _isAttached is false. The DOM renderer has
no such gate. So the mechanism above explains a WebGL pane that never self-heals — but this report
states that GPU Acceleration = Off does not help either, and I cannot explain a DOM-renderer
occurrence with it.
The renderer-independent candidate is schedulePresentWhenDisplayed in pane-viewport-present.ts:
when the pane is still display:none at reveal it burns a 16-frame budget and then returns with no
trace at all. That is the one reveal path xterm has no watchdog for, and until now it left no signal
in a freeze report, which is a large part of why this issue has been hard to pin down.
What would settle it, from a machine that reproduces
My PR adds a breadcrumb on both outcomes of that retry. On a build containing it, reproducing and then running
await window.__orcaTerminalFreezeReport() // DevTools: View → Toggle Developer Tools
answers it directly: a reveal-present-retry-abandoned entry means the renderer-independent path;
its absence, with a WebGL pane, points at the lost-repaint mechanism above. Please do not
drag-select first — the selection is itself the repair, so it destroys the evidence.
Coverage note
The specs closest to this — terminal-inline-tui-reveal-convergence.spec.ts and the hidden-output
tests in terminal-tab-switch-visual-restore.spec.ts — assert on the xterm buffer. The buffer is
correct in this bug, so they are structurally blind to it.
A PR follows. It closes the way the repair can be lost and adds the missing signal; I am deliberately not claiming it closes this issue, for the reason in the WebGL/DOM section above.
Sure
I checked this against current main (commit a84f16df3d7) and ran the real Electron/xterm repros.
Verdict: the paused-render failure is real, but I cannot reproduce a user-visible stale/garbled pane through the current production reveal path.
The deterministic control reproduces the underlying failure: while xterm's RenderService is paused, the old clearTextureAtlas() + terminal.refresh() sequence produces zero render calls. The current reveal repair then drives a full viewport render and clears the pause latch. The headful WebGL test passed, and the light tab-resume hidden-output tests passed on both agent markers.
Visual proof from the headful run:
The screenshots show the old coherent frame is preserved during DEC 2026 output and the new frame appears after release; there is no overlap, blanking, or stale-pixel gap. The production checks were:
ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/terminal-reveal-paused-render-repro.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1
# 1 passed
ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/terminal-reveal-paused-render-repro.spec.ts --config tests/playwright.config.ts --project electron-headful --workers=1
# 2 passed
ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/terminal-tab-switch-visual-restore.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1 --grep 'restores skipped hidden agent output|restores skipped hidden Grok output'
# 2 passed
So the reopening concern is reasonable as a regression hypothesis after #16026, but current main does not provide a repro. A remaining occurrence would need the exact Orca version and whether it happens in the host window or a paired client; that would point at a different render path.
@GodCC6 can you please include screenshots of the wonky behavior?
And @nwparker when you have that, thanks!
even better is if you can reproduce in an E2E test btw
First, an apology. I asked for this to be reopened, you agreed and then spent real time on it —
running the repro specs against current main, capturing screenshots, writing up a verdict — and
I cannot hand you a reproduction in return. In hindsight I should have confirmed I could still
reproduce it on demand before asking you to reopen it. Please don't spend further maintainer
time on my behalf until I come back with a reliable repro.
Posting what I do have, because none of it was on the issue before.
The two questions from the verification comment
Orca version: 1.4.204–1.4.205.
Host window or paired client: paired client. One macOS machine runs as the Orca runtime server; a second macOS machine is paired to it as a desktop client. The garbling appeared in the paired client's terminal pane. Worth noting: the original report's Environment section describes the same shape — one machine acting as the runtime server with paired desktop clients. So the paired topology is common to both sightings; the OS is not.
What the pane actually looked like, recorded at the time
- Old and new content interleaved by column: the first two columns of the old row and its tail survived, while the new row was written from column three onward.
- Not an encoding problem — multi-byte glyphs rendered correctly, no replacement characters.
- Not in the xterm buffer: drag-selecting text restored it immediately. Selection forces a repaint from the buffer, so if the corruption lived in the buffer the repaint would just reproduce it.
| action | result |
|---|---|
| drag-select a few characters | restored immediately |
Ctrl+L (the TUI's own full redraw) |
restored |
| resize the grid without a repaint | no effect |
| GPU acceleration on (WebGL) | never self-healed |
| GPU acceleration off (DOM) | still garbled; sometimes self-healed in ~0.5s, sometimes not |
That last row is the one I cannot fit to a WebGL-only mechanism: with GPU acceleration off the DOM renderer is in use, and the pane still garbled.
Why there is no screenshot: drag-selecting is itself the repair, so any attempt to copy the broken text destroys the evidence. A screenshot is the only way to capture it, and I did not keep the one I took.
What I tried today and could not make fail
- Built the precondition in an Electron E2E: a pane that was visible, then hidden, written to
while hidden, then revealed. Renderer state at that point is
_isPaused: true,_needsFullRefresh: true, with WebGL still attached. The reveal repainted correctly — a full-viewport colour fill moved ~39% of pixels, matching a positive control. - Ran the same probe against the commit immediately before #21355 and against #21355 itself.
The pixel-diff ratios were identical to the last digit. That is expected rather than
surprising: the guard in that PR only diverges when
_isAttached === false, and I could not drive the renderer into that state. Hiding the pane did not do it —_refreshCharAtlasran but the device char dimensions stayed non-zero. A pane that was never visible has WebGL attachment deferred and no WebGL renderer at all. Forcing a WebGL context loss did not produce stale pixels either; the pane still repainted, and the diagnostics reported the loss and fell back to the DOM renderer a few seconds later.
Two incidental notes on the existing specs, in case they save someone time:
- On macOS the
electron-headlessproject has full WebGL — the GPU-disabling switches in the launch args are applied on Linux only. Pixel assertions do not need@headfulthere. - Because the headless project sets
grepInvert: /@headful/, runningterminal-reveal-paused-render-repro.spec.tsunderelectron-headlessexecutes one of its three tests; the two pixel tests are@headful-only and are skipped.
On whether to keep this open
That is your call — I have no triage rights here, and I am not the original reporter, so this
is not mine to withdraw either. pending_repro already signals that nobody should be working
this, which covers the concern that prompted this comment.
The one thing I would leave on the record is a timing hazard rather than an argument for any particular outcome: the August close was correct on the day it was made, and #16026 landed the following day and took two repaints off this exact path. Nothing about that sequence was foreseeable from either side — I mention it only because a verdict that is right on the day can quietly stop being right, and this path has already done that once.
I will come back with a reproduction, or with nothing.
AI Disclosure
Written with Claude Code (Claude Opus 5). The E2E probing, the differential runs against #21355 and its parent commit, and the wording of this comment were all done in that session; I reviewed the result before posting. The behaviours in the table above are first-hand observations I made on my own machine, not model inference, though the write-up of them was assisted like the rest. The earlier analysis on this issue was produced in the same assisted workflow as #21355 — see that PR's AI Disclosure section.
Thanks for the detailed report. This is old, and several reveal/restore fixes have landed since (e.g. #21578 escape-tail handling). Could you retest on the latest build (1.4.239+) and tell us if it still happens? If so, please share: Orca version, OS/GPU, Claude Code version and whether it is in fullscreen (alt-screen) mode, the exact sequence (switch away while output is streaming? how long hidden?), and whether Settings -> Terminal -> Rendering -> GPU Acceleration Off changes it. A screenshot of the garbled state would help. Please redact anything private before sharing; screenshots or log excerpts are fine.