Skip to content

perf(ui): keep streaming chats responsive - #159806

Merged
steipete merged 10 commits into
mainfrom
perf/l108-transcript-geometry-invalidation-20260927
Sep 27, 2026
Merged

steipete merged 10 commits into
mainfrom
perf/l108-transcript-geometry-invalidation-20260927

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Streaming replies forced synchronous transcript layout after each pane commit, delaying typing and frames.

User Impact

Chat performs less renderer work while preserving end-follow, reader scrollback, history anchoring, immediate UI state updates, and the existing composer layout. There are no protocol, configuration, schema, or dependency changes.

Why This Change Was Made

The transcript layout owner now controls the native viewport and measured range. Size and layout containment keep intrinsic row changes local without clipping paint. Actual viewport and range-shrink writes produce correction receipts; the end anchor no longer samples geometry around every commit. The existing input, command, history, and pane owners retain their authority.

Tracing also found an unused people-submenu :has(... )::part(...) selector invalidating unrelated popup parts after transcript DOM mutations. The menu owner now provides an explicit class with the same declarations and specificity. In a complete diagnostic ablation, this reduced style resolutions from 61,913 to 33,340 and shadow-part invalidations from 42,565 to 3, without reducing DOM-commit sweeps. Style resolutions per frame at p95 fell from 168 to 84. Adding size containment reduced viewport-root layouts from 1,526 to 401, confining 1,111 layouts to the explicitly sized inner range; paint remains unclipped.

Native anchoring was tested first: reverse flow moved a reader 100px after a temporary viewport resize, while a normal bottom sentinel left an uninterrupted follower 100px above the end. Explicit ownership preserves both cases and chronological DOM order.

Evidence

Production builds on one four-core Blacksmith Testbox, Node 24.21.0, Chromium 153.0.8010.12, 4× CPU throttle, fresh browser contexts, and interleaved A/B/A/B/B/A/B/A runs. Each run delivered the same 676 chunks and 276 typed characters. Baseline: 624b66f24f37; candidate: 51b17d218305.

Median Main Candidate Change
Renderer task time 33.511s 31.826s −5.03%
Long tasks 190 141.5 −25.53%
Input p95 22.4ms 22.0ms −1.79%
Frame-gap p95 58.3ms 50.05ms −14.15%

All eight runs delivered every chunk, ended at distance 0px, and reported no page errors. These are renderer measurements, not Gateway capacity estimates. Separate diagnostic traces verified all 676 chunk markers and no trace data loss; truncated exploratory captures were excluded.

Complete UI E2E inventory: 680/680 files collected, 3,225 distinct cases including one explicitly gated desktop-native skip (OPENCLAW_DESKTOP_REAL_FIXTURE). The completed nine shard invocations took 6143.62s combined wall time and were supplemented by the exact omitted-file manifest: 71 files/357 tests passed, one file/test skipped, 648.29s. Original failures and their follow-up are recorded below.

The original typing-measurement case observed four transcript scrollHeight reads instead of zero in the broad run. One standalone replay, ten 4× throttled diagnostic repetitions, and the original 76-file shard inventory at its original one-worker budget all passed with zero typing reads; the latter passed 352/352 tests in 666.81s. This bounded investigation did not reproduce or attribute the original event. Its assertion is unchanged, and the original failure is not claimed fixed.

Two real-Gateway files initially failed at dashboard --json before browser assertions; a diagnostic replay captured “Control UI assets are still preparing.” Both unchanged files then passed all three tests in 46.97s with the canonical runtime/UI asset prerequisite verified, using the preparation sequence already landed in #159624. The pair was already ready during that final check; no rebuild was needed, and no mismatched pair was captured at the original failure.

