Repository navigation
perf(ui): keep streaming chats responsive - #159806
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 27, 2026, 4:54 PM ET / 20:54 UTC (Revision 5). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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
Before merge
Agent review detailsSecurityNone. PR surfaceSource +150, Tests +21. Total +171 across 32 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
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.
* 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
…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.
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.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
scrollHeightreads 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 --jsonbefore 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.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 ontbx_01m3hk6bvpyk6dksvzz8zndb75(run), then remaining UI coverage and test-only checks ontbx_01m3ht85qsbevfsd3eqt0tq0f2(run) after the first lease ended. Both leases are stopped. Commands above ran throughcrabbox run --id; the replacement's prerequisite full build also passed in 385.61s.The final test-only commit
9d8208c94377migrates measurements from the retired virtual-sizer height to the native scroll range or owned inner rectangle. Its production sources are identical to the benchmarked51b17d218305.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
08e2566bb016bmigrates three footer-placement assertions to the owned transcript viewport. The full UI job exposed expectations that the native.chat-threadremained 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 maindf3ea62faa2fpassed all three original cases in 4.91s; PR head654ccbb76182failed 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 654ccbb761825e2106f0330e685c94eb573386dbpassed 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.