Skip to content

fix(ui): remeasure chat rows after panel resize - #117687

Merged
Patrick-Erichsen merged 4 commits into
mainfrom
pe/fix-chat-toggle-overprint
Aug 2, 2026
Merged

Patrick-Erichsen merged 4 commits into
mainfrom
pe/fix-chat-toggle-overprint

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • reset cached transcript measurements when the chat width changes
  • synchronously seed connected rows through TanStack Virtual's canonical resizeItem path, then repeat once on the next animation frame for same-commit re-stamps
  • keep ordinary row refs on measureElement so observer registration and scroll restoration retain their normal ownership
  • add focused and browser-level regressions for background tasks, thread files, and thread changes

Discord report: https://discord.com/channels/1456350064065904867/1458141495701012561/1533004141503320205

Root cause

TanStack Virtual 3.17.6 deliberately skips synchronous measureElement sizing during ordinary user scrolling and reuses cached sizes when no ResizeObserverEntry is 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 through resizeItem; ordinary refs only register and maintain observation.

Validation

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@Patrick-Erichsen Patrick-Erichsen self-assigned this Aug 1, 2026
@clawsweeper clawsweeper Bot added the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Aug 1, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Visual before/after proof

Captured from the same deterministic mocked-Gateway fixture in Blacksmith Testbox after opening Background tasks.

Before — current main (2f06ed3) After — PR #117687 (fa38efd)
Before on current main: overlapping transcript rows after opening Background tasks After on PR #117687: separated transcript rows after opening Background tasks

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 8:23 PM ET / August 2, 2026, 00:23 UTC.

ClawSweeper review

What this changes

This 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 readiness

⚠️ Ready for maintainer review - 2 items remain

The repaired head addresses the prior P1 ownership concern: ordinary row refs remain on TanStack Virtual observation, while width invalidation alone performs the bounded resizeItem refresh and cancels its queued frame on disconnect. The visual proof directly covers the three affected panel states, and no new patch defect was found; keep this PR open because it has the protected maintainer label and still needs ordinary human merge handling.

Priority: P1
Reviewed head: 64a0d287510bdb4abdb3110d162204f75f83abcb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, fixes the previous ownership finding, and has strong visual proof; final landing remains a protected maintainer decision rather than a quality defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The contributor supplied exact-head screenshots showing no overlap for all three affected panel states, paired with current-main before evidence and a referenced Testbox run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The contributor supplied exact-head screenshots showing no overlap for all three affected panel states, paired with current-main before evidence and a referenced Testbox run.
Evidence reviewed 7 items Current-main failure path: Current main detects a transcript-width change, clears virtualizer measurements, then invokes measureElement for connected rows. The supplied current-main proof records stale 120px-based offsets and overlapping wrapped rows after panel toggles.
Prior P1 is repaired on the final head: The final patch removes the width-change measureElement loop, confines forced sizing to measureConnectedRows through resizeItem, queues only one follow-up animation frame, and cancels that frame during disconnect.
Focused regression coverage: The added browser test opens Background tasks, Thread files, and Thread changes after scrolling a wrapped transcript, asserting no visible .chat-group overlaps for each state.
Findings None None.
Security None None.

How this fits together

Control 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]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as behind current main. Its clean mergeability does not itself show a regression, but the final merge result and remaining exact-head required checks should be refreshed before landing.
  • Complete next step (P2) - The prior P1 has been mechanically resolved, but the protected maintainer label requires human merge handling and an exact-head merge/check refresh rather than an automated repair lane.
Agent review details

Security

None.

PR surface

Source +24, Tests +233. Total +257 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 30 6 +24
Tests 2 234 1 +233
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 264 7 +257

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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 measureElement and gives the exceptional forced remeasurement a single width-invalidation owner through resizeItem, which is narrower and safer than the previous dual measurement path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e9d70a5345e5.

Labels

Label justifications:

  • P1: Overlapping rows obscure messages in the primary web chat workflow when users open common side panels.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The contributor supplied exact-head screenshots showing no overlap for all three affected panel states, paired with current-main before evidence and a referenced Testbox run.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor supplied exact-head screenshots showing no overlap for all three affected panel states, paired with current-main before evidence and a referenced Testbox run.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The contributor supplied exact-head screenshots showing no overlap for all three affected panel states, paired with current-main before evidence and a referenced Testbox run.

Evidence

