-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: TUI long messages vanish — fullRender(true) clears terminal scrollback (\x1b[3J) #78017
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Long assistant messages in
openclaw tuiappear briefly, then disappear from the screen entirely (including from terminal scrollback) once the conversation continues. Shorter messages render normally. Only reproduced via the TUI so far.Environment
2026.5.4 (325df3e)openclaw tuinode_modules/@mariozechner/pi-tui/dist/tui.jsSymptom
Likely root cause
pi-tuiuses normal-screen rendering plus a differential-redraw path that occasionally falls back tofullRender(true).fullRender(true)issues:The third escape (
\x1b[3J) wipes the terminal’s scrollback buffer. After that, only the bottomterminal_heightlines ofnewLinesremain visible — anything that scrolled into scrollback during prior renders is gone.There are three triggers for
fullRender(true)inpi-tui/dist/tui.js:widthChanged— line ~743heightChanged(non-Termux) — line ~751firstChanged < prevViewportTop— line ~842(3) is the suspected culprit for this report. While a long assistant message streams,
AssistantMessageComponent→HyperlinkMarkdown→Markdown.setText()invalidates and re-renders the entire markdown body on each chunk. As the body grows past the viewport, any changed line in the early portion of the rendered buffer (e.g., a line that re-flows due to a paragraph boundary shift, a blockquote close, or a code-fence open) setsfirstChangedto a position aboveprevViewportTop. That triggersfullRender(true), clearing scrollback and leaving only the lastheightlines visible.Code references (paths within bundled openclaw install):
node_modules/@mariozechner/pi-tui/dist/tui.js\x1b[2J\x1b[H\x1b[3JinfullRender(withindoRender)if (firstChanged < prevViewportTop) { fullRender(true); return; }dist/tui-CD7AaN2H.jsAssistantMessageComponent.setText→HyperlinkMarkdown.setText→Markdown.setText→invalidate()Why it’s surprising
pi-tuideliberately uses normal-screen + scrollback (not alt-screen) so that conversation history remains scrollable in the user’s terminal.\x1b[3Jin thefullRenderpath defeats that goal whenever a non-resize trigger fires — the user permanently loses the rendered content above the viewport.Suggested fixes
Pick one or combine:
\x1b[3Jfrom thefirstChanged < prevViewportToppath. Width/height changes plausibly justify clearing scrollback (wrapping changes), but a content-change full-redraw doesn’t. For path (3), a redraw of just the visible viewport is sufficient.firstChangedlands inside the viewport.firstChanged < prevViewportTop, accept that scrollback is authoritative for those lines and only redraw fromprevViewportTopdownward.Repro
openclaw tuiin any terminal that supports\x1b[3J(iTerm2, Terminal.app, kitty, alacritty, Ghostty all do).Diagnostic capture
For maintainers reproducing locally:
Each
fullRenderlogs its reason (first render,terminal width changed,terminal height changed,firstChanged < viewportTop,clearOnShrink,extraLines > height,deleted lines moved viewport up). The expected log line for this bug is:Related
Impact
UX bug — content the user already saw cannot be recovered, including via the terminal’s native scrollback. Long-form responses (explanations, code review output, plan documents) are the most affected.