Refresh the TUI model picker from the app server (#41467)

## Why

The model picker can open from a cached startup catalog that no longer reflects the models available to the current account.

## What changed

- Fetch the current model list asynchronously whenever the picker opens, while showing cached choices immediately.
- Refresh an open model picker in place, preserving its highlighted model, dismissal behavior, and reasoning submenu.
- Apply accepted catalog updates to model-dependent UI, service-tier controls, and new-thread defaults. Ignore stale, failed, empty, unchanged, or account-invalidated responses.

## Testing

- Added coverage for catalog refreshes, stale and unusable responses, popup state preservation, empty choices, service tiers, and new-thread defaults.

GitOrigin-RevId: 45abe1d309ff7f90701fffe29c6544ca4157f836
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-08-29 04:30:58 +00:00
1 parent 0b45b171ca
commit 5fc7840cf6
16 files changed
+609 -18

No files matched your search

+10 -3
View File
@@ -982,6 +982,15 @@ pub(crate) enum AppEvent {
service_tier: Option<String>,
},
/// Fetch the current catalog even when cached models produce no picker.
FetchModels {
request_id: uuid::Uuid,
},
ModelsLoaded {
request_id: uuid::Uuid,
result: Result<Vec<ModelPreset>, String>,
},
/// Open the reasoning selection popup after picking a model.
OpenReasoningPopup {
model: ModelPreset,
@@ -1005,9 +1014,7 @@ pub(crate) enum AppEvent {
},
/// Open the full model picker (non-auto models).
OpenAllModelsPopup {
models: Vec<ModelPreset>,
},
OpenAllModelsPopup,
/// Open the confirmation prompt before enabling full access mode.
OpenFullAccessConfirmation {