Repository navigation
fix(ui): remeasure chat rows after panel resize - #117687
Conversation
Visual before/after proofCaptured from the same deterministic mocked-Gateway fixture in Blacksmith Testbox after opening Background tasks.
|
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 8:23 PM ET / August 2, 2026, 00:23 UTC. ClawSweeper reviewWhat this changesThis PR fixes overlapping virtualized chat rows after side-panel resizing by resetting stale size measurements and refreshing connected rows, with focused unit and browser regressions for task, file, and change panels. Merge readinessThe repaired head addresses the prior P1 ownership concern: ordinary row refs remain on TanStack Virtual observation, while width invalidation alone performs the bounded Priority: P1 Review scores
Verification
How this fits togetherControl UI chat renders a long transcript through TanStack Virtual, which caches each visible row's height. Opening a side panel narrows the chat column; stale cached heights can produce incorrect virtual offsets and visually overlapping messages. flowchart LR
Panel[Task, file, or change panel] --> Width[Chat width changes]
Width --> Cache[Cached row heights invalidated]
Cache --> Refresh[Refresh connected virtual rows]
Refresh --> Offsets[Virtualizer recalculates offsets]
Offsets --> Transcript[Non-overlapping chat transcript]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +24, Tests +233. Total +257 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the reviewed ownership-boundary repair after a maintainer confirms the current merge result and required checks for the exact head; retain the focused panel-reflow regression as coverage for future virtualizer changes. Do we have a high-confidence way to reproduce the issue? Yes: the supplied current-main before proof shows overlap after the three panel toggles, and current source confirms the stale-width cache invalidation path. I did not rerun it locally because this read-only checkout lacks the installed dependency source and GitHub DNS was unavailable. Is this the best way to solve the issue? Yes: the repaired head keeps normal row observation on AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e9d70a5345e5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Exact-head visual proofThe before reproduction remains in the original current-main comparison. These after screenshots were regenerated on repaired head 64a0d287510, after restoring TanStack Virtual's normal row-measurement ownership.
|
ClawSweeper rank-up moves addressedReviewed the latest ClawSweeper comment at #117687 (comment) and applied every move on exact head
The repaired ownership model passes the seven previously failing history/restore scenarios, the three panel triggers, the full 462-test Control UI E2E lane, |
|
Merged via squash.
|
* fix(ui): remeasure chat rows after panel resize * test(ui): satisfy panel reflow lint * test(ui): cover panel resize while scrolling * fix(ui): preserve virtualizer scroll ownership
The width-change path wiped the virtualizer's entire item-size cache (instance.measure()), collapsing every offscreen row to the 120px estimate with no scroll compensation: the reader teleported mid-transcript and the trickle of remeasure corrections made text visibly jump for several frames on every pane or window resize. Keep the stale offscreen sizes as estimates instead. The existing synchronous resizeItem pass plus TanStack's per-row ResizeObserver re-seed connected rows with fold-based scroll compensation, so the anchor row holds still; offscreen rows correct lazily as they connect. End-pinned transcripts keep following the tail via the existing height-change scrollToEnd path. Regression e2e: mid-transcript anchor stays within 60px across 1280->1000->820->1280 resizes (pre-fix: anchor scrolled out of the viewport entirely and scrollTop drifted by 250px+). Wipe introduced in #115059, refined by #117687/#123713 without addressing anchoring.
…24013) * fix(ui): keep the chat transcript anchored while the pane resizes The width-change path wiped the virtualizer's entire item-size cache (instance.measure()), collapsing every offscreen row to the 120px estimate with no scroll compensation: the reader teleported mid-transcript and the trickle of remeasure corrections made text visibly jump for several frames on every pane or window resize. Keep the stale offscreen sizes as estimates instead. The existing synchronous resizeItem pass plus TanStack's per-row ResizeObserver re-seed connected rows with fold-based scroll compensation, so the anchor row holds still; offscreen rows correct lazily as they connect. End-pinned transcripts keep following the tail via the existing height-change scrollToEnd path. Regression e2e: mid-transcript anchor stays within 60px across 1280->1000->820->1280 resizes (pre-fix: anchor scrolled out of the viewport entirely and scrollTop drifted by 250px+). Wipe introduced in #115059, refined by #117687/#123713 without addressing anchoring. * test(infra): deflake ephemeral-port rebind proof under runner contention The bind->release->rebind cycle races foreign processes on shared CI runners: a stolen port between release and rebind fails the assertion (EADDRINUSE, seen on checks-node-compact-large-17). Retry the whole cycle on a fresh ephemeral port, bounded at 5 attempts; a genuine release regression still fails every attempt because the collision is with our own lingering listener. * test: prove port release on the allocated port; add end-pin resize proof Address ClawSweeper review on #124013: - ports-probe: replace the fresh-port retry with a connect probe against the same allocated port. A lingering listener accepts the probe; a released port refuses it. Unlike a rebind, the probe does not collide with foreign outbound sockets that transiently occupy the port on busy runners, so the release contract stays tied to one port with no retry at all. - chat-resize-anchor e2e: add a width-only end-pinned case proving the virtualizer's wasAtEnd compensation keeps the transcript within 2px of the end across 1280->1000->820->1280 resizes. * test(ui): widen resize-anchor drift bound for Linux font metrics The fold-spanning anchor row re-wraps by a renderer-dependent amount (42px macOS, 63px Linux CI at 820px). 120px keeps a wide margin below the pre-fix failure mode (anchor out of viewport, 250px+ drift). * test(tooling): register manager-session-update-race in memory helper routing #124024 added the memory-core test on main without updating the cross-lane routing expectation in test-projects.test.ts, breaking the core-tooling shard on every merge ref that includes it.
…enclaw#124013) * fix(ui): keep the chat transcript anchored while the pane resizes The width-change path wiped the virtualizer's entire item-size cache (instance.measure()), collapsing every offscreen row to the 120px estimate with no scroll compensation: the reader teleported mid-transcript and the trickle of remeasure corrections made text visibly jump for several frames on every pane or window resize. Keep the stale offscreen sizes as estimates instead. The existing synchronous resizeItem pass plus TanStack's per-row ResizeObserver re-seed connected rows with fold-based scroll compensation, so the anchor row holds still; offscreen rows correct lazily as they connect. End-pinned transcripts keep following the tail via the existing height-change scrollToEnd path. Regression e2e: mid-transcript anchor stays within 60px across 1280->1000->820->1280 resizes (pre-fix: anchor scrolled out of the viewport entirely and scrollTop drifted by 250px+). Wipe introduced in openclaw#115059, refined by openclaw#117687/openclaw#123713 without addressing anchoring. * test(infra): deflake ephemeral-port rebind proof under runner contention The bind->release->rebind cycle races foreign processes on shared CI runners: a stolen port between release and rebind fails the assertion (EADDRINUSE, seen on checks-node-compact-large-17). Retry the whole cycle on a fresh ephemeral port, bounded at 5 attempts; a genuine release regression still fails every attempt because the collision is with our own lingering listener. * test: prove port release on the allocated port; add end-pin resize proof Address ClawSweeper review on openclaw#124013: - ports-probe: replace the fresh-port retry with a connect probe against the same allocated port. A lingering listener accepts the probe; a released port refuses it. Unlike a rebind, the probe does not collide with foreign outbound sockets that transiently occupy the port on busy runners, so the release contract stays tied to one port with no retry at all. - chat-resize-anchor e2e: add a width-only end-pinned case proving the virtualizer's wasAtEnd compensation keeps the transcript within 2px of the end across 1280->1000->820->1280 resizes. * test(ui): widen resize-anchor drift bound for Linux font metrics The fold-spanning anchor row re-wraps by a renderer-dependent amount (42px macOS, 63px Linux CI at 820px). 120px keeps a wide margin below the pre-fix failure mode (anchor out of viewport, 250px+ drift). * test(tooling): register manager-session-update-race in memory helper routing openclaw#124024 added the memory-core test on main without updating the cross-lane routing expectation in test-projects.test.ts, breaking the core-tooling shard on every merge ref that includes it.





Summary
resizeItempath, then repeat once on the next animation frame for same-commit re-stampsmeasureElementso observer registration and scroll restoration retain their normal ownershipDiscord report: https://discord.com/channels/1456350064065904867/1458141495701012561/1533004141503320205
Root cause
TanStack Virtual 3.17.6 deliberately skips synchronous
measureElementsizing during ordinary user scrolling and reuses cached sizes when noResizeObserverEntryis present. A side-panel toggle changes transcript width while rows are still in that scroll state, so wrapped rows can retain 120 px estimates and overlap. Width invalidation now clears the cache and owns the bounded forced refresh throughresizeItem; ordinary refs only register and maintain observation.Validation
402 / 255 / 402 / 255with stale offsets0 / 120 / 240 / 360ui/src/pages/chat/components/chat-thread.measure.test.ts— 12/12 passedcheck:changed— passed, including formatting, typechecks, lint, dead-code, and i18n@tanstack/[email protected]source formeasureElement,resizeItem, andmeasure64a0d287510against currentorigin/main— clean, no accepted/actionable findingstbx_01kyzv97fs657ygnczv4yjqq8r: https://github.com/openclaw/openclaw/actions/runs/30723829616