Repository navigation
fix(ui): keep the chat transcript anchored while the pane resizes - #124013
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 1:39 AM ET / 05:39 UTC. ClawSweeper reviewWhat this changesThe PR preserves transcript measurements during pane-width changes, adds browser checks for reader and end anchoring, and makes an ephemeral-port release test use a same-port connection probe. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-owned PR open for normal landing review: current main still clears the virtualizer cache on width changes, while the branch removes that path and supplies direct browser coverage. No concrete patch defect was found; direct inspection of the pinned virtualizer source remains unavailable in this checkout. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI chat transcript virtualizes message rows while users resize panes, windows, and dashboard docks. Row measurements determine both visible placement and the scroll position seen by mid-transcript and end-pinned readers. flowchart LR
A[Pane width change] --> B[Transcript virtualizer host]
B --> C[Connected row measurement]
C --> D[Virtual row size cache]
D --> E[Scroll anchoring]
E --> F[Visible chat transcript]
Decision needed
Why: The patch depends on the virtualizer’s scroll-adjustment semantics, but the dependency source is absent from this read-only checkout and could not be fetched. Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +225. Total +225 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the owner-level deletion of the cache wipe, confirm the pinned virtualizer’s resize compensation contract from its source or types, and land after the current-head browser and compact checks are green. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main resets all measurements on a width change, and the PR’s focused browser scenario drives a long, mixed-height transcript through the affected resize sequence. Is this the best way to solve the issue? Yes, conditionally: removing the owner callback’s wholesale reset is narrower than compensating downstream scroll positions, but the pinned virtualizer contract should be checked before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 83319bad608b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
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.
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.
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.
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).
…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.
808f8e4 to
0984f2e
Compare
|
Merged via squash.
|
…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.
What Problem This Solves
Resizing the chat pane (window resize, sidebar/split drag, dashboard dock) made the transcript text jump wildly: the reader was teleported to different messages and the view kept shifting for several frames while row measurements trickled back in. Reported live on team.openclaw.ai running ~main.
Before (viewport resized 1280→1100→960→820→back, reader mid-transcript):
resize-before.mp4
After (same sequence — the anchor row holds still while text re-wraps):
resize-after.mp4
Why This Change Was Made
The width-change path in the transcript virtualizer host called
instance.measure(), wiping the entire item-size cache. That wipe has no scroll compensation: every offscreen row collapses to the 120px default estimate, so the content above the viewport changes height wholesale whilescrollTopstays fixed — the visible range now maps to different rows. The subsequent corrections (syncresizeItemseed pass, rAF repeat, per-row ResizeObserver) each shift content again, frame by frame.The wipe dates to #115059 (session-switch measurement retention) and was refined by #117687 and #123713 without addressing anchoring. The repair deletes the wipe and keeps stale offscreen sizes as estimates: the existing synchronous
resizeItempass re-seeds connected rows with fold-based scroll compensation (rows entirely above the fold adjustscrollTopby their delta), so the anchor row holds still, and offscreen rows correct lazily as they connect — the standard dynamic-virtualizer model. End-pinned transcripts keep following the tail through the existing height-changescrollToEndpath.User Impact
Resizing the window, dragging the split, or docking the chat pane no longer loses the reading position. Mid-transcript readers stay on the same message; end-pinned sessions stay pinned.
Evidence
ui/src/e2e/chat-resize-anchor.e2e.test.ts: seeds 120 mixed-width messages, scrolls mid-transcript, resizes 1280→1000→820→1280. Pre-fix: the anchor row leaves the viewport entirely andscrollTopdrifts 7021→7278. Post-fix: 0px drift at 1000, 42px at 820 (the anchor row itself spans the fold and re-wraps), byte-identicalscrollTopback at 1280. Asserted bound: ≤60px.chat-panel-reflow.e2e.test.ts(the overlap regression that motivated the wipe),board-split-transcript.e2e.test.ts, all 9chat-transcript-controller.test.tsunit tests.check:changedlanes green (format, typecheck core/UI, lint, i18n verify, knip dead-export local scans); remote proof backends were unavailable mid-run, local fallback used per policy.gpt-5.6-sol, high): clean, no findings.CI + Review Notes
First CI run failed only on
checks-node-compact-large-17:src/infra/ports-probe.test.ts > can bind and release an ephemeral loopback porthitEADDRINUSE— an unrelated, flaky-by-construction assertion (bind→release→rebind races foreign processes stealing the freed port on shared runners). Per repo doctrine the landing PR carries the fix: the cycle now retries on a fresh ephemeral port (bounded, 5 attempts); a genuine release regression still fails every attempt. Focused proof: 4 consecutive green runs; Codex autoreview clean.ClawSweeper findings addressed (head
265612feb68):ECONNREFUSED). No retry remains, and the probe doesn't collide with foreign outbound sockets that transiently occupy local ports on busy runners (the actual flake class). Accepted-path proven against a live listener.wasAtEndcompensation in a real browser.db944816566; watching the new head.Red-main repair carried per doctrine (head
0984f2e08a5): #124024 addedextensions/memory-core/src/memory/manager-session-update-race.test.tson main without updating the cross-lane routing expectation insrc/scripts/test-projects.test.ts, breaking thecore-toolingshard on every merge ref including it (first seen here aschecks-node-compact-small-42). This PR registers the file in the expectation (rebased onto latest main so the fix is locally provable; tooling suite green locally). The Linux drift bound on the new e2e also gained renderer headroom (63px observed on CI vs 42px on macOS; bound now 120px, still far under the pre-fix 250px+/anchor-lost failure mode).