Repository navigation
fix(ui): keep model selection ready without repeated catalog waits - #145384
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: needs maintainer review before merge. Reviewed September 11, 2026, 11:43 PM ET / September 12, 2026, 03:43 UTC (Revision 9). ClawSweeper reviewWhat this changesCaches model choices across picker openings, shows known defaults during loading, reuses eligible Gateway metadata projections, and stabilizes transport deadline tests. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release still perform repeated catalog reads. The integrated deadline handling and supplied proof address the prior blockers; no actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI requests model choices and account readiness from the Gateway for chat and settings controls. Its browser cache reuses those display results, while the Gateway continues to validate model and account selections. flowchart LR
A[Chat and settings pickers] --> B[Connection and selection scope]
B --> C[Browser catalog cache]
C -->|Warm result| D[Visible model choices]
C -->|Missing or expired| E[Gateway catalog read]
E --> C
F[Account and lifecycle changes] -->|Invalidate| C
D --> G[Gateway validates submission]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +237, Tests +606, Docs +12. Total +855 across 43 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep catalog reuse in the shared display cache, with Gateway-owned freshness, cancellation and model/account validation. Do we have a high-confidence way to reproduce the issue? Yes, source establishes that repeated catalog reads on current main always issue another RPC; the supplied before/after measurements corroborate the delay. No runtime reproduction was executed in this review. Is this the best way to solve the issue? Yes. Extending the existing catalog owner preserves one shared read path, and lifecycle invalidation, cooldown expiry and explicit refresh retain recovery without adding configuration or persisted state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4275c324ce91. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
9f301e4 to
d99e24d
Compare
6b0a2c2 to
a4a7e44
Compare
Keep publication, retry, reconnect, and account coverage while asserting warm catalog reuse. Use the required non-mutating sort for cache keys.
Preserve request timeout coverage while separating OpenAI setup from the stalled transport watchdog. Verify Signal absolute-deadline errors and connection closure, with repeated-chunk timing covered deterministically. The inherited CI fixture failures reproduce under controlled setup/header delays; deadline-removal checks still fail.
a4a7e44 to
616117b
Compare
Control the opened socket state for diagnostic classification while retaining real HTTP and WebSocket integration cases. Preserve the caller budget, discovered URL, command dispatch and cancellation checks; controlled scheduling and missing-timeout/wrong-code probes validate the fixture repair.
Integrate main loading recovery with deadline-scoped pending catalog requests. Share successful snapshots across budgets, preserve explicit-refresh authority through cooldown expiry and cache pressure, and retain Gateway-owned timeout and cancellation semantics. Verified focused UI/browser cases and live Gateway projection, timeout and eviction flows.
|
Merged via squash.
|
…penclaw#145384) * fix(ui): keep model selection ready with scoped catalog caching * test(ui): verify cached model picker refreshes Keep publication, retry, reconnect, and account coverage while asserting warm catalog reuse. Use the required non-mutating sort for cache keys. * fix(ui): keep diagnostic refreshes live alongside model caching * test(ui): reconcile provider publications with catalog caching * perf(ui): defer metadata requests and expire stale cooldowns * test: verify provider deadlines independently of fixture timing Preserve request timeout coverage while separating OpenAI setup from the stalled transport watchdog. Verify Signal absolute-deadline errors and connection closure, with repeated-chunk timing covered deterministically. The inherited CI fixture failures reproduce under controlled setup/header delays; deadline-removal checks still fail. * test(browser): isolate stale command timeout classification Control the opened socket state for diagnostic classification while retaining real HTTP and WebSocket integration cases. Preserve the caller budget, discovered URL, command dispatch and cancellation checks; controlled scheduling and missing-timeout/wrong-code probes validate the fixture repair.
What Problem This Solves
Fixes an issue where returning to New Session or opening a model picker repeatedly waits for the same model catalog. A new draft also showed a loading skeleton even when the agent's default model was already known.
Why This Change Was Made
Cache successful Gateway catalog projections in browser memory, scoped to the connection, agent, session, account, and requested view. Concurrent consumers with the same timeout budget share one read; successful snapshots are reused across budgets. Gateway-owned deadlines stay intact, and an explicit refresh can still publish after an ordinary read or cooldown expiry. Catalog/config changes, session changes, reconnects, and identity changes invalidate the appropriate copies; failed refreshes remain retryable. Server-reported cooldown deadlines also expire cached readiness without requiring a publication event. The cache is bounded and does not persist credentials or change Gateway authorization. Explicit Debug refreshes continue to sample the Gateway directly.
New Session restores warm controls synchronously and shows its known default during a cold catalog read. On the Gateway, authenticated drafts without personal account links reuse the existing prepared projection; account links are still reread each time, and personal projections remain request-local.
User Impact
Reopening model controls no longer adds a catalog round trip. A cold catalog read does not hide a known default or prevent composing a new session. Model/account validation remains with the Gateway.
Evidence
Measured real WebSocket RPCs against an isolated Gateway with trusted-proxy authentication, two agents, two providers, five explicit models, and nine configured model references. The before/after UI catalog owners used the same connection. These are catalog-read timings, not browser paint or provider inference timings.
The final 18-scenario probe uses the real Gateway protocol client. It also verifies timeout-budget isolation, warm reuse across budgets, joint model/metadata invalidation, late replies, and explicit-refresh authority. A bounded 1,000 ms request expired while an unbounded request stayed pending with two real Gateway responses held. An active refresh also retained publication authority while 64 other projections completed. Explicit discovery refresh took 22.36 seconds; no cold-discovery improvement is claimed.
An earlier isolated backend comparison reduced authenticated draft metadata median from 29.57 to 9.92 ms. Metadata p95 was higher in its final ten-sample run (32.77 → 50.55 ms), so no tail-latency improvement is claimed. The final merged UI build uses 353,039 bytes gzip for startup JavaScript and passes the existing 355,116-byte enforcement limit. This PR does not raise any budget; metadata lifecycle state remains separate from lazy request/retry code.
All live scenario assertions passed, the final driver exited successfully, and process-group/TCP checks confirmed graceful cleanup. The tested source hashes match the committed merge tree.
Regression checks demonstrate failure on the original code. Focused Gateway account/lifecycle tests, UI cache/cancellation/identity/session tests, and compiled-UI browser flows plus the three-case real-Gateway catalog suite cover recovery, account previews, immediate defaults, and repeated picker opens. The final deadline integration additionally passes 123 focused UI cases and 19 browser scenarios, including real-client deadline recovery. Real Chrome also verifies the live synthetic Gateway's model picker.
Landing validation also exposed timing-dependent test fixtures inherited from main. The test-only corrections distinguish Signal’s absolute deadline from idle timeouts, measure OpenAI’s stalled-response watchdog from the provider request, and control Chrome’s diagnostic classification separately from connection scheduling while preserving real HTTP/WebSocket integration cases. All 119 focused Signal/OpenAI cases and 36 Chrome cases pass. Controlled original failures and missing-deadline/wrong-code checks confirm that regressions remain detectable. Production transport code and timeout limits are unchanged.
Before, while the catalog response is pending:
After, while the catalog response is still pending: