Repository navigation
fix(ui): chat bubbles overlap after switching to the dashboard face - #113356
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 24, 2026, 11:49 AM ET / 15:49 UTC. ClawSweeper reviewWhat this changesThe PR queues detached chat-row cleanup until after Lit finishes re-stamping the virtualized transcript, preventing overlapping or gapped bubbles when users switch between Chat and Dashboard faces. Merge readinessKeep this PR open for normal maintainer review. The supplied diff is narrowly scoped to the Control UI virtualizer lifecycle, and its described mock-harness evidence directly demonstrates the reported layout regression and after-fix result; the protected Priority: P2 Review scores
Verification
How this fits togetherThe Control UI renders each session transcript as virtualized, absolutely positioned chat rows. Lit row references feed the virtualizer’s measurement and ResizeObserver tracking, which determines row positions in both the full Chat face and Dashboard’s docked chat panel. flowchart LR
A[Session transcript] --> B[Virtualized chat rows]
B --> C[Lit row reference callbacks]
C --> D[Row measurement and ResizeObserver]
D --> E[Virtual row positions]
E --> F[Chat face]
E --> G[Dashboard chat dock]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +17, Tests +130. Total +147 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Land the focused lifecycle fix once a Control UI reviewer confirms the current-head behavior and required checks complete, keeping the regression test as the guard for future transcript re-stamps. Do we have a high-confidence way to reproduce the issue? Yes. The supplied mock-harness path switches the same session between Chat and Dashboard faces and records overlapping rows before the patch, with zero overlaps after it; the new focused regression test models the same re-stamp lifecycle. Is this the best way to solve the issue? Yes. Deferring only the null cleanup preserves immediate measurement for connected rows while allowing removed rows to be pruned after the Lit commit, avoiding new configuration, fallback, or persistence behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 049a17860c5b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…penclaw#113356) * fix(ui): keep chat transcript rows measured across dashboard face switches * test(ui): satisfy lint in transcript measure regression test
What Problem This Solves
Fixes an issue where switching a session from the Chat face to the Dashboard face (or back) left the chat transcript garbled: message bubbles overlapped each other in the dashboard's docked chat panel, and the full-width chat showed large empty gaps between messages. The broken layout persisted until the user scrolled far enough for every row to re-render.
Why This Change Was Made
The chat transcript is virtualized (
@tanstack/lit-virtual) with absolutely positioned rows whose heights are measured per row and observed viaResizeObserver. Each row's Litrefforwards tovirtualizer.measureElement(...).When the face switch re-stamps the transcript into the new container, Lit re-invokes every stable row ref as an
(undefined, element)pair while the newly stamped subtree is still detached (refs fire mid-commit, before the fragment is connected). Theundefinedcall runsmeasureElement(null), which prunes every disconnected element from the virtualizer's element cache — and mid-commit that includes the sibling rows registered a moment earlier. The net effect: after the commit only the last transcript row was still ResizeObserver-observed, so no row was ever re-measured at the new pane width. Rows stayed positioned by heights measured at the old width — overlap in the narrow dashboard dock, gaps in the wide chat face. (Initial load is unaffected because there are no prior elements, so theundefinedcalls never fire.)The fix defers the
measureElement(null)prune to a microtask (coalesced), so it runs after the commit lands, when only genuinely removed rows are still disconnected. Newly stamped rows keep their observation and heal to the new width within a frame.User Impact
Chat ⇄ Dashboard face switches now keep the transcript readable: no overlapping bubbles in the docked chat, no phantom gaps in the full-width chat. Row size tracking (streaming updates, images loading) also works for all visible rows again instead of only the most recently registered one.
Before (dashboard dock after switching from chat; 13 overlapping rows):
After (same flow; 0 overlaps):
Evidence
pnpm dev:ui:mock+?mockBoard=1): switching Chat → Dashboard produced 13 overlapping virtual rows; the virtualizer'selementsCachehad collapsed to a single entry (background-tasks) out of 14 rendered rows, so only one row was observed for resizes.ui/src/pages/chat/components/chat-thread.measure.test.tsre-stamps the same session transcript into a new container and asserts every rendered row stays ResizeObserver-observed (and old rows are released). It fails without the fix (dock rows lose observation) and passes with it.node scripts/run-vitest.mjsoverchat-thread.test.ts,chat-thread.question.test.ts,chat-view.test.ts,scroll.test.ts, and the new test: 373 passed.{"rowCount":15,"overlaps":13}before and{"rowCount":17,"overlaps":0}after (screenshots above).gpt-5.6-sol, high): clean, no findings — "The deferred, coalesced prune preserves newly registered rows until the Lit commit has attached them."