Skip to content

perf(ui): defer closed agent selector work - #189725

Merged
steipete merged 3 commits into
mainfrom
solid2/w-perf-route-shared-1031
Oct 31, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-perf-route-shared-1031

Conversation

@steipete

@steipete steipete commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

First visits to Settings construct 300 agent-menu rows and avatars while the selector is closed. Leaving New Session also disposes that unused tree in the same task as the destination mount. This adds shared work to every measured page.

User Impact

The selector now builds its options on first opening and retains them afterward, including across Settings navigation, roster updates, and selection changes. Route visits and the complete visit-through-first-open flow improve on all measured browser/viewport profiles. Standalone first opening is slower because it now pays for row construction; that intentional tradeoff is reported below.

Why This Change Was Made

Use the existing lazy Menu lifecycle. Separate lazy trigger/menu avatar projections have independent view leases and share the existing authenticated image cache. Keep the keyed option-row projection for live captured row properties, but replace the redundant menu-item projection with a lazy memo.

The selector already persists across Settings routes. Source-mapped 4× traces show selector/avatar/menu work disappearing from closed-route visits and sampled bridge disposal falling from roughly 30–37 to 9–13 ms. Mixed teardown/mount tasks are about 194 ms on Advanced and 129–133 ms on Plugin Settings. Advanced desktop's later 212 ms traced task is config-form construction. No new route-disposal scheduler is justified or introduced.

Validation

Acceptance uses the requested seven representative pages, Chromium 1× and 4×, WebKit, desktop/mobile, twenty interleaved base/head/base triplets per cell, and same-machine frozen production bundles. A/A controls and Chromium renderer CPU qualify noisy elapsed timing. WebKit reports elapsed time only. The committed combined scenario starts in New Session and measures navigation through hydrated opening in the same document; native click timing alone would omit baseline eager work.

Performance evidence

54/54 complete cells, 3,240/3,240 observations passed. Twenty serial base/head/base triplets per cell, production bundles, synthetic Gateway, localhost, headless. The per-page route table is included below; local artifacts retain full distributions, paired deltas, counts, and provenance.

Ranges below are the minimum and maximum per-page deltas across completed cells, not pooled observations. CPU is Chromium renderer main-thread threadTicks TaskDuration; WebKit has no CPU claim. Positive deltas mean slower/larger.

Profile View Complete routes Visit median Δ range Visit p95 Δ range CPU median Δ range CPU p95 Δ range Head longest task max Noisy visit A/A cells
1x desktop 7/7 -41.4% to -15.2% -43.5% to -23.7% -44.5% to -24.6% -45.0% to -25.4% 56.0 ms 6/7
1x mobile 7/7 -28.2% to -12.2% -25.2% to -11.6% -44.7% to -22.5% -46.5% to -26.6% 56.0 ms 6/7
4x desktop 7/7 -34.8% to -18.2% -32.9% to -15.1% -44.1% to -24.8% -44.9% to -24.3% 327.0 ms 7/7
4x mobile 7/7 -34.2% to -18.6% -36.5% to -18.9% -43.5% to -24.4% -40.2% to -21.8% 256.0 ms 4/7
webkit desktop 7/7 -41.3% to -17.7% -35.0% to -16.0% — — — ms 7/7
webkit mobile 7/7 -40.6% to -18.7% -39.2% to -18.1% — — — ms 4/7

Standalone first-open includes deliberately deferred menu construction. The combined measurement includes the same-document route visit through the completed first open; these are separate workloads and are never added together. B/H/C is the passed sample count.