What I checked:

  • Current-main failure path: Current main detects a transcript-width change, clears virtualizer measurements, then invokes measureElement for connected rows. The supplied current-main proof records stale 120px-based offsets and overlapping wrapped rows after panel toggles. (ui/src/pages/chat/components/chat-thread.ts:323, e9d70a5345e5)
  • Prior P1 is repaired on the final head: The final patch removes the width-change measureElement loop, confines forced sizing to measureConnectedRows through resizeItem, queues only one follow-up animation frame, and cancels that frame during disconnect. (ui/src/pages/chat/components/chat-thread.ts:267, 64a0d287510b)
  • Focused regression coverage: The added browser test opens Background tasks, Thread files, and Thread changes after scrolling a wrapped transcript, asserting no visible .chat-group overlaps for each state. (ui/src/e2e/chat-panel-reflow.e2e.test.ts:161, 64a0d287510b)
  • Real behavior proof: The final-head proof comment provides three after screenshots for Background tasks, Thread files, and Thread changes, while the prior comment supplies the current-main before reproduction; it reports zero visible row overlaps after the fix. (64a0d287510b)
  • Feature history and likely routing: The virtualized transcript originated in Shakker's virtual-chat work, and Peter Steinberger recently rewrote the current chat-thread implementation and its measurement tests. The earlier appended-row overlap fix is adjacent but has a distinct trigger. (ui/src/pages/chat/components/chat-thread.ts:239, fb3d473a73b0)
  • Main and release provenance: The PR head is not an ancestor of current main, and the latest supplied release v2026.7.1 predates this August 1 PR work, so the fix is neither merged nor released. (64a0d287510b)

Likely related people:

  • Peter Steinberger: Recent current-main work introduced the present chat-thread implementation and its measurement-test surface, making this the closest current owner boundary. (role: recent area contributor; confidence: high; commits: fb3d473a73b0, cad4e395d21f; files: ui/src/pages/chat/components/chat-thread.ts, ui/src/pages/chat/components/chat-thread.measure.test.ts)
  • Shakker: Feature history attributes the original virtualized transcript and its early row-alignment/stabilization work to this contributor. (role: virtualized-transcript feature contributor; confidence: high; commits: 59acd601f2b1, 9ef1e965a6c1; files: ui/src/pages/chat/components/chat-thread.ts)
  • Jason (Json): Earlier merged work addressed overlapping appended chat rows, an adjacent but distinct transcript-layout failure mode. (role: adjacent regression contributor; confidence: medium; commits: 63c929a74e05; files: ui/src/pages/chat/components/chat-thread.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-01T23:34:12.672Z sha fa38efd :: needs real behavior proof before merge. :: [P1] Use one measurement path per virtual row
  • reviewed August 1, 2026, 7:43 PM ET / 23:43 UTC sha unknown :: found issues before merge. :: [P1] Use one measurement path per virtual row

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Exact-head visual proof

The 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.

Background tasksThread filesThread changes
Exact-head after proof: no transcript overlap with Background tasks open Exact-head after proof: no transcript overlap with Thread files open Exact-head after proof: no transcript overlap with Thread changes open

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up moves addressed

Reviewed the latest ClawSweeper comment at #117687 (comment) and applied every move on exact head 64a0d287510:

  • One measurement path per ordinary virtual row: row refs now call only TanStack's measureElement; the global custom measurement policy is removed.
  • Single forced-refresh owner: direct resizeItem(index, offsetHeight) is confined to measureConnectedRows, invoked only after explicit transcript-width invalidation and its queued animation-frame follow-up.
  • Dependency contract proven: exact @tanstack/[email protected] source confirms that measureElement preserves cached no-entry sizes and skips synchronous sizing during ordinary user scrolling; resizeItem owns cache updates and scroll-anchor adjustment.

The repaired ownership model passes the seven previously failing history/restore scenarios, the three panel triggers, the full 462-test Control UI E2E lane, check:changed, and clean autoreview. Exact-head screenshots and Testbox links are in the updated PR body.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 2, 2026
@Patrick-Erichsen
Patrick-Erichsen merged commit 0e49684 into main Aug 2, 2026
118 of 126 checks passed
@Patrick-Erichsen
Patrick-Erichsen deleted the pe/fix-chat-toggle-overprint branch August 2, 2026 00:28
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* 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
steipete added a commit that referenced this pull request Aug 15, 2026
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.
steipete added a commit that referenced this pull request Aug 15, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant