Repository navigation
fix(ui): keep new-session model availability truthful - #119462
fuller-stack-dev merged 1 commit into
Conversation
Crabbox visual proofBase/red SHA: Base: Blacksmith Testbox Base MP4 SHA-256: The MP4s are deterministic H.264 conversions of the raw Playwright recordings. Base/red recordingreproduction.mp4Head/green recordingfix.mp4Base/red timeoutHead/green timeoutHead/green recovered catalog |
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 1:03 AM ET / 05:03 UTC. ClawSweeper reviewWhat this changesThe PR makes the new-session model picker distinguish loading, failed, empty, and refreshed Gateway model catalogs instead of presenting configured defaults as verified options. Merge readinessKeep open for maintainer review: current main still turns an unknown new-session catalog into a selectable configured/default model, while this PR adds the missing catalog-state ownership and has no blocking source finding. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI requests agent-scoped model metadata from the Gateway before a new session starts. The new-session picker consumes that catalog to show selectable models and passes the chosen model into session creation. flowchart LR
A[New session] --> B[Gateway metadata request]
B --> C{Catalog result}
C -->|Models returned| D[Available model picker]
C -->|Timeout or error| E[Unavailable state and retry]
E --> B
Decision needed
Why: The PR is member-authored and maintainer-labeled, so this workflow must leave the final user-visible failure-state decision to a maintainer despite a clean source review. Before merge
Agent review detailsSecurityNone. PR surfaceSource +298, Tests +381. Total +679 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the lifecycle-owned catalog-state fix after Control UI owner approval, while preserving the existing-session picker’s intentionally separate fallback behavior. Do we have a high-confidence way to reproduce the issue? Yes — source-reproducible with high confidence: current main clears the metadata catalog, synthesizes a configured/default model into its empty options, and leaves that picker selectable. The submitted comment also supplies a matching delayed-metadata browser scenario. Is this the best way to solve the issue? Yes — this is the best fix: availability state belongs to the new-session metadata lifecycle owner, not a renderer-only guard. Changing the shared picker globally would regress existing-session behavior that deliberately supports fallback options. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75ef5aebecb8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
#157832) ## What Problem This Solves New Session and command palette model search independently own catalog request cancellation, refresh subscriptions, and failure state, making their read policies drift as model discovery changes. ## User Impact No intentional user-visible change: previously fetched New Session choices remain selectable during a background refresh; a truly cold scope does not fabricate choices from configured defaults. Model search remains independent of slower command categories. ## Why This Change Was Made This consolidation is an explicitly maintainer-requested deliverable for model-picker freshness: establish one web-client catalog read policy, starting with New Session and the command palette, without reversing truthful cold-catalog behavior. The scope intentionally remains behavior-preserving after baseline proof showed the warm picker already works. A shared reader beside the existing model-catalog store now owns each view's request and subscription lifetime. The existing cache remains the sole display-data owner; connection/scope retirement, Gateway invalidations and model snapshot publications retain their existing semantics. New Session keeps its account-preview and preference-restoration rules, while the palette keeps its independent search-category lifecycle. This preserves the cold-catalog decision in #119462 and the independent model search behavior in #151022. Baseline browser proof already showed retained rows during a held refresh, so this PR does not claim to fix a warm-picker loading regression. No config, schema, protocol, Gateway startup, persistent catalog state, or plugin-loading changes. No migration is required. Follow-ups deliberately outside this PR: migrate chat-state-refresh, chat-command-executor, Agents settings, Automations, Config, Search, model-providers/load, model-providers/catalog-discovery, model-setup/native-model-setup, and chat-metadata-store to the shared reader where their lifetimes fit. ## Evidence - Built Control UI with the mocked Gateway in Chromium: baseline and candidate retain fetched rows during a held refresh, including desktop/mobile remount revalidation. Both preserve the cold loading state without exposing the configured default as an option. - Added the standing held-refresh scenario: select a different fetched model without resolving models.list; the selected label changes and the picker remains nonbusy. It passed on the original base and candidate (candidate: 1.31 s scenario), confirming this is behavior-preserving consolidation rather than a new warm-picker fix. - New Session and palette component coverage: 175 tests passed across nine files (8.67 s Vitest / 10.02 s command wall). Covers independent model results while another category is pending, recovery through another view's publication, invalidation/retry, stale owners, account previews, and preference restoration. - Replaced two update-notification-count waits with observable model-state waits; no behavior assertion was removed. - Complete New Session model-catalog and palette-first-open browser files: 19/19 passed against the built candidate (34.40 s Vitest / 36.19 s command wall). - Initial CI [run 36086860473](https://github.com/openclaw/openclaw/actions/runs/36086860473) identified two PR-owned static issues and unrelated upstream Madge cycles. The static issues and upstream cycles are resolved on the final candidate. - Static corrections at `06b184e08d2f` remove the palette's now-redundant optional checks/Boolean conversion and reflow the New Session promise chain. Palette and account/metadata lifecycle coverage passed again: 83/83 tests (12.02 s Vitest / 17.95 s command wall). - Final candidate `dcf448e5e112` includes upstream import-cycle repairs `818b0092d2e` and `af545bf3b6a`. Exact-head [CI run 36093827970](https://github.com/openclaw/openclaw/actions/runs/36093827970) is green, and hosted ClawSweeper review is `ready` with no findings. - Rebuilt and replayed both browser files after merging those repairs: 19/19 passed (34.43 s Vitest / 36.29 s command wall). ### Before and after Synthetic fixtures; `models.list` remains held in each pictured state. | State | Before | After | | --- | --- | --- | | Fetched models remain selectable during refresh |  |  | | Cold scope does not invent model options |  |  | Co-authored-by: Ayaan Zaidi <[email protected]>
openclaw#157832) ## What Problem This Solves New Session and command palette model search independently own catalog request cancellation, refresh subscriptions, and failure state, making their read policies drift as model discovery changes. ## User Impact No intentional user-visible change: previously fetched New Session choices remain selectable during a background refresh; a truly cold scope does not fabricate choices from configured defaults. Model search remains independent of slower command categories. ## Why This Change Was Made This consolidation is an explicitly maintainer-requested deliverable for model-picker freshness: establish one web-client catalog read policy, starting with New Session and the command palette, without reversing truthful cold-catalog behavior. The scope intentionally remains behavior-preserving after baseline proof showed the warm picker already works. A shared reader beside the existing model-catalog store now owns each view's request and subscription lifetime. The existing cache remains the sole display-data owner; connection/scope retirement, Gateway invalidations and model snapshot publications retain their existing semantics. New Session keeps its account-preview and preference-restoration rules, while the palette keeps its independent search-category lifecycle. This preserves the cold-catalog decision in openclaw#119462 and the independent model search behavior in openclaw#151022. Baseline browser proof already showed retained rows during a held refresh, so this PR does not claim to fix a warm-picker loading regression. No config, schema, protocol, Gateway startup, persistent catalog state, or plugin-loading changes. No migration is required. Follow-ups deliberately outside this PR: migrate chat-state-refresh, chat-command-executor, Agents settings, Automations, Config, Search, model-providers/load, model-providers/catalog-discovery, model-setup/native-model-setup, and chat-metadata-store to the shared reader where their lifetimes fit. ## Evidence - Built Control UI with the mocked Gateway in Chromium: baseline and candidate retain fetched rows during a held refresh, including desktop/mobile remount revalidation. Both preserve the cold loading state without exposing the configured default as an option. - Added the standing held-refresh scenario: select a different fetched model without resolving models.list; the selected label changes and the picker remains nonbusy. It passed on the original base and candidate (candidate: 1.31 s scenario), confirming this is behavior-preserving consolidation rather than a new warm-picker fix. - New Session and palette component coverage: 175 tests passed across nine files (8.67 s Vitest / 10.02 s command wall). Covers independent model results while another category is pending, recovery through another view's publication, invalidation/retry, stale owners, account previews, and preference restoration. - Replaced two update-notification-count waits with observable model-state waits; no behavior assertion was removed. - Complete New Session model-catalog and palette-first-open browser files: 19/19 passed against the built candidate (34.40 s Vitest / 36.19 s command wall). - Initial CI [run 36086860473](https://github.com/openclaw/openclaw/actions/runs/36086860473) identified two PR-owned static issues and unrelated upstream Madge cycles. The static issues and upstream cycles are resolved on the final candidate. - Static corrections at `06b184e08d2f` remove the palette's now-redundant optional checks/Boolean conversion and reflow the New Session promise chain. Palette and account/metadata lifecycle coverage passed again: 83/83 tests (12.02 s Vitest / 17.95 s command wall). - Final candidate `dcf448e5e112` includes upstream import-cycle repairs `f0a975a559c` and `f943dccb29e`. Exact-head [CI run 36093827970](https://github.com/openclaw/openclaw/actions/runs/36093827970) is green, and hosted ClawSweeper review is `ready` with no findings. - Rebuilt and replayed both browser files after merging those repairs: 19/19 passed (34.43 s Vitest / 36.29 s command wall). ### Before and after Synthetic fixtures; `models.list` remains held in each pictured state. | State | Before | After | | --- | --- | --- | | Fetched models remain selectable during refresh |  |  | | Cold scope does not invent model options |  |  | Co-authored-by: Ayaan Zaidi <[email protected]>