Flow Profile/view B/H/C Time base → head median/p95 (ms) Δ median/p95 CPU base → head median/p95 (ms) CPU Δ median/p95 A/A time Δ median/p95
first-open 1x/desktop 20/20/20 212.2/480.1 → 260.7/402.8 +22.9%/-16.1% 95.7/100.7 → 112.4/117.8 +17.4%/+17.0% +0.6%/-6.0%
first-open 1x/mobile 20/20/20 155.3/156.4 → 172.3/183.5 +11.0%/+17.4% 85.4/86.9 → 100.8/106.4 +18.1%/+22.5% -0.0%/+0.8%
combined 1x/desktop 20/20/20 407.4/436.0 → 371.8/387.9 -8.7%/-11.0% 293.7/307.7 → 253.1/259.6 -13.8%/-15.6% +0.1%/+0.1%
combined 1x/mobile 20/20/20 903.8/907.7 → 863.8/872.7 -4.4%/-3.9% 326.0/336.7 → 269.0/287.1 -17.5%/-14.7% +0.1%/+1.6%
first-open 4x/desktop 20/20/20 476.0/527.3 → 575.5/627.3 +20.9%/+19.0% 417.5/432.5 → 497.8/528.9 +19.2%/+22.3% -0.7%/-6.6%
first-open 4x/mobile 20/20/20 412.3/440.7 → 495.0/528.1 +20.1%/+19.8% 354.1/382.6 → 431.7/468.1 +21.9%/+22.3% +0.1%/+1.4%
combined 4x/desktop 20/20/20 1,365.4/1,446.5 → 1,251.8/1,349.2 -8.3%/-6.7% 1,287.8/1,372.2 → 1,166.5/1,277.7 -9.4%/-6.9% +0.5%/+3.6%
combined 4x/mobile 20/20/20 1,860.8/1,910.6 → 1,726.3/1,797.3 -7.2%/-5.9% 1,428.6/1,467.1 → 1,218.5/1,292.8 -14.7%/-11.9% -0.6%/+1.8%
first-open webkit/desktop 20/20/20 191.1/209.8 → 208.0/225.7 +8.8%/+7.6% — — -0.2%/-0.8%
first-open webkit/mobile 20/20/20 175.8/192.6 → 193.4/219.5 +10.0%/+14.0% — — +0.1%/-0.5%
combined webkit/desktop 20/20/20 556.0/575.0 → 490.0/506.0 -11.9%/-12.0% — — +0.3%/-0.3%
combined webkit/mobile 20/20/20 1,034.5/1,056.0 → 973.0/987.0 -5.9%/-6.5% — — -1.0%/-1.3%

Production selector LOC: 209 → 221. Zero new effects or signals; one redundant projection removed. The retained keyed option-row projection preserves custom renderer identity. Full report retains all statuses, failure/error counts, head/control comparisons, host load, requests, CLS, and closed/open menu structure.

The requested lazy-first-open tradeoff is accepted because all six combined-flow cells improve median and p95, with Chromium whole-flow CPU also lower. It is not a claim that standalone opening improved: at 4×, its whole-run wall median rises about 20–21% and CPU about 19–22%; native WebKit input-to-commit rises from 70/72 to 91/98 ms desktop and 72/77 to 90/94 ms mobile (median/p95). Closed menus have zero option rows instead of 300. Every opening finishes with 300 rows, 300 avatars, and selected-row focus. The combined flow performs the same 299 identity reads in every base/head/control group, and opening adds zero. Chromium CLS remains zero.

One small combined-flow subphase tradeoff remains explicit: 4× desktop layout p95 is 118.793 → 127.143 ms (+7.0% versus base, +3.9% versus control), while its median is +0.7% versus base/−0.8% versus control and A/A p95 moves +3.0%. This is accepted alongside lower total CPU p95 (−6.9%) and longest-task p95 (368 → 314 ms); it is not described as every subphase improving.

The absolute long-task goal is not fully reached: the maximum observed route task is 56 ms at 1×, 327 ms at desktop 4×, and 256 ms at mobile 4×. These are residual targets, not regressions; every measured route improves CPU median/p95 or, for WebKit, elapsed median/p95. The shared teardown trace no longer identifies a worthwhile route-lifecycle change. Page-specific remaining work belongs to its rendering owner.

Ten additional serial base/head/base triplets requalified the two flagged 4× layout tails (60 more observations, all passed), using the same frozen bundles. No pooling with the original runs:

