Skip to content

perf(ui): reduce model picker navigation work - #182249

Merged
steipete merged 3 commits into
mainfrom
solid2/w-s2-derivations
Oct 24, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-s2-derivations

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The model picker publishes new aggregate Maps even when ranked rows or virtual-row geometry are unchanged. The retained, closed context-usage popover also eagerly reads message costs.

Use per-key Solid projections for search metadata and virtual rows, compare immutable ranked rows before publishing equivalent results, and make provider costs lazy. Search ordering, grouped ARIA positions, digit shortcuts, disclosure, focus, and usage details retain their behavior. Domain owners and lazy imports are unchanged. The benchmark harness gains an opt-in --thread-cpu-time mode; its default clock is unchanged.

Evidence

Proof Base Head
Rank-consumer recomputations, five equivalent queries / 1,000 models 5,000 0
Cost payload reads on mounting closed usage details 1 0
Targeted tests regressions fail 23 pass in 3 files
UI and script typechecks — pass, default tsrs
Targeted lint / formatting — pass
Startup JS gzip / requests 280,871 B / 7 280,759 B / 7
Startup CSS gzip / requests 40,130 B / 1 40,130 B / 1
Chat boot JS gzip 1,272,372 B 1,272,391 B (+19 B)
New Session boot JS gzip 762,810 B 762,924 B (+114 B, within cap)
Production LOC, three touched modules 983 987 (+4)

A true result change still invalidates affected ranks. Usage lifecycle coverage proves current costs on reopening and no cost reads after closing. Text-only streaming deltas already bypass the composer snapshot; this does not remove a cost scan per token. The counters exercise production derivations at the unit boundary, not whole-application instrumentation.

CPU qualification

CPU changes below are median / p95; negative means less CPU time.

Cell Candidate script Candidate task A/A script A/A task
Open/search +0.04% / -0.90% -0.64% / +0.50% +0.96% / -1.12% +0.53% / -1.77%
Already-open search +1.65% / -1.92% +2.32% / -3.20% -1.99% / -0.12% -1.80% / +2.63%
Keyboard navigation, 100 keys -17.61% / -20.67% -10.92% / -13.05% -1.75% / +3.26% -0.84% / +4.39%
Streaming -1.19% / -2.68% -0.55% / -1.43% +0.73% / +1.23% +0.67% / +0.35%
Absolute CPU measurements (ms, median / p95)
Cell / variant Script Task
Open/search: Candidate comparison, base 48.903 / 51.034 94.073 / 97.213
Open/search: Candidate comparison, head 48.921 / 50.573 93.473 / 97.700
Open/search: A/A control, base 48.874 / 51.473 94.632 / 100.181
Open/search: A/A control, identical base 49.341 / 50.895 95.137 / 98.405
Already-open search: Candidate comparison, base 29.645 / 32.763 59.091 / 66.845
Already-open search: Candidate comparison, head 30.134 / 32.133 60.465 / 64.705
Already-open search: A/A control, base 30.530 / 32.092 61.068 / 64.169
Already-open search: A/A control, identical base 29.924 / 32.055 59.966 / 65.855
Keyboard navigation, 100 keys: Candidate comparison, base 79.641 / 90.815 240.005 / 289.282
Keyboard navigation, 100 keys: Candidate comparison, head 65.617 / 72.045 213.807 / 251.517
Keyboard navigation, 100 keys: A/A control, base 78.002 / 88.235 230.417 / 277.465
Keyboard navigation, 100 keys: A/A control, identical base 76.636 / 91.114 228.472 / 289.642
Streaming: Candidate comparison, base 1780.079 / 1865.052 4735.538 / 4933.283
Streaming: Candidate comparison, head 1758.885 / 1815.133 4709.438 / 4862.634
Streaming: A/A control, base 1707.929 / 1813.178 4564.849 / 4868.861
Streaming: A/A control, identical base 1720.376 / 1835.569 4595.325 / 4886.068

Twenty interleaved pairs per candidate cell and A/A cell use byte-identical baseline copies, the production renderer, synthetic Gateway, 1,000 models / 400 messages, desktop 1440×1000, Chromium 156.0.8078.4, and a 32-CPU darwin-arm64 host. Performance.enable({ timeDomain: "threadTicks" }) selects renderer-thread CPU time for script/task metrics. Wall/frame values remain diagnostic and do not decide acceptance under the coordinator direction below.

The four CPU cells above qualify within the 5% band or better. The original 20-key navigation A/A control remained unqualified after its predeclared ten-pair extension: combined 30-pair script/task medians -0.12%/+1.73%, p95 +8.91%/+7.85%. Its roughly 18 ms scripting window was too variable for qualification. Those results remain diagnostic, not passing. The separate longer navigation cell repeats the same checked 20-key cycle five times, using the same production bundles and existing harness; its 20 A/B and combined 30 A/A pairs are reported above. The longer A/A cell initially had task p95 +5.17%, so it also received one predeclared ten-pair extension. No samples were discarded.

Host one-minute load averages: Open/search candidate: 32.9 median (28.6–35.4); Open/search control: 35.5 median (33.1–45.2); Already-open search candidate: 38.1 median (33.5–44.3); Already-open search control: 42.0 median (35.2–46.3); Keyboard navigation, 100 keys candidate: 44.1 median (39.7–48.1); Keyboard navigation, 100 keys control: 34.9 median (21.9–40.7); Streaming candidate: 27.6 median (19.1–44.0); Streaming control: 17.4 median (11.6–30.9).

Keyboard navigation improves; open/search and streaming are effectively flat. The goal of meaningful script-time reductions in three scenarios remains unmet. No streaming speedup is claimed. This is synthetic renderer/mock-Gateway proof, not a live provider/Gateway run.

The earlier wall-clock evidence is retained as a measurement limitation: candidate open/search automation p95 was +17.9%, and streaming input-to-frame median +9.2%. An identical-build A/A control also moved input-delay p95 by +21.7% and input-to-frame p95 by +18.2%. Those measurements could not distinguish code effects from loaded-host/frame scheduling noise. The CPU comparison above implements the explicit acceptance decision; it does not relabel the earlier results as passing.

Coordinator acceptance decision

The structural evidence is strong: rank recomputations went from 5,000 to 0, closed-popover reads from 1 to 0, and screenshots are pixel-identical. Your A/A control exceeding the band shows that wall and frame timings on this host are noise right now.

Retry a Testbox allocation once. If it's granted immediately, run the timing comparison there: ten pairs per cell plus an A/A control.

If it queues, stay local but use host-noise-resistant metrics: CPU script/task time from the profiler rather than wall or input-to-frame time. Run 20 interleaved pairs per cell and include an A/A control, recording host load.

Land #182249, with this decision quoted, if the A/A control is inside the band and the candidate's CPU metrics are inside the band or better. The streaming cell is unrelated to the model picker, so a streaming wall-time move with flat CPU is noise.

If CPU time regresses beyond the band in a cell the change can actually affect (model picker open/search), find the cause and fix it before landing.

Both Testbox requests queued without producing samples and were stopped; cleanup is reconciled with cancelled runs 40065566007 and 40065688287. No active lease remains.

Checks and review

One production build per side and the strict performance comparison passed. The three focused test files ran once with --maxWorkers=1 and the pinned Bun runtime. UI/script typechecks, scoped lint/format, and git diff --check passed. Independent isolated production and harness autoreviews found no actionable P0–P2 defects. ci:full selects every UI unit, Control UI E2E, browser-extension, and real-Gateway shard.

The production Knip command reports src/gateway/assistant-human-mentions.ts unused on both the exact merge base and head; base also reports unused eslint in the lint workspace. The exact-base run borrowed identical-lockfile dependencies through symlinks. No new ignore or export allowance is added.

The paired CPU/build measurements and 23 focused tests above were collected at 9e0091ffcc0d07a66ac565d4568e7df009ad66df against 2ecd64669e19ab41606c1fd1444862a63dee7863. The later conflict-free merge commit 2451fd923ecd0a2d6692205812b42a6765272e1e integrates main 5d47168b9170d92c45aeb82cd7680719f211b89a; the three production UI modules are byte-identical to the qualified head. Fresh UI/script typechecks and another independent P0–P2 review pass after integration. Final-head Knip still reports only the same inherited unused file.

