Repository navigation
perf(ui): avoid rebuilding model selection metadata - #185025
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 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. |
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherControl 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +22, Tests +116. Total +138 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 26, 2026, 5:39 PM ET / 21:39 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* perf(ui): avoid rebuilding model selection metadata * test(ui): narrow model default fixture overrides
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
descriptionfield 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.
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
ci:fullrequests 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.
CI attribution
The test-only correction in
d778ae3ff16d4de5b4250285e7cfd376848ed110fixes 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 is7c4eef04bf387dd96e388288f282b2cebcc5905f; 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.