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

@@ -262,7 +262,7 @@ pub(crate) struct ListSelectionView {
active_tab_idx: Option<usize>,
state: ScrollState,
completion: Option<ViewCompletion>,
dismiss_after_child_accept: bool,
pub(super) dismiss_after_child_accept: bool,
app_event_tx: AppEventSender,
is_searchable: bool,
search_query: String,
+5 -2
View File
@@ -1198,6 +1198,7 @@ impl BottomPane {
}
/// Replace the newest matching selection view without disturbing views stacked above it.
/// Preserve pending parent cleanup when an already-open child is accepted.
pub(crate) fn replace_selection_view_if_present(
&mut self,
view_id: &'static str,
@@ -1213,11 +1214,13 @@ impl BottomPane {
let replaces_active_view = index + 1 == self.view_stack.len();
self.apply_standard_popup_hint(&mut params);
self.view_stack[index] = Box::new(list_selection_view::ListSelectionView::new(
let mut view = list_selection_view::ListSelectionView::new(
params,
self.app_event_tx.clone(),
self.keymap.list.clone(),
));
);
view.dismiss_after_child_accept = self.view_stack[index].dismiss_after_child_accept();
self.view_stack[index] = Box::new(view);
if replaces_active_view {
self.schedule_active_view_frame();
}