Repeat Layout median/p95 base → head → control (ms) CPU median/p95 base → head (ms)
Mobile About 37.818/42.570 → 38.909/44.039 → 37.740/40.758 470.300/489.991 → 272.643/285.957
Desktop Channels 33.159/35.690 → 32.475/35.569 → 32.975/38.376 712.930/766.808 → 430.513/462.608

Channels' earlier tail increase does not repeat. About's initial +23.3% layout p95 does not repeat; the repeat is +3.5% versus base and +8.1% versus control (1.469/3.281 ms), with median +2.9%/+3.1% and A/A p95 −4.3%. That small layout-subphase cost is accepted with the ~42% whole-CPU reduction and faster route readiness; it is disclosed rather than described as no movement.

Production builds on the same Mac: startup JS 89,334 → 89,366 B gzip (+32 B); startup CSS 33,947 B, one request, unchanged. Strict base comparison passes. The base already exceeds the total-CSS cap; this PR changes no CSS. Chat/New boot changes remain within their existing caps.

Focused checks passed: 13 selector unit tests; 36 Settings-sidebar/Chromium opening tests; UI and scripts typechecks; changed-file lint/format; production Knip. Existing row assertions remain and now open the lazy menu first. Independent full-range Codex review and hosted reviews found no actionable findings. CI used ci:full and its Control UI performance check passed.

CI attribution

PR run 41236263289, attempt 1, tested merge 5e13c947bbb07ec72496e7523d6fbe927763594a with parents main c0b741764fee65c1faf1c53b152882dc425f81e9 and PR head e8fe9b72f6c805a8bf6b6d79a2c946d5792c062d. Its failed CI result is preserved. All failed cases are inherited; landing uses the documented native inherited-failure route.

Failed cases Baseline evidence
session pull request chips > keeps every PR visible and actionable at 1440 in light; session pull request chips > offers a compact publication row while rate limited on desktop Same names fail in job 124648551332 of completed scheduled main run 41238866951.
Details Environment changes > shares read-only Uncommitted demand between Environment and Review and recovers retained counts The exact old test fails on both frozen base and head with four reads where it expects three (line 210). CI hits the adjacent aria-busy false/true assertion (line 209). These are distinct observations of the same obsolete shared-read expectation; summary/full request separation predates the base. Main already fixes and renames the stale test in #189730.
Quiet automation real Gateway boundary > keeps checks quiet while preserving meaningful status, freshness, visible results and run evidence Same final-reload failure in job 124648550746 of completed main run 41238866951.

Named test/render/style inputs are unchanged between the CI main parent and tested merge. The isolated Details replay uses Node because its config exercises Playwright E2E; ordinary focused tests used the pinned default runtime. No full local suite or local Docker was run.

Size and ownership

AgentSelect 209 → 221 lines (+12); directly coupled tests 1,694 → 1,737 (+43); existing benchmark module 1,230 → 1,272 (+42). Seven files, +134/−37. No new signals, effects, listeners, DOM queries, flush calls, owner-capture calls, dependencies, CSS, or route cleanup scheduling. Memos 4 → 5; keyed projections 2 → 1; lifecycle setup callsite 1 → 1.

All seven route cells per browser and viewport

B/H/C = passed base/head/control samples. Δ columns are head/base. A/A is control/base. A noisy A/A flag never waives a regression; use the three comparisons and CPU/counts together.

Profile View Page B/H/C Visit B → H med/p95 Δ med/p95 CPU B → H med/p95 Δ med/p95 Head longest task p95/max A/A visit Δ med/p95 Visit assessment
1x desktop advanced 20/20/20 226.0/263.6 → 191.5/201.2 -15.2%/-23.7% 282.2/291.8 → 212.9/217.7 -24.6%/-25.4% 0.0/0.0 +2.0%/+0.9% within band vs both references
1x desktop plugin-settings 20/20/20 234.1/364.7 → 168.9/269.9 -27.9%/-26.0% 238.9/258.3 → 176.3/182.2 -26.2%/-29.4% 0.0/0.0 +3.5%/-17.9% within band vs both references; A/A noisy
1x desktop appearance 20/20/20 164.1/180.4 → 116.1/127.5 -29.2%/-29.3% 180.5/186.7 → 125.0/129.7 -30.7%/-30.5% 0.0/0.0 -1.2%/-5.5% within band vs both references; A/A noisy
1x desktop about 20/20/20 102.0/112.6 → 59.8/63.6 -41.4%/-43.5% 114.1/121.4 → 63.4/66.8 -44.5%/-45.0% 0.0/0.0 +2.4%/-1.5% within band vs both references; A/A noisy
1x desktop model-providers 20/20/20 150.8/164.5 → 97.1/106.2 -35.6%/-35.4% 163.2/167.1 → 106.2/111.1 -34.9%/-33.5% 0.0/0.0 +1.2%/+1.3% within band vs both references; A/A noisy
1x desktop channels 20/20/20 177.4/189.6 → 112.4/122.5 -36.6%/-35.4% 178.3/187.9 → 108.4/111.4 -39.2%/-40.7% 0.0/0.0 +1.5%/+13.2% within band vs both references; A/A noisy
1x desktop agents 20/20/20 184.3/199.8 → 131.8/140.4 -28.5%/-29.7% 178.9/193.4 → 126.0/131.0 -29.6%/-32.2% 56.0/56.0 -19.6%/-6.4% within band vs both references; A/A noisy
1x mobile advanced 20/20/20 199.5/222.8 → 175.1/186.8 -12.2%/-16.2% 258.6/292.6 → 200.5/214.7 -22.5%/-26.6% 0.0/0.0 +1.1%/+1.0% within band vs both references
1x mobile plugin-settings 20/20/20 173.0/180.7 → 146.0/154.0 -15.6%/-14.8% 222.0/228.7 → 163.1/167.1 -26.5%/-26.9% 0.0/0.0 +0.5%/-2.0% within band vs both references; A/A noisy
1x mobile appearance 20/20/20 121.3/131.0 → 100.9/111.8 -16.8%/-14.7% 184.4/187.9 → 124.9/131.3 -32.2%/-30.1% 50.0/51.0 -0.2%/+3.7% within band vs both references; A/A noisy
1x mobile about 20/20/20 62.1/65.0 → 46.1/49.7 -25.7%/-23.5% 108.3/115.8 → 59.9/62.0 -44.7%/-46.5% 0.0/0.0 +0.6%/+1.7% within band vs both references; A/A noisy
1x mobile model-providers 20/20/20 102.9/109.7 → 83.4/88.0 -19.0%/-19.8% 153.6/158.3 → 99.7/105.1 -35.1%/-33.6% 0.0/0.0 -1.0%/-4.3% within band vs both references; A/A noisy
1x mobile channels 20/20/20 130.0/133.2 → 93.3/99.6 -28.2%/-25.2% 168.7/175.3 → 101.5/107.4 -39.8%/-38.7% 0.0/0.0 -1.2%/+8.6% within band vs both references; A/A noisy
1x mobile agents 20/20/20 140.0/146.8 → 117.2/129.8 -16.3%/-11.6% 176.6/183.8 → 125.2/130.1 -29.1%/-29.2% 56.0/56.0 -0.4%/-1.0% within band vs both references; A/A noisy
4x desktop advanced 20/20/20 916.1/960.0 → 708.3/767.8 -22.7%/-20.0% 1,493.3/1,580.3 → 1,122.6/1,196.6 -24.8%/-24.3% 209.0/229.0 -7.2%/+2.0% within band vs both references; A/A noisy
4x desktop plugin-settings 20/20/20 896.1/1,023.8 → 716.8/775.3 -20.0%/-24.3% 1,246.5/1,384.1 → 876.5/959.8 -29.7%/-30.7% 140.0/142.0 +2.3%/-6.5% within band vs both references; A/A noisy
4x desktop appearance 20/20/20 534.2/600.1 → 419.6/465.1 -21.5%/-22.5% 821.0/919.6 → 563.5/617.2 -31.4%/-32.9% 245.0/255.0 +1.4%/+3.0% within band vs both references; A/A noisy
4x desktop about 20/20/20 284.2/322.9 → 206.5/234.1 -27.3%/-27.5% 549.0/637.6 → 307.0/351.4 -44.1%/-44.9% 113.0/123.0 +3.6%/+4.6% within band vs both references; A/A noisy
4x desktop model-providers 20/20/20 498.0/533.4 → 382.7/436.8 -23.2%/-18.1% 775.7/853.6 → 504.9/561.8 -34.9%/-34.2% 223.0/231.0 +0.8%/+5.8% within band vs both references; A/A noisy
4x desktop channels 20/20/20 670.9/727.5 → 437.6/488.1 -34.8%/-32.9% 914.5/982.1 → 526.7/580.6 -42.4%/-40.9% 187.0/195.0 +1.0%/+3.4% within band vs both references; A/A noisy
4x desktop agents 20/20/20 650.3/719.6 → 531.8/610.6 -18.2%/-15.1% 921.8/983.5 → 633.1/732.5 -31.3%/-25.5% 317.0/327.0 -2.2%/-2.7% within band vs both references; A/A noisy
4x mobile advanced 20/20/20 784.3/814.7 → 610.2/660.8 -22.2%/-18.9% 1,264.5/1,328.7 → 956.2/1,038.8 -24.4%/-21.8% 180.0/183.0 -1.3%/+4.0% within band vs both references; A/A noisy
4x mobile plugin-settings 20/20/20 784.5/920.9 → 559.5/629.1 -28.7%/-31.7% 1,171.8/1,446.0 → 812.7/965.2 -30.6%/-33.2% 142.0/156.0 -2.6%/-0.4% within band vs both references
4x mobile appearance 20/20/20 486.6/504.6 → 386.7/408.7 -20.5%/-19.0% 785.0/823.1 → 536.6/554.8 -31.6%/-32.6% 224.0/225.0 -3.6%/-0.1% within band vs both references
4x mobile about 20/20/20 267.1/292.3 → 196.9/234.8 -26.3%/-19.7% 498.4/555.1 → 281.9/332.7 -43.5%/-40.1% 103.0/109.0 +1.1%/+6.6% within band vs both references; A/A noisy
4x mobile model-providers 20/20/20 475.5/525.7 → 369.7/385.7 -22.3%/-26.6% 763.9/817.6 → 497.9/528.0 -34.8%/-35.4% 201.0/210.0 -1.6%/-3.0% within band vs both references; A/A noisy
4x mobile channels 20/20/20 541.2/620.2 → 356.1/393.7 -34.2%/-36.5% 757.7/839.3 → 432.1/502.3 -43.0%/-40.2% 151.0/198.0 -1.1%/-1.2% within band vs both references; A/A noisy
4x mobile agents 20/20/20 553.5/600.8 → 450.7/461.6 -18.6%/-23.2% 788.1/840.6 → 542.6/559.0 -31.1%/-33.5% 246.0/256.0 -0.9%/+0.9% within band vs both references
webkit desktop advanced 20/20/20 424.5/441.0 → 329.5/357.0 -22.4%/-19.0% — — —/— -1.8%/+1.4% within band vs both references; A/A noisy
webkit desktop plugin-settings 20/20/20 446.0/476.0 → 367.0/400.0 -17.7%/-16.0% — — —/— +2.1%/+3.4% within band vs both references; A/A noisy
webkit desktop appearance 20/20/20 270.5/312.0 → 194.0/229.0 -28.3%/-26.6% — — —/— +2.6%/-2.2% within band vs both references; A/A noisy
webkit desktop about 20/20/20 152.5/160.0 → 89.5/104.0 -41.3%/-35.0% — — —/— +0.3%/+16.3% within band vs both references; A/A noisy
webkit desktop model-providers 20/20/20 245.0/267.0 → 151.5/191.0 -38.2%/-28.5% — — —/— -0.8%/-3.0% within band vs both references; A/A noisy
webkit desktop channels 20/20/20 264.5/289.0 → 182.5/191.0 -31.0%/-33.9% — — —/— -1.1%/-4.5% within band vs both references; A/A noisy
webkit desktop agents 20/20/20 297.5/335.0 → 226.5/239.0 -23.9%/-28.7% — — —/— -1.2%/-9.0% within band vs both references; A/A noisy
webkit mobile advanced 20/20/20 391.0/423.0 → 318.0/336.0 -18.7%/-20.6% — — —/— +0.4%/-1.2% within band vs both references; A/A noisy
webkit mobile plugin-settings 20/20/20 332.5/409.0 → 256.5/335.0 -22.9%/-18.1% — — —/— -0.2%/-0.2% within band vs both references
webkit mobile appearance 20/20/20 254.5/271.0 → 182.0/194.0 -28.5%/-28.4% — — —/— -0.8%/+1.1% within band vs both references; A/A noisy
webkit mobile about 20/20/20 138.0/148.0 → 82.0/90.0 -40.6%/-39.2% — — —/— +2.5%/+0.7% within band vs both references
webkit mobile model-providers 20/20/20 198.0/205.0 → 134.0/140.0 -32.3%/-31.7% — — —/— +0.3%/+1.0% within band vs both references
webkit mobile channels 20/20/20 233.0/258.0 → 160.5/167.0 -31.1%/-35.3% — — —/— -0.4%/-1.2% within band vs both references; A/A noisy
webkit mobile agents 20/20/20 271.5/297.0 → 214.0/229.0 -21.2%/-22.9% — — —/— +0.9%/-3.4% within band vs both references; A/A noisy
Before and after (synthetic fixtures)

Desktop Plugin Settings before:
Desktop Plugin Settings before

Desktop Plugin Settings after:
Desktop Plugin Settings after

Mobile Advanced before:
Mobile Advanced before

Mobile Advanced after:
Mobile Advanced after

Agent selector open before:
Agent selector open before

Agent selector open after:
Agent selector open after

Mount the menu through its existing lazy owner and resolve trigger and menu avatars only when their regions consume them. Keep menu rows and their image leases stable after the first open, without rebuilding the roster avatar map on selection changes.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T19:54:37.058858Z e8fe9b7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: S labels Oct 31, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Defer agent-menu rows and unselected avatars until first opening while retaining their identity afterward.

Example: Visit Settings with 300 configured agents and Main selected.

  • Before: The closed selector constructs all menu rows and prepares roster avatars.
  • After: Only the trigger avatar is needed initially; opening constructs the menu, which remains available for subsequent selections.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful implementation with no concrete correctness finding; partial runtime evidence does not yet establish the complete performance tradeoff.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Large agent rosters slow Settings visits even when the user never opens the selector.
Reason: The maintainer-approved direction removes measured hidden work with limited production growth and preserves established selection and retention contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses measurable unnecessary selector work still present on main; no definite introduced defect was found.

Priority: P2
Reviewed head: e8fe9b72f6c805a8bf6b6d79a2c946d5792c062d

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The same-document navigation-through-first-open qualification remains unfinished, and a base-red/head-green result for the lazy-render regression is not reported.
Agent review details

