fix(ui): prevent duplicate user prompt rendering in inline mode - #1182
Open
Rudra2637 wants to merge 2 commits into
Open
fix(ui): prevent duplicate user prompt rendering in inline mode#1182Rudra2637 wants to merge 2 commits into
Rudra2637 wants to merge 2 commits into
Conversation
Rudra2637
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
September 4, 2026 11:05
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The newly added unit test doesn’t currently exercise the live→Static transition that caused the duplication, so it would pass even if the regression reappeared.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes duplicate user-prompt rendering in default inline (non-alt-screen) mode by preventing the “last queued component rendered live” behavior from being used when Ink’s <Static> transcript is active (which otherwise reprints content into stdout during the live→static transition).
Changes:
- Gate
renderLastQueuedComponentLiveto fullscreen/alt-screen mode inInteractiveApp. - Add a defensive gate inside
ChatHistoryso inline mode never enables live queue rendering. - Add a unit test and a changeset entry for the patch release note.
File summaries
| File | Description |
|---|---|
source/app/sections/interactive-app.tsx |
Only enables last-queued live rendering when fullscreen is active. |
source/app/components/chat-history.tsx |
Forces inline mode to keep queued components in the Static-backed transcript to avoid duplicate stdout prints. |
source/app/components/chat-history.spec.tsx |
Adds a test intended to cover inline-mode behavior (needs improvement to actually detect duplication). |
.changeset/fix-duplicate-inline-prompt.md |
Documents the bugfix for the changelog as a patch changeset. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+209
to
+223
| test('inline mode keeps queued components in static queue even if renderLastQueuedComponentLive is passed', t => { | ||
| const props = createDefaultProps({ | ||
| fullscreen: false, | ||
| queuedComponents: [ | ||
| <div key="msg1">Message 1</div>, | ||
| <div key="msg2">Message 2</div>, | ||
| ], | ||
| renderLastQueuedComponentLive: true, | ||
| }); | ||
| const {lastFrame, unmount} = renderWithTheme(<ChatHistory {...props} />); | ||
| const output = lastFrame() ?? ''; | ||
| t.regex(output, /Message 1/); | ||
| t.regex(output, /Message 2/); | ||
| unmount(); | ||
| }); |
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.
Description
Fixes an issue in default inline mode (non-alt-screen) where submitted user prompts are duplicated in the terminal scrollback history when the model begins streaming its response.
Issue link: #1174
Root Cause
In default inline mode, chat transcript history is backed by Ink's
<Static>component. When a prompt was submitted,renderLastQueuedComponentLiveplaced the message in the live dynamic region (to support draft recall before streaming starts). Once the model began streaming and the recall window closed, moving the message into<Static items={allStaticComponents}>caused Ink to reprint the component directly into terminal stdout, duplicating the prompt.Fix
renderLastQueuedComponentLiveto only activate in fullscreen (--alt-screen) mode where<Static>is disabled and rendering occurs inside a virtual scrolling viewport.source/app/components/chat-history.spec.tsxverifying inline mode behavior.Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:ava source/app/components/chat-history.spec.tsx source/components/chat-queue.spec.tsx- 32/32 tests passed)tsc --noEmit)biome check .)Manual Testing
--alt-screen) to ensure no regression in alt-screen renderingChecklist