The adaptive worker budget changed weighted shard membership between invocations. File-level auditing caught the resulting duplicates and omissions; an explicit unsharded manifest completes the missing coverage. This scheduling issue is independent of the production diff.

  • pnpm build: passed, 405.82s.
  • node scripts/check-changed.mjs --base 624b66f24f37: passed, 484.50s; zero lint warnings/errors.
  • Native-anchor and people-menu browser suites: 20/20 passed, 5.71s on the Testbox; serial local cost 10.87s. No ResizeObserver or duplicate-Lit diagnostics.
  • Eight focused owner suites: 160/160 passed, 10.27s; inherited jsdom duplicate-Lit advisories.
  • Final test-only changed gate: passed, 200.21s, zero lint warnings/errors. All four corrected range-consumer suites: 23/23 passed on the Testbox, 106.81s. Measured local costs: dock 8/8 in 78.05s; focus/disclosure/history 15/15 in 62.76s. No cases, retries, sleeps, or relaxed assertions were added.
  • pnpm ui:check-performance: failed in 0.13s. Startup is 371,448/371,332B gzip (+116B); largest ordinary JS is 220,289/220,160B (+129B). Pinned main also exceeds these strict limits (same-box main 371,416/220,246B; hosted main largest 220,180B). CI has intentionally treated those limits as warnings since 9ed5a04. No budget, baseline, or suppression was changed; startup module graphs are unchanged. This remains a limitation, not a passing gate.

Remote execution used provider blacksmith-testbox: timing and initial broad checks on tbx_01m3hk6bvpyk6dksvzz8zndb75 (run), then remaining UI coverage and test-only checks on tbx_01m3ht85qsbevfsd3eqt0tq0f2 (run) after the first lease ended. Both leases are stopped. Commands above ran through crabbox run --id; the replacement's prerequisite full build also passed in 385.61s.

The final test-only commit 9d8208c94377 migrates measurements from the retired virtual-sizer height to the native scroll range or owned inner rectangle. Its production sources are identical to the benchmarked 51b17d218305.

Before After
Before transcript layout After transcript layout

Final isolated Codex review through P2 is scoped-clean; deslop is complete. Production LOC: +324/−174, net +150; tests/support: +182/−165, net +17. Production growth implements the missing geometry producer and observer lifecycle while removing the old observation path and duplicate extent write.

Related: #159428 also touches the offset observer and virtualizer host to compensate row resizing during scrollback. It addresses a different defect; the coordinator should reconcile both owner changes if both land. Scroll-state freshness and scroll-driven rendering already on main were preserved.

CI follow-up after the main merges

Commit 08e2566bb016b migrates three footer-placement assertions to the owned transcript viewport. The full UI job exposed expectations that the native .chat-thread remained a direct footer sibling. The tests now retain exact viewport → jump-to-bottom control → footer ordering and also require the native .chat-thread[role="log"] directly inside the viewport. Swarm placement, composer ordering, and approval authority assertions are unchanged. This repair changes no production code (tests: +6/−2).

Same-box comparison on Blacksmith Testbox tbx_01m3j8bp13f9bggysv35ydhgte: current main df3ea62faa2f passed all three original cases in 4.91s; PR head 654ccbb76182 failed those same three cases in 4.71s. After repair, they pass in 2.96s; all 14 end-anchor browser cases pass in 5.92s. node scripts/check-changed.mjs --base 654ccbb761825e2106f0330e685c94eb573386db passed in 220.30s with zero lint warnings/errors. Deslop is complete and isolated Codex autoreview through P2 is clean. The Testbox is stopped. Squash auto-merge remains armed; exact-head hosted CI is being watched.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 27, 2026 17:48
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 4:54 PM ET / 20:54 UTC (Revision 5).

ClawSweeper review

What this changes

The Control UI chat pane moves transcript sizing into one layout owner and narrows menu styling to reduce browser work during streamed replies.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open. Current main retains the synchronous transcript observation path, while the PR has distinct performance work supported by production-browser measurements and focused scroll coverage. This review found no actionable patch defect.

Priority: P2
Reviewed head: 3c29b206754bd8dbba232bac025402b3865f54b7

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The focused owner change has unusually thorough browser measurements, behavioral coverage, and visual parity evidence, with no identified correctness or security defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Production-build Chromium comparisons exercised streamed chat plus typing and observed complete delivery with lower renderer work; inspected before/after images support visual parity. The final head retains the previously reviewed production paths, and no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Production-build Chromium comparisons exercised streamed chat plus typing and observed complete delivery with lower renderer work; inspected before/after images support visual parity. The final head retains the previously reviewed production paths, and no stored-data contract changes.
Evidence reviewed 9 items Current-main boundary: At the pinned main revision, the virtualizer host still calls the pre-update geometry path; the new layout-owner file is absent. The PR's central work is therefore not already on main.
Introduced layout owner: The new owner observes the viewport slot, writes measured transcript height, and publishes actual scroll corrections.
Scroll ownership: The offset observer now records reader intent and retires maintenance receipts after native scroll delivery; the host removes commit-time end-anchor sampling.
Findings None None.
Security None None.