What Problem This Solves
Fixes an issue where users starting a new Control UI session could see a
plausible one-model picker when
chat.metadatatimed out or failed, eventhough model availability was unknown and the Gateway catalog contained more
models.
Why This Change Was Made
The new-session model control now owns an explicit metadata state machine for
loading, refreshing, ready, empty, and error states. It preserves a successful
same-agent catalog during refresh, clears it at agent/owner boundaries,
coalesces equivalent in-flight loads, and keeps configured preferences without
presenting them as fetched availability.
The
chat.metadataRPC contract and Gateway metadata ownership are unchanged.User Impact
The model picker now reports loading and failure states truthfully, offers a
compact retry action, keeps valid stale results during same-agent refresh, and
recovers to the complete catalog after metadata becomes available.
Evidence
AI-assisted: Codex.
50c7444edf4be40a075d3689bec8fd5b676c2843: an actual Gateway responsecontaining three models was delayed beyond the browser timeout, and the UI
rendered one selectable configured-default model.
tbx_01kz7xdf4z3d1480qqrf2mdbwg94e5bb8d207e4452619c27b7839f0cc838f590ff: the same delayed three-modelresponse rendered
Models unavailablewith zero options; retry issued onesecond request and rendered all three models. Desktop and mobile screenshots
and a raw browser recording were captured.
tbx_01kz8011xnh9addq3ebm6bq65z47dcbb57ddf958ac4804d4405f82b5ac035a1455has the identical stable patch ID; the intervening canonical commit only
changed daemon service-path and usage-rollup files.
ui/src/lib/chat/model-select-state.test.tsandui/src/pages/new-session/model-control.test.ts.ui/src/e2e/new-session-page.catalog-reconnect.e2e.test.ts.typechecks, dead-export scans, and lint.