fix(cli): trim blank streaming tails from live preview - #3965
Merged
Conversation
Some models stream long runs of trailing newlines after useful content. Trim them from the pending live viewport so blank rows do not push stable streaming text into scrollback on every repaint. The committed transcript still renders the full assistant message through MarkdownDisplay with isPending=false, so transcript fidelity is preserved. Generated with AI Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
wenshao
approved these changes
May 8, 2026
wenshao
left a comment
Collaborator
There was a problem hiding this comment.
[Suggestion] Missing test coverage for the new trimEnd() streaming behavior.
The 2 existing isPending=true test cases (unclosed code blocks, mermaid pending rendering) don't cover trailing whitespace trimming. Consider adding a test like:
it('trims trailing blank lines during streaming preview', async () => {
const { lastFrame } = render(
<MarkdownDisplay
text="hello world\n\n\n"
isPending={true}
availableTerminalHeight={80}
contentWidth={80}
/>
);
// Verify no trailing blank rows are rendered
});— deepseek-v4-pro via Qwen Code /review
TaimoorSiddiquiOfficial
pushed a commit
to TaimoorSiddiquiOfficial/HopCode
that referenced
this pull request
May 8, 2026
Some models stream long runs of trailing newlines after useful content. Trim them from the pending live viewport so blank rows do not push stable streaming text into scrollback on every repaint. The committed transcript still renders the full assistant message through MarkdownDisplay with isPending=false, so transcript fidelity is preserved. Generated with AI Co-authored-by: 秦奇 <gary.gq@alibaba-inc.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
B-A-M-N
pushed a commit
to B-A-M-N/qwen-code
that referenced
this pull request
May 8, 2026
Some models stream long runs of trailing newlines after useful content. Trim them from the pending live viewport so blank rows do not push stable streaming text into scrollback on every repaint. The committed transcript still renders the full assistant message through MarkdownDisplay with isPending=false, so transcript fidelity is preserved. Generated with AI Co-authored-by: 秦奇 <gary.gq@alibaba-inc.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some models stream long runs of trailing newlines after useful content. In the live pending viewport, these blank rows push stable streaming text into scrollback on every repaint tick — making it appear as if content has disappeared from the screen mid-stream.
Fix
In
MarkdownDisplay, trim trailing whitespace from the raw text whenisPending=truebefore parsing and rendering. The committed transcript still receives the full assistant message (isPending=false), so transcript fidelity is preserved.The change is a one-line
.trimEnd()applied only to the live pending display path — no impact on completed message rendering.Closes
Part of the flicker/scrollback stability work documented in the TUI optimization design.
Test plan
npx vitest run packages/cli/src/ui/utils/MarkdownDisplay.test.tsx— 101 tests pass🤖 Generated with Qwen Code