Repository navigation
perf(control-ui): reduce forced layout during cold reloads - #169288
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: needs changes before merge. What this changesThis PR batches Control UI geometry measurements and reuses transcript margins to reduce forced layout during reloads. Example: Reload the synthetic Dashboard split containing 100 transcript messages and a paused goal.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the measured reload optimization remains useful, but the previously reported separator accessibility regression still blocks merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherControl UI render, resize, and scroll events enter browser geometry owners, which publish overflow indicators, sidebar presentation, panel geometry notifications, and transcript offsets. flowchart TD
A[Render resize and scroll events] --> B[Shared layout frame]
B --> C[Scroll and marquee measurements]
B --> D[Panel geometry measurements]
C --> E[Overflow and fade state]
D --> F[Transcript geometry notifications]
G[Owned transcript margin] --> H[Transcript rendering]
Technical reviewBest possible solution: Keep the shared geometry batching while publishing the separator's actual split through its existing geometry owner. Do we have a high-confidence way to reproduce the issue? The supplied browser comparison establishes the reload problem, and the production caller plus introduced value publication establish the accessibility failure; this read-only review ran no target code or tests. Is this the best way to solve the issue? Shared read-before-write batching is a reasonable bounded optimization, provided measurement-backed divider callers retain accurate accessibility state. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5b29c851c827. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +71, Tests +152. Total +223 across 14 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 11, 2026, 9:11 PM ET / October 12, 2026, 01:11 UTC (Revision 7). |
e0a0efc to
eaa9342
Compare
eaa9342 to
54e3646
Compare
|
Landed with an admin squash merge pinned to the reviewed head After re-running only the failed/cancelled jobs of run 38171052556, every job passed except |
…169288) Scroll-state directives and the sidebar session scroll classifier now share one ResizeObserver and a frame-batched layout scheduler that reads each element's geometry once per frame before any writes and publishes only changed state. The side-panel divider no longer measures on every update, and transcript header/virtualizer reuse transcript-owned geometry. Synthetic cold reloads: forced layouts 57 -> 31 (median), forced-layout time 106 -> 69 ms in the first 5 s.
What Problem This Solves
A signed-in reload of a dashboard deep link repeatedly forces layout while scroll indicators, sidebar state, and the divider update. The campaign trace recorded 122 forced layouts and 658 ms of total layout in the first 4.5 seconds.
User Impact
Less synchronous layout work during reload, with the existing scroll fades, resize gestures, divider persistence, and transcript anchoring retained. No configuration, server records, or migrations change.
Why This Change Was Made
One ResizeObserver now serves scroll-state directives and sidebar classification. It shares the existing marquee read/write batching pattern through a common frame owner: all geometry reads finish before changed state is published. The sidebar geometry commit joins that batch. This removes per-directive microtasks/observers, the duplicate sidebar classifier, and separate marquee/sidebar frame queues. The observer is released when its last subscriber disconnects.
The divider renders its supplied ratio and measures for user interaction. Transcript rendering uses the already-owned scroll margin; initial viewport measurement, prepend anchoring, and end-follow retain their existing timing. This is a bounded improvement, not a claim that all transcript geometry reads are gone.
Evidence
Exact comparison: base
d220cac2b74433fdb189ac381b9fca2bfcaf7e07, head54e3646ad3843fed2e31c2d9e17ba350ed41edc3. Three new headless Chrome reloads per revision, first five seconds after navigationStart. Synthetic source-Vite/mock-Gateway fixture: 100 messages, 80 supplied sessions (10 initially visible), an empty Dashboard side panel, one paused goal, and 2,043 DOM elements. ALayoutevent with a JS stack counts as forced.These are comparative synthetic measurements, not deployed Team timings. Inspected before/after screenshots retain the same layout and transcript end position; no private captures were uploaded.
The scroll batching regression fails against the original interleaved microtask reads/writes. The divider regression fails against its original render-time measurement. Existing lifecycle tests exposed and verified idle-observer retirement. Single-file wall times with the
pnpm testrunner (node scripts/run-vitest.mjs <file> --maxWorkers=1): scroll state 2.34 s, divider 3.64 s, sidebar lifecycle 4.46 s, sidebar interactions 8.54 s, progress card 2.83 s.Focused Testbox proof (
tbx_01m4p2jt4sypa9app86hstgj7z) passed, including 33 browser assertions for marquee lifecycle, transcript geometry and end-follow. Autoreview is clean at P0–P2. The full UI E2E suite ran on the final head on AWS (cbx_562afe011595): 694 files passed, 48 failed, one skipped; 3,282 assertions passed, 83 failed, three skipped. Missing Playwright FFmpeg caused most failures. After installing the pinned browser/video prerequisite, the failed-file replay passed 147 assertions and left 17 failures. All 17 reproduce on the exact main-base source, with the PR source restored afterward. The lane's spatial fades, panel geometry/persistence, width-resize anchoring, reasoning follow, and dashboard first-paint cases pass.The exact-head CI run is red on the inherited model-catalog error-copy assertion (
model-provider-usage-outcomes.e2e.test.ts), and fail-fast cancelled remaining jobs. Its fixture rejects discovery with “Model catalog temporarily unavailable”; the assertion expects the generic successful-partial-discovery warning. The same failure is confirmed on the base. Other baseline failures are listed below rather than hidden by retries or changed assertions.Full-suite baseline failures and validation limits
All remaining failed assertions reproduce on the base: automation private-path permission admission (1); cached cold-load anchor (1); saved-reader restoration (1); history hydration (1); history prepend controls (2); retained-table overflow (1); split-rail Escape dismissal (2); rail Escape dismissal (2); scroll affordance (1); subagent waiting state (1); external session history/paging (3); model catalog copy (1).
An extra whole-UI unit/browser run passed 21,900 assertions, with one menu hit-test failure and a terminal test collection error. The terminal's repository-relative file path fails from the package working directory on the base too. The menu hit-test passes in isolated execution on both the base and the PR head; its full-suite ordering issue is not root-caused here.
The unfiltered changed-file gate reaches an inherited dead-export audit failure, reproduced on the base. All remaining changed-file gates passed in 5m45s on the exact head with
OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1, scoped to that reproduced baseline failure. The asset budget also reports 36 chat requests against a limit of 35 on both base and head. Regenerating the boot manifest still reports 36 and mostly changes unrelated migration entries; that generated churn is not included. No budget threshold is relaxed.Production delta: +222 / −151 = +71 LOC across 10 production files. The requested exclusion-based diff also counts two net lines in the sidebar test helper (+73 total). Growth pays for the shared subscription/disconnection owner and frame scheduler while deleting the superseded queues and classifier.