Repository navigation
fix(control-ui): stop closed menus from slowing chat reloads - #174701
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 maintainer review before merge. What this changesAdds an opt-in cold-load benchmark scenario with 48 sharing identities, six selected members, and synthetic avatars. Example: Run the cold-load benchmark with --closed-menu-members.
Review scores
ProductKind: Test only · Worth it: Yes Merge readiness✅ Ready for maintainer review Keep this PR open as an explicitly paused maintainer experiment; the fixture changes are coherent, and no concrete introduced defect was found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe benchmark feeds synthetic Gateway responses and HTTP assets into the production Control UI bundle and records browser performance artifacts. flowchart LR
A[Benchmark flag] --> B[Team scale fixture]
B --> C[Mock Gateway responses]
B --> D[Synthetic avatar routes]
C --> E[Production Control UI bundle]
D --> E
E --> F[Browser performance artifacts]
Technical reviewBest possible solution: Retain the draft as the measurement anchor until its owner finishes the experiment and determines whether a production optimization is justified. Do we have a high-confidence way to reproduce the issue? Source inspection supports the populated sharing-response path and eager menu-entry construction, but does not establish the reported performance timings; no target code was executed. Is this the best way to solve the issue? Extending the existing opt-in fixture is a focused way to investigate the suspected cost without introducing a second benchmark owner or changing production behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 776a75f2dbc3. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +32, Other +2. Total +34 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed October 16, 2026, 5:46 PM ET / 21:46 UTC. |
9c6ca7b to
76b1631
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
76b1631 to
890225b
Compare
890225b to
9e3d667
Compare
|
@clawsweeper re-review The branch, description, and proof are current at 9e3d667. Exact-head CI is green. The full UI inventory, focused browser follow-ups, main-baseline failure evidence, and seven-pair performance comparison are in the PR body. This campaign PR remains for human review and landing. |
|
🦞👀 Re-review progress:
|
…law#174701) A live CPU profile of the Team board reload (r145, source-mapped) showed closed menus building their full entry lists as JSX inside memos: the session-sharing menu created an owner chip, avatar (each starting an image fetch) and icons for every member, and the pane layout menu built every quick action with its keyboard shortcut, all while closed and rebuilt on each recompute. A Team-scale census found 3,058-3,072 icons constructed per reload versus 158 attached, with menus accounting for 96.5% of discarded icon owners. Sharing, pane layout and header quick-action entries are now lazy memos, so a closed lazy Menu never builds them. Quick actions map through a keyed mapArray by action id, so recomputes update existing entries, and sharing members render SessionOwnerChip as a component. Seven interleaved AWS c7a.4xlarge pairs with populated closed sharing menus: LoAF blocking 403 -> 263 ms (-35%, IQR [399, 422.5] -> [256.5, 292.5]); avatar requests 58 -> 10; FCP unchanged. Tradeoff: sharing menu first-open admission 30.8 -> 71.9 ms, since rows are now built on open. Runtime +75 LOC. Full UI e2e 815 files pass apart from one failure reproduced on main; exact-head CI green.
…n open (#174803) On busy Team the closed header session menu kept tracking live session and owner data and re-rendered on every change: r145 board reloads showed 290-583 header-menu mutations after load while the menu stayed closed. The menu now parks its presentation and owner roster while closed (createParkedProjection with a preparation signal, so the idle prewarm from #173867 still prepares rows once), and on open reconciles the delta by key instead of rebuilding. createParkedProjection gains an optional preparation argument; existing callers keep their behavior. Seven interleaved AWS c7a.4xlarge pairs with the Team-scale live-event stream: stream LoAF blocking 520 -> 407 ms (non-overlapping IQR); late header mutations 48 -> 0. After rebasing onto #174701, 3 pairs: stream blocking 371 -> 314 ms (non-overlapping), mutations 48 -> 0, first-open p50 clean 26 -> 38.2 ms and accumulated 28.8 -> 27.9 ms (within the +16 ms budget). Runtime +36 LOC. 274 focused/native tests pass; exact-head CI green apart from a plugin-steering shard failure reproduced on main.
…enu entries (#175011) A Team-scale census (L120) found closed menus constructing icons and keyboard shortcuts for every entry on each reload: the panel type menu built 397 icons to keep 1, the widget card menu 95, and the progress card refresh item 45. #174701 fixed the sharing and layout menus; these three still built their entries eagerly. Panel type, widget card and progress card menu entries now follow the #174701 idiom: lazy memos so a closed lazy Menu builds nothing, keyed mapArray entries with getters for live fields, so recomputes update instead of rebuilding. Constructed icons per menu fall to 1. Reload LoAF blocking, 22 interleaved AWS c7a.4xlarge pairs over two independent leases, decided by a rule fixed before the confirmatory run: candidate better in 16/22 pairs, pooled median paired delta -37 ms (run medians 280 -> 249 ms and 250 -> 240 ms). Runtime +33 LOC; sharing and the Menu primitive are unchanged. Focused tests and Chromium/WebKit menu coverage pass; full-UI failures all reproduce on baseline; the remaining CI red is an inherited snapshot type error already fixed on main (c711c07).
…n open (openclaw#174803) On busy Team the closed header session menu kept tracking live session and owner data and re-rendered on every change: r145 board reloads showed 290-583 header-menu mutations after load while the menu stayed closed. The menu now parks its presentation and owner roster while closed (createParkedProjection with a preparation signal, so the idle prewarm from openclaw#173867 still prepares rows once), and on open reconciles the delta by key instead of rebuilding. createParkedProjection gains an optional preparation argument; existing callers keep their behavior. Seven interleaved AWS c7a.4xlarge pairs with the Team-scale live-event stream: stream LoAF blocking 520 -> 407 ms (non-overlapping IQR); late header mutations 48 -> 0. After rebasing onto openclaw#174701, 3 pairs: stream blocking 371 -> 314 ms (non-overlapping), mutations 48 -> 0, first-open p50 clean 26 -> 38.2 ms and accumulated 28.8 -> 27.9 ms (within the +16 ms budget). Runtime +36 LOC. 274 focused/native tests pass; exact-head CI green apart from a plugin-steering shard failure reproduced on main.
…enu entries (openclaw#175011) A Team-scale census (L120) found closed menus constructing icons and keyboard shortcuts for every entry on each reload: the panel type menu built 397 icons to keep 1, the widget card menu 95, and the progress card refresh item 45. openclaw#174701 fixed the sharing and layout menus; these three still built their entries eagerly. Panel type, widget card and progress card menu entries now follow the openclaw#174701 idiom: lazy memos so a closed lazy Menu builds nothing, keyed mapArray entries with getters for live fields, so recomputes update instead of rebuilding. Constructed icons per menu fall to 1. Reload LoAF blocking, 22 interleaved AWS c7a.4xlarge pairs over two independent leases, decided by a rule fixed before the confirmatory run: candidate better in 16/22 pairs, pooled median paired delta -37 ms (run medians 280 -> 249 ms and 250 -> 240 ms). Runtime +33 LOC; sharing and the Menu primitive are unchanged. Focused tests and Chromium/WebKit menu coverage pass; full-UI failures all reproduce on baseline; the remaining CI red is an inherited snapshot type error already fixed on main (108185f).
…176414) The chat composer built every picker's entries when the pane mounted: the talk/dictation input picker, permission picker, plus-menu and model-picker entry lists were computed eagerly although they're closed on load. A source-mapped live profile of a Team session reload attributed ~36 ms (traced) of the deferred pane mount to ChatComposerView. Those entry lists are now lazy memos (the #174701 idiom), so a closed lazy Menu builds nothing until it opens; visible composer controls render immediately. Seven interleaved AWS c7a.4xlarge pairs per route: composer CPU 32.664 -> 21.953 ms on dashboard reloads (-32.8%) and 32.313 -> 24.377 ms on chat (-24.6%), 7/7 pairs each; LoAF blocking inconclusive. First-open p50 increases stay within +16 ms (largest +15.6 ms, model picker). Runtime +7 LOC. 71 unit tests, 30 native browser cases and 9 focused e2e cases pass; full UI e2e has one inherited failure; exact-head CI green.
…penclaw#176414) The chat composer built every picker's entries when the pane mounted: the talk/dictation input picker, permission picker, plus-menu and model-picker entry lists were computed eagerly although they're closed on load. A source-mapped live profile of a Team session reload attributed ~36 ms (traced) of the deferred pane mount to ChatComposerView. Those entry lists are now lazy memos (the openclaw#174701 idiom), so a closed lazy Menu builds nothing until it opens; visible composer controls render immediately. Seven interleaved AWS c7a.4xlarge pairs per route: composer CPU 32.664 -> 21.953 ms on dashboard reloads (-32.8%) and 32.313 -> 24.377 ms on chat (-24.6%), 7/7 pairs each; LoAF blocking inconclusive. First-open p50 increases stay within +16 ms (largest +15.6 ms, model picker). Runtime +7 LOC. 71 unit tests, 30 native browser cases and 9 focused e2e cases pass; full UI e2e has one inherited failure; exact-head CI green.
What Problem This Solves
Fixes unnecessary rendering and avatar requests from closed sharing and Layout menus during a signed-in reload of a dashboard deep link.
User Impact
Reload blocking fell 35% in seven interleaved baseline/candidate pairs on a quiet AWS c7a.4xlarge, with non-overlapping interquartile ranges. Closed sharing menus no longer fetch all 48 off-screen member avatars. Menu appearance, keyboard navigation, filtering, disabled reasons, check marks, and focus return are preserved.
The work moves to first open: sharing's initial content admission rose from 30.8 to 71.9 ms (rendering-opportunity bound 66.0 to 104.6 ms). These measurements do not represent completion of the member refresh. Layout initial admission changed from 49.8 to 51.6 ms. First contentful paint stayed at 452 ms median. No product configuration or stored-data changes.
Why This Change Was Made
The campaign's initial signed-in dashboard reload had 14 visible states over roughly 15 seconds, with dashboard content first appearing at 11.75 seconds. Later source-mapped reload attribution identified JSX construction inside closed-menu memos as a remaining CPU cost.
Lazy entry owners defer member and quick-action UI until the menu requests it. The keyed mapper itself is lazy because constructing it creates row owners. Rows retain avatars, labels, checks, and shortcuts across reactive updates. Surrounding sharing entries stay memoized so filtering retains search focus. The old bulk quick-action builder and redundant opened-once flag are removed; the shared Menu primitive continues to own navigation, focus return, and selection.
Runtime delta: +75 lines across four menu files. The stable-row contract requires row owners and live metadata bindings in place of snapshot JSX that rebuilt every subtree. The sidebar/composer census found much smaller entry-builder costs, so this change stays with the two measured hotspots and the remaining caller of their shared builder. The opt-in fixture supplies supported PNG avatars and keeps people/member setup in one bounded helper.
Evidence
Performance
Final head:
9e3d667472b3b3d08a08f3e2e5d5df3c14780619; baseline:764b340fa1b7f63843699ff2efda6daffc19d7fd.Team-scale board-dashboard fixture: 300 sessions, 120 people, 48 additional human member avatars, six selected members, and Layout quick actions with shortcuts. Same c7a.4xlarge for seven interleaved pairs, repository Playwright Chromium, production bundles, warm reload, no trace during comparison. LoAF and avatar observations cover the first 15 seconds; quartiles use inclusive interpolation.
Source-mapped profiles on this head first reproduced the actual eager builders with the PNG fixture: sharing member memo 98.6 ms inclusive and Layout items memo 73.5 ms. Neither entry-construction hotspot appeared in the candidate reload sample. These traced values establish attribution; the table uses the subsequent untraced comparison.
AWS lease:
cbx_a8ea07846db0, requested and observed c7a.4xlarge (16 AMD EPYC cores, 32.9 GB RAM). CPU attribution run · Final comparison and validation run.Validation
pnpm test <file> --maxWorkers=1: sharing 8.37 s; pane header 14.08 s. Header session menu: 7.22 s.pnpm test ui/src/e2e/chat-boot-render-storm.e2e.test.ts --maxWorkers=1. Focused AWS run, leasecbx_fa95631403d1(released).cbx_016c0ed14a95(released).node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts: 817 files; 813 passed, 3 failed, 1 skipped, in 5343.48 s. Test totals: 3527 passed, 1 failed, 5 skipped.extensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts: its configured-owner case fails before UI interaction withPrivate mutation boundary is writable by another POSIX principal.The same file on detached main at764b340fa1b7f63843699ff2efda6daffc19d7fdreproduces the same failure in the same private-file boundary; both runs have one passing and one failing case. This PR changes none of that path.desktop-resize.real-gateway.e2e.test.tsintentionally skips withoutOPENCLAW_DESKTOP_REAL_FIXTURE; this external desktop fixture was not supplied. After the focused browser follow-ups, coverage is 815 passing files, 1 inherited failing file, 1 fixture-gated skipped file (3531 passing, 1 inherited failing, 1 skipped test).cbx_a8ea07846db0and pinned revisions. The complete file inventory is below.node scripts/check-changed.mjs --base 764b340fa1b7f63843699ff2efda6daffc19d7fdcompleted: 29 core-test typecheck shards, production UI types, scripts types, lint, formatting, dead-export scans, line-cap growth, and all other guards pass except the inherited max-lines suppression check. Detached main reproduces the same three suppression errors inchat-message.test.tsx,config-page-state.ts, andsessions-page-state.ts; none is changed by this PR.Synthetic visual proof
Inspected full captures contain synthetic fixture data only. Sharing is scrolled to its first member; Layout includes shortcuts and checks. GitHub attachment uploads returned non-resolving URLs, so these verified PNGs use the Crabbox artifact store. Signed image links expire October 23, 2026.
Requested filtered diff statistics
The requested filter includes TSX unit tests, benchmark scripts, and fixture helpers. Its total is +203 lines; application runtime alone is +75.
Full UI e2e file inventory, including focused follow-ups
Only filenames and outcomes are included. The two WebKit setup failures passed after installing the missing browser; the QA failure was reproduced on the pinned main baseline.