The original full CI run 40066014710 and openclaw/ci-gate passed. Native admission later stopped before dispatch because the separate Rust workflow failed the baseline-reproduced native_signed_connect_preserves_product_fields_and_rejects_invalid_node_manifests Clippy limit (111/100 lines), and my shortened PR body had dropped the checker's two required section headings. The headings are restored and pass the local policy check. Main's #182269 fixes the Rust failure and is included by the merge; exact-head full CI 40071019913 passed with no failed or pending jobs. The PR merged as 3484041380f3621eaf1a3974eea6551e35e6df7d, verified on origin/main. No auto-merge request was retained from the stopped attempt.

The Solid refactor checklist has zero effects, render effects, untrack, direct listeners, DOM queries, flush, or owner API calls in all three production modules before and after. Memos 11 → 8; projections 0 → 2; lazy memos 0 → 1. The four production lines buy per-field identity preservation and explicit equality/lazy contracts. No new abstraction or owner is introduced.

Reproduction commands
pnpm tsgo:ui
pnpm tsgo:scripts
pnpm test ui/src/pages/chat/components/chat-model-picker-search.test.ts ui/src/pages/chat/components/chat-model-picker.test.tsx ui/src/pages/chat/chat-composer-context.test.ts --maxWorkers=1
pnpm ui:build
pnpm ui:check-performance --base-dist <base> --dist <head>
pnpm deadcode:knip
node --import ./scripts/tsx.mjs scripts/bench-control-ui-interactions.ts --bundle-dir <base> --compare-bundle-dir <head-or-identical-control> --steps model-picker-open-search,model-picker-search,model-picker-navigate --viewport desktop --pairs 20 --thread-cpu-time
node --import ./scripts/tsx.mjs scripts/bench-control-ui-cold-load.ts --bundle-dir <base> --compare-bundle-dir <head-or-identical-control> --runs 40 --streaming-reply --transcript-messages 400 --face chat --untraced --thread-cpu-time

The 100-key navigation cell uses a task-local driver around the existing scenario; each original cycle preserves its assertions:

const navigation = interactionScenarios.find(s => s.id === "model-picker-navigate");
const run = navigation.run;
navigation.run = async (...args) => {
  for (let cycle = 0; cycle < 5; cycle += 1) await run(...args);
};

Visual proof

Inspected synthetic before/after screenshots are pixel-identical.

Before: synthetic model picker search

After: identical synthetic model picker search

Preserve per-row search and window metadata, suppress unchanged ranked results, and defer provider cost scans until the usage popover is read. Keep keyboard, shortcut, and grouped ARIA behavior intact.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 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 24, 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-24T06:40:57.171739Z 2451fd9 New commits
ℹ️ 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: M labels Oct 24, 2026
@clawsweeper clawsweeper Bot added 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. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves per-row picker metadata, defers closed usage-popover cost reads, and adds optional CPU-clock benchmark measurements.

Example: Navigate 20 arrow-key steps through a 1,000-model catalog.

  • Before: The reported renderer CPU comparison spends more script time updating aggregate row metadata.
  • After: Script CPU median falls 15.65%, while selection and navigation behavior remain intact.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and has credible browser and regression evidence, but the explicitly required performance qualification is unfinished.
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-catalog keyboard navigation does unnecessary scripting work, and closed usage details read cost payloads.
Reason: The maintainer-authored direction preserves interaction contracts and shows deterministic work reductions plus a measured navigation CPU improvement.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR removes demonstrated redundant UI work, and source review found no actionable introduced defect.

Priority: P2
Reviewed head: 9e0091ffcc0d07a66ac565d4568e7df009ad66df

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Complete the recorded CPU qualification with streaming A/B and A/A results and the combined navigation A/A control under the approved acceptance rule.
Agent review details

How this fits together

The Control UI derives searchable model, target, and account rows from its existing catalog owners, then presents them through one virtual window; the composer separately derives usage details from session messages.

flowchart TD
  A[Catalog owners] --> B[Search and disclosure]
  B --> C[Per-row projections]
  C --> D[Virtual picker window]
  D --> E[Keyboard and pointer selection]
  F[Session messages] --> G[Lazy usage details]
Loading

Technical review

Best possible solution:

Retain the existing picker and overlay owners while deriving stable per-key metadata and reading provider costs only when observed.

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

Current-main source rebuilds aggregate metadata Maps and eagerly evaluates provider costs; the submitted work-count regressions and browser measurements corroborate those paths, without a local execution during this review.

Is this the best way to solve the issue?

The patch is a small, coherent change: equivalent ranked results stop downstream publication, readonly projections preserve unchanged fields, and the existing cost memo becomes lazy without adding another owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4dc5be9f0282.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned change and current-main comparison: The introduced diff contains the eight declared files. Fetched main retains the original implementations in all three changed production UI modules, so this optimization remains distinct work. (ui/src/pages/chat/components/chat-model-picker-search.ts:190, 9e0091ffcc0d)
  • Existing owners and preserved contracts: The catalog producer creates fresh search-row objects. The replacement retains ordered matching, disabled-row exclusion, account shortcut positions, grouped ARIA positions, and the existing virtualizer and selection owners. (ui/src/pages/chat/components/chat-model-picker-panel.tsx:144, 9e0091ffcc0d)
  • Full proof and acceptance decision: Read the full body, including the omitted CPU qualification section, against the supplied body identity 07a0245d16af2f0f9ec3629a391e2a29f8b0c3edfe0f52cc20cda864ec1662aa. Candidate CPU cells satisfy the reported band, but navigation A/A script/task p95 changes remain +6.60%/+7.85%; streaming comparisons and the combined navigation control remain pending. The recorded owner decision accepts CPU qualification instead of noisy wall/frame timing. (9e0091ffcc0d)
  • Inspected browser screenshots: Both downloaded 1440×1000 screenshots show the production picker filtered to Warm model 0999; their SHA-256 hashes are identical. They establish unchanged appearance for that state. (9e0091ffcc0d)
  • Feature history and original intent: perf(ui): virtualize large model picker catalogs #181190 established one virtual window and preserved keyboard/ARIA contracts; perf(control-ui): defer closed transcript overlay content #173715 established deferred closed-overlay content. This PR continues those designs. (ui/src/pages/chat/components/chat-model-picker-window.tsx:16, 4dc5be9f0282)
  • Current merge and CI state: GitHub reports the reviewed head mergeable. Exact-head CI-gate, dependency-review, and security-sensitive-review statuses pass. Rust workspace fails at Clippy; the body records an earlier matching baseline reproduction, but the current job's detailed logs redirect to a blocked host, so its exact failure was not independently confirmed. (9e0091ffcc0d)

PR surface

Source +4, Tests +134, Other +57. Total +195 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 51 47 +4
Tests 2 134 0 +134
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 62 5 +57
Total 8 247 52 +195

Review metrics

Metric Value Why it matters
Benchmark timing option One opt-in flag across two benchmark entry points --thread-cpu-time selects renderer thread CPU metrics and records the clock domain; default timing remains unchanged.

Labels

Label changes:

  • add P2: This is a bounded performance improvement for large model catalogs and closed composer details.
  • 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: This is a bounded performance improvement for large model catalogs and closed composer details.
  • 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.

  • Finish the already-recorded CPU qualification and report whether every required control and candidate cell meets the approved band.

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 24, 2026, 1:42 AM ET / 05:42 UTC.

@steipete
steipete enabled auto-merge (squash) October 24, 2026 06:48
@steipete
steipete merged commit 3484041 into main Oct 24, 2026
118 of 119 checks passed
@steipete
steipete deleted the solid2/w-s2-derivations branch October 24, 2026 06:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
* perf(ui): keep model picker derivations local

Preserve per-row search and window metadata, suppress unchanged ranked results, and defer provider cost scans until the usage popover is read. Keep keyboard, shortcut, and grouped ARIA behavior intact.

* perf(ui): measure renderer thread CPU in benchmarks
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: M 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