Skip to content

perf(ui): avoid rebuilding model selection metadata - #185025

Merged
steipete merged 2 commits into
mainfrom
solid2/w-perf-interaction-6-followup
Oct 26, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-perf-interaction-6-followup

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Provider refreshes copied every model option solely to rename its detail field, while saving the current composer's model selection built labels and sorted options for the entire catalog. These operations only need existing option objects or the current/default model identities.

Use the picker's canonical description field throughout its internal callers and retain the copied array for selected-first ordering. A value-only resolver reuses the existing normalization and availability rules on matching identity candidates; composer persistence and model switching consume it. The existing picker window, intrinsic sizing, keyboard behavior, selection authority and lazy boundaries stay with their current owners.

Evidence

Serial, counterbalanced production-renderer base/head/base triplets with renderer thread CPU, identical-build A/A controls, 1,000 models and 400-message sessions. Twenty triplets per viewport; mobile provider refresh includes the prescribed ten-pair extension. Host load was 21.33–40.18. These are synthetic renderer measurements, not live-provider latency or INP.

Flow Viewport Samples per role Script CPU median/p95 before → after (ms) Task CPU median/p95 before → after (ms)
Provider refresh Desktop 20 15.634/16.550 → 14.602/15.135 29.483/31.344 → 28.212/29.430
Provider refresh Mobile 30 15.135/16.378 → 14.430/15.849 27.087/29.266 → 26.675/28.970
Session switch Desktop 20 73.909/82.708 → 71.226/80.829 132.601/148.114 → 127.764/141.442
Session switch Mobile 20 88.769/95.922 → 86.894/94.323 161.752/174.053 → 158.865/168.074

Provider script CPU improves 4.7–6.6%; session-switch task CPU improves 1.8–3.6%. The latter is a smaller clean win, below the nominal 5% aim. A/A script median/p95 changes were −1.62/−2.34% and −0.47/−3.50% for provider refresh, +0.68/−3.15% and −0.27/+3.50% for session switching. The initial mobile provider task p95 increase of 1.81% became −1.01% with the ten additional pairs. Small style/layout subphase movements remain in the report; there is no blanket all-subphases improvement claim.

All 270 retained-flow cells passed. The broader 600-cell experiment also tested a search-ranking change, removed before publication because its tails did not qualify. Its lazy ranking owner does not execute in the retained intervals. The retained producers match the measured 4e9eb8a base/candidate delta; current-main integration preserves the subsequently landed picker window.

Validation and size

  • 46 focused model-selection assertions and 16 headless MultiSelect browser assertions passed. They cover canonical/legacy availability, unknown IDs, defaults, stable ordering, disabled choices, description search and selection.
  • Final integrated UI types, focused lint, controller guard, production Knip and independent P0–P2 review passed. The local lint finding (parameter reassignment) was corrected before commit.
  • Exact-head production build and strict startup comparison passed. startup JS gzip vs base: 271080 B -> 271337 B (+257 B); requests 5 -> 5; startup CSS gzip vs base: 31974 B -> 31974 B (+0 B; growth up to 1535 B allowed). Chat/New Session boot gzip changed by +355/+458 B, with request counts unchanged. Zero strict violations; these small increases are accepted for the measured CPU reduction. Gzip differences include hash/compression effects.
  • 12 changed files: 3,932 → 4,070 lines (+138); seven production files: 2,519 → 2,541 (+22). Existing production counts stay at 2 signals, 26 memos, 1 cleanup and zero effects, untrack, DOM queries/listeners, flush or owner-restoration calls. No new dependency or state owner.
  • ci:full requests every UI unit, Control UI E2E, browser-extension and real-Gateway shard.

Visual proof

Inspected synthetic captures from the measured builds; the retained output is visually unchanged.

State Before After
Desktop provider refresh Provider refresh before Provider refresh after
Mobile session switch Session switch before Session switch after

CI attribution

The test-only correction in d778ae3ff16d4de5b4250285e7cfd376848ed110 fixes the new fixture override type; its exact local type leaf passes. The initial PR-context failure was a required heading mismatch, now corrected.

Full UI CI run 40403746137 completed with 18 existing failures in five UI/real-Gateway jobs: 11 attachment-menu cases, three media-picker cases, two pointer safe-area cases, one initial-prompt scrollbar assertion, and one effort-attribute assertion. Every failed case name was reproduced on the run's exact main parent, 388b7e4523b6ff294164bcc21ca2be881c6c6bb3, with no extra or missing failed cases. The CI merge is 7c4eef04bf387dd96e388288f282b2cebcc5905f; its parent order and unchanged failure-input blobs were verified. Native admission retains the logs, case comparison and source evidence.

