Repository navigation
perf(tui): prepare searchable picker rows once - #127620
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 6:10 PM ET / 22:10 UTC. ClawSweeper reviewWhat this changesThis PR lazily prepares normalized searchable-picker row data on the first non-empty query so subsequent TUI filtering avoids rebuilding it. Merge readinessNo blocking correctness findings. This maintainer-authored TUI performance refactor is narrow and preserves the picker’s filtering and original-item selection contract; wait for the current head’s merge result and remaining checks before landing. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe terminal UI creates fixed picker rows for model, agent, context-mode, and local-shell choices. The searchable picker filters those rows while the operator types and returns the original selected item to its caller. flowchart LR
A[Command and model data] --> B[Fixed picker rows]
B --> C[Searchable picker overlay]
C --> D[Lazy normalized row cache]
D --> E[Exact and fuzzy filtering]
E --> F[Original selected item]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6. Total +6 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the lazy cache at the searchable-picker owner and land it after the current head has a clean merge result and exact-head checks are green. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a performance refactor, and source inspection establishes unchanged filtering and selection semantics. Is this the best way to solve the issue? Yes: locating a lazy cache in the picker owner removes repeated work without adding a cross-layer cache or changing callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9903e404ef9f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
999473f to
fd2cfdb
Compare
|
Land-ready verification for exact head
Patch is one production file (+26/−20), preserves lazy no-query behavior and original selected-item identity, and has no protocol/config/storage/security surface. No agent transcript is attached or published. |
|
Merged via squash.
|
What Problem This Solves
SearchableSelectList.smartFilter()stripped ANSI, lowercased labels and descriptions, concatenated search fields, and rebuilt fuzzy-candidate wrappers for every stable row on every search edit. A large model picker therefore repeated the same immutable row projection for every typed character.Why This Change Was Made
TUI picker callers construct fresh fixed rows immediately before opening an overlay, and the component has no row-refresh API. The first non-empty query now prepares normalized label, description, and combined fuzzy-search text once; later edits reuse those fields. Preparation stays lazy so opening a picker and selecting without searching pays no search-projection cost.
Filtering still applies the same exact-label, exact-description, and native fuzzy tiers. Tie sorting, ANSI handling, labels/descriptions/search text, active selection, callbacks, and errors are unchanged. Every filter and selection result remains the original item object.
User Impact
Search interaction in large model/provider lists is faster without changing visible ordering, matches, selection, keyboard behavior, or model routing. There is no provider-auth, catalog-freshness, configuration, protocol, persistence, or public projection change.
Evidence
Deterministic exact-owner fixture: 2,500 frozen model-like rows, 22 typed characters, constructor + every filter + render, 25 interactions × 7 trials.
261c7a4dfc80464caf71fc3599cc9284b0483f42571ff2c5460a6ba3e9538d49Validation:
/model: 2/2 on the revised exact headnode scripts/check-changed.mjs -- src/tui/components/searchable-select-list.ts: passed on the revised exact headpnpm build: passed; only existing third-party direct-evalwarningsgit diff --check: passedgpt-5.6-sol/high autoreview of the revised commit: clean, correct at 0.99