#18824: fix(ui): avoid chat bubble flicker after streaming completes
app: web-ui
size: S
## Summary
The WebUI chat view could visibly flicker at the end of assistant streaming: the streaming bubble disappeared, then a full-content bubble appeared immediately after.
## Root Cause
On `chat` `final` events, the controller cleared stream state before materializing the final assistant message in local chat state. The subsequent history refresh then reintroduced the same message as a separate render pass.
## What Changed
- `ui/src/ui/controllers/chat.ts`
- On `final`, append an assistant message from payload when valid, otherwise fallback to streamed text, before clearing stream state.
- `ui/src/ui/chat/grouped-render.ts`
- Remove `fade-in` class from chat bubbles to avoid end-of-stream flash during stream-to-final transition.
- Tests
- `ui/src/ui/controllers/chat.test.ts`: cover `final` message materialization and payload-vs-stream fallback behavior.
- `ui/src/ui/views/chat.test.ts`: assert assistant bubbles are rendered without `fade-in`.
## Validation
- `pnpm -C ui exec vitest run src/ui/controllers/chat.test.ts --config vitest.config.ts --browser.enabled false`
- `pnpm -C ui exec vitest run src/ui/views/chat.test.ts --config vitest.config.ts`
Most Similar PRs
#8353: fix(ui): display tool calls during webchat streaming
by MarvinDontPanic · 2026-02-03
66.9%
#23144: fix(ui): strip reply directive tags from assistant messages in WebC...
by echoVic · 2026-02-22
66.6%
#16767: fix: auto-resync webchat on reconnect and prevent message flicker o...
by alewcock · 2026-02-15
65.9%
#15110: fix: enable auto-scroll during assistant response streaming
by jwchmodx · 2026-02-13
65.6%
#18942: fix(tui): trigger render after finalizing chat assistant message
by BinHPdev · 2026-02-17
65.4%
#4495: Fix: emit final assistant event when reply tags hide stream
by ukeate · 2026-01-30
64.8%
#19783: fix(ui): prevent chat auto-scroll from fighting user scroll during ...
by aleiby · 2026-02-18
64.6%
#14966: fix(webchat): preserve user message visibility after chat.send
by BenediktSchackenberg · 2026-02-12
64.3%
#23246: fix(gateway): strip reply directive tags from finalized webchat mes...
by SidQin-cyber · 2026-02-22
62.7%
#15118: Fix webchat ghost bubble when model replies with NO_REPLY
by jwchmodx · 2026-02-13
62.6%