The baseline replays are failures, not passing coverage. Scoped model/browser tests, types, lint, Knip and the exact-head build pass. This PR uses the authorized native inherited-failure recovery route; the earlier auto request was confirmed retired before replacing its head.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 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 26, 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-26T21:11:05.795955Z 169c77d 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.

@steipete
steipete enabled auto-merge (squash) October 26, 2026 21:18
@steipete
steipete disabled auto-merge October 26, 2026 21:20
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR avoids copying model-option objects and preparing full-catalog presentation metadata when callers only need selected model identities.

Example: Refresh Models settings with 1,000 catalog entries on desktop.

  • Before: Each picker copies its option objects; reported script CPU median is 15.634 ms.
  • After: Pickers reuse option objects while retaining selected-first ordering; reported script CPU median is 14.602 ms.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused optimization supported by production-renderer measurements and inspected captures; current-head CI failures remain unattributed.
Proof confidence 🐚 platinum hermit (4/6) The ordinary contributor proof gate is exempt for this maintainer-authored PR; supplied production-renderer comparisons exercise provider refresh and session switching, and inspected desktop/mobile captures preserve visible output.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Large model catalogs cause avoidable CPU work during provider refreshes and session switching.
Reason: The maintainer-authored direction removes demonstrated waste with a small implementation and explicitly accepts the measured CPU-versus-bundle tradeoff.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused, measured optimization without an identified correctness regression; keep it open while current-head CI failures are resolved or attributed.

Priority: P2
Reviewed head: d778ae3ff16d4de5b4250285e7cfd376848ed110

Before merge

None.

Findings

None.

Agent review details

How this fits together

Control UI model controls consume Gateway catalogs and session defaults, derive picker presentation and selected identities, and pass selections to existing session mutation and snapshot owners.

flowchart TD
  A[Gateway model catalog] --> B[Model selection owner]
  B --> C[Picker options]
  C --> D[Shared picker renderer]
  B --> E[Selected model identities]
  E --> F[Composer snapshot owner]
  E --> G[Session mutation owner]
Loading

Technical review

Best possible solution:

Retain this focused optimization using the existing selection and picker owners, with the normal current-head CI gate satisfied before landing.

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

Current-main source directly shows per-option copying and full-catalog presentation preparation in the affected paths; supplied renderer measurements exercise those operations, but this review ran no reproduction.

Is this the best way to solve the issue?

The change removes unnecessary work at existing owners, migrates the internal description field consistently, and preserves selection policy without adding a cache or competing state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shared model-option representation keeps the original intent (7fe5bf1: Consolidate picker option construction during the renderer migration; the copied array also supports selected-first ordering.)
  • Prepared catalog and availability semantics keeps the original intent (97be272: Retain catalog-only presentation facts across warm updates while keeping session selection and policy live; earlier availability handling keeps configured cold models identifiable.)
  • Provider defaults and picker window keeps the original intent (perf(ui): bound model picker work and isolate Cron input painting #184856: Bound large-catalog rendering while preserving full-catalog keyboard selection and exact intrinsic sizing.)
  • Composer snapshot and model switching keeps the original intent (perf(chat): restore the selected model before reconnect completes #183423: Restore scoped display facts before reconnect completes without allowing cached facts to authorize actions; model-switch confirmation and dispatch remain under their existing owners.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 97be272 adds ui/src/lib/chat/model-select-state.ts:252 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 97be272075c7; files: ui/src/lib/chat/model-select-state.ts)

PR surface

Source +22, Tests +116. Total +138 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 48 26 +22
Tests 5 122 6 +116
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 170 32 +138

Review metrics

Metric Value Why it matters
Production versus test changes Production +48/-26; tests +122/-6 Production growth adds the identity-only resolver without new state machinery; tests cover identity precedence, availability exclusions, defaults and description rendering/search.

Labels

Label changes:

  • add P2: A bounded Control UI CPU improvement with modest measured gains and no demonstrated urgent user-facing failure.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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: A bounded Control UI CPU improvement with modest measured gains and no demonstrated urgent user-facing failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 26, 2026, 5:39 PM ET / 21:39 UTC.

@steipete
steipete merged commit fbc0e8c into main Oct 26, 2026
100 of 107 checks passed
@steipete
steipete deleted the solid2/w-perf-interaction-6-followup branch October 26, 2026 22:01
@steipete

Copy link
Copy Markdown
Contributor Author

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

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
* perf(ui): avoid rebuilding model selection metadata

* test(ui): narrow model default fixture overrides
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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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