How this fits together

The Control UI receives streamed chat updates from the Gateway while the reader types and scrolls. Its transcript renderer turns those updates into measured rows and a native scroll viewport.

flowchart LR
  A[Gateway chat chunks] --> C[Chat pane]
  B[Reader typing] --> C
  C --> D[Virtual transcript rows]
  D --> E[Layout owner]
  E --> F[Scroll viewport]
  G[Reader scroll] --> H[End anchor]
  H --> F
Loading

Before merge

  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
Agent review details

Security

None.

PR surface

Source +150, Tests +21. Total +171 across 32 files.

View PR surface stats
Area Files Added Removed Net
Source 19 324 174 +150
Tests 13 188 167 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 32 512 341 +171

Review metrics

Metric Value Why it matters
Production and test growth production +150 net; tests/support +21 net The production growth supplies the new geometry owner while removing the prior observation path.
Interleaved browser comparison 8 runs; renderer time −5.03%; long tasks −25.53% The measured improvement covers streamed output with concurrent typing and complete chunk delivery.

Technical review

Best possible solution:

Keep the layout and scroll responsibilities with their existing owners, preserving end-follow, reader scrollback, history anchoring, and visual parity when this work lands.

Do we have a high-confidence way to reproduce the issue?

Yes. The PR describes a repeatable production-build Chromium scenario with streamed chunks and concurrent typing, and the pinned main source retains the measured commit-time path; this read-only review did not rerun it on exact current main.

Is this the best way to solve the issue?

Yes. The patch moves sizing writes to one transcript owner and preserves the existing scroll and composer owners, with browser coverage for the main anchoring cases.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a measured Control UI responsiveness improvement with limited product blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Production-build Chromium comparisons exercised streamed chat plus typing and observed complete delivery with lower renderer work; inspected before/after images support visual parity. The final head retains the previously reviewed production paths, and no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Production-build Chromium comparisons exercised streamed chat plus typing and observed complete delivery with lower renderer work; inspected before/after images support visual parity. The final head retains the previously reviewed production paths, and no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Marvinthebored: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vyctor H. Brzezowski: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-27T17:55:18.041Z sha 9d8208c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T18:25:07.861Z sha 9d8208c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T18:53:33.526Z sha 429a06f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T20:12:09.006Z sha 654ccbb :: needs maintainer review before merge. :: none

@steipete
steipete enabled auto-merge (squash) September 27, 2026 18:18
@steipete
steipete merged commit 23e8398 into main Sep 27, 2026
111 checks passed
@steipete
steipete deleted the perf/l108-transcript-geometry-invalidation-20260927 branch September 27, 2026 21:04
steipete added a commit that referenced this pull request Sep 27, 2026
Carry virtualizer maintenance writes into the existing end anchor before
publishing their offset observations. Keep layout and composer correction
receipts on their existing owner paths so they are not applied twice.

This repairs late-layout end-follow after #159806: a clamped measurement
retry could move the viewport 11px while leaving the captured anchor stale,
causing reconciliation to abandon the final reply below the dock.

Extend the browser wheel-intent cases with same-task intrinsic growth above
and at the end of the viewport, without requesting a render. The downward
case fails on the baseline and passes with the receipt handoff; upward
reader intent remains preserved. No new geometry reads or per-frame work.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
* perf(ui): own transcript geometry without commit-time observations

* fix(ui): preserve transcript announcements through shell nesting

* perf(ui): bound people submenu style invalidation

* perf(ui): isolate intrinsic sizing within the transcript range

* test(ui): measure the owned transcript scroll range

* test(ui): align footer placement assertions with viewport ownership
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…w#159955)

Carry virtualizer maintenance writes into the existing end anchor before
publishing their offset observations. Keep layout and composer correction
receipts on their existing owner paths so they are not applied twice.

This repairs late-layout end-follow after openclaw#159806: a clamped measurement
retry could move the viewport 11px while leaving the captured anchor stale,
causing reconciliation to abandon the final reply below the dock.

Extend the browser wheel-intent cases with same-task intrinsic growth above
and at the end of the viewport, without requesting a render. The downward
case fails on the baseline and passes with the receipt handoff; upward
reader intent remains preserved. No new geometry reads or per-frame work.
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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L 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