How this fits together

AgentSelect receives roster options, selection, and identities from Settings and scope controls, then delegates interaction to Menu and authenticated image resources to the existing avatar cache.

flowchart LR
  A[Roster and selection owners] --> B[AgentSelect]
  B --> C[Trigger avatar]
  B --> D[Lazy Menu]
  D --> E[Retained option rows]
  C --> F[Shared avatar cache]
  E --> F
Loading

Technical review

Best possible solution:

Use the existing lazy Menu lifecycle with separate trigger and roster avatar leases sharing the current image cache.

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

Current-main source eagerly derives roster avatars and mounts Menu content; the supplied 300-agent production-browser measurements support that unnecessary work, but this review executed no target code.

Is this the best way to solve the issue?

The patch uses the smallest supported boundary: defer through Menu, retain live option fields for its captured renderers, and reuse authenticated image ownership rather than adding route cleanup machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 193232cc1e89.

Provenance checked

  • Avatar lease projection and lifecycle keeps the original intent (2e62f4d: Project plain avatar-owner leases into Solid while preserving authenticated loading, resource release, and context retirement.)
  • Initial menu construction changes intended behavior with a stated reason (ecdc40d: Move shared pickers to Solid while keeping Menu authoritative for selection, dismissal, and opening focus; this PR explains delaying construction through that same owner.)
  • Retained option and item projections keeps the original intent (ba743d5: Preserve inner avatars and labels during selection; the retained option projection and Menu's keyed renderer continue that invariant after removing duplicate item reconciliation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned change and current-main behavior: The introduced diff separates trigger and option avatar projections, enables Menu laziness, and replaces redundant item reconciliation with a lazy memo. The selector implementation on fetched main remains identical to the merge-base implementation. (ui/src/components/agent-select.tsx:45, e8fe9b72f6c8)
  • Existing lifecycle owner: Menu already synchronously mounts lazy content before initial focus and retains it unless configured as while-open; its keyed renderer retains custom row renderers, explaining why the live option projection remains necessary. (ui/src/components/solid/overlay-control.ts:59, e8fe9b72f6c8)
  • Prior retention contract: perf(ui): retain agent selector rows and retire selection routes #185990 established retained inner avatars and labels during warm selections; this PR preserves that contract while changing initial construction timing. (ui/src/components/agent-select.tsx:88, ba743d572642)
  • Performance evidence and accepted tradeoff: The maintainer-authored body reports 20 interleaved base/head/base triplets per page and viewport, including desktop Agents renderer CPU median 178.9→126.0 ms. It explicitly accepts moving construction to first opening and leaves whole-flow, Chromium 4×, and WebKit qualification in progress. (e8fe9b72f6c8)
  • Media inspected: Inspected all six linked before/after screenshots: desktop Plugin Settings, mobile Advanced, and the open agent selector preserve visible layout and selected-row focus. Four prepared images were read locally; the remaining two were inspected from GitHub image bytes after scratch downloads were denied. (e8fe9b72f6c8)
  • Whole-flow measurement boundary: The added scenario navigates from New Session to Agents, opens the selector, waits for hydrated avatars and selected focus, and rejects document reloads; it complements the separate first-open measurement introduced by test(ui): measure first-open and warm-input page costs #189298. (scripts/lib/control-ui-data-catalog-scenarios.ts:1017, e8fe9b72f6c8)

PR surface

Source +12, Tests +43, Other +42. Total +97 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 43 31 +12
Tests 5 48 5 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 43 1 +42
Total 7 134 37 +97

Review metrics

Metric Value Why it matters
Production versus validation growth Production +12 LOC; tests +43 LOC; benchmark +42 LOC Growth supports independent lazy avatar regions, preserves existing consumer assertions, and measures navigation through first opening without another lifecycle owner.

Labels

Label changes:

  • add P2: Measured main-thread savings improve large-roster Settings navigation without evidence of an urgent broken workflow.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Measured main-thread savings improve large-roster Settings navigation without evidence of an urgent broken workflow.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the already-declared performance qualification, including navigation through hydrated first opening.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 31, 2026, 4:10 PM ET / 20:10 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

/refresh-security-review e8fe9b7

@steipete
steipete merged commit 15d22ce into main Oct 31, 2026
137 of 149 checks passed
@steipete
steipete deleted the solid2/w-perf-route-shared-1031 branch October 31, 2026 21:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

@steipete

Copy link
Copy Markdown
Contributor Author

Coordinator acceptance for #189725: the slower standalone first menu opening is accepted because navigation through first opening improves and every measured combined-flow p95 improves. Round 2 will investigate the remaining 56 ms (1×) and 327 ms (4×) route tasks and whether idle preparation can improve first opening without regressing navigation.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
* perf(ui): defer closed agent selector content

Mount the menu through its existing lazy owner and resolve trigger and menu avatars only when their regions consume them. Keep menu rows and their image leases stable after the first open, without rebuilding the roster avatar map on selection changes.

* perf(ui): avoid duplicate selector row projection

* test(ui): measure agent selector visit through first open
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: S 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