Discover TUI collaboration modes from the app server (#42401)

## What changed

- Fetch `collaborationMode/list` during TUI startup and reconnect, and use the
  returned catalog for visible collaboration-mode selection.
- Keep collaboration-mode discovery optional with a two-second timeout so an
  unavailable, invalid, or unsupported response does not block bootstrap.
- Preserve discovered modes when the model catalog refreshes, clear restored
  developer-instruction overrides when selecting a server mode, and retain a
  `/plan` draft when plan mode is unavailable.

## Testing

- Cover optional discovery failures and catalog refresh on reconnect.
- Cover server mode selection, model refreshes, restored settings, and
  unavailable plan mode.

GitOrigin-RevId: a6e35c14aab2e38526606164091ac64c500151bb
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-03 00:45:48 +00:00
1 parent 54a4077c8b
commit d4dc882998
15 files changed
+292 -22

No files matched your search

+7 -4
View File
@@ -140,9 +140,12 @@ pub(super) fn test_session_telemetry(config: &Config, model: &str) -> SessionTel
}
pub(super) fn test_model_catalog(_config: &Config) -> Arc<ModelCatalog> {
Arc::new(ModelCatalog::new(
crate::test_support::TEST_MODEL_PRESETS.clone(),
))
Arc::new(
ModelCatalog::new(crate::test_support::TEST_MODEL_PRESETS.clone())
.with_collaboration_modes(
codex_models_manager::collaboration_mode_presets::builtin_collaboration_mode_presets(),
),
)
}
// --- Helpers for tests that need direct construction and event draining ---
@@ -309,7 +312,7 @@ pub(crate) fn set_fast_mode_test_catalog(chat: &mut ChatWidget) {
.map(Into::into)
.collect();
chat.model_catalog = Arc::new(ModelCatalog::new(models));
Arc::make_mut(&mut chat.model_catalog).models = models;
}
pub(crate) async fn make_chatwidget_manual_with_sender() -> (