mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
54a4077c8b
commit
d4dc882998
15 files changed
+292
-22
No files matched your search
@@ -53,6 +53,7 @@ async fn reconnect_restores_history_permissions_and_keeps_old_input_paused() ->
|
||||
/*developer_instructions*/ None,
|
||||
);
|
||||
let expected_submitted_mode = expected_mode.clone();
|
||||
assert!(!app.model_catalog.collaboration_modes.is_empty());
|
||||
if edit_offline {
|
||||
app.chat_widget
|
||||
.restore_user_message_to_composer("unacknowledged prompt".into());
|
||||
@@ -260,6 +261,13 @@ async fn reconnect_restores_history_permissions_and_keeps_old_input_paused() ->
|
||||
app.chat_widget.effective_collaboration_mode(),
|
||||
expected_mode
|
||||
);
|
||||
assert!(app.model_catalog.collaboration_modes.is_empty());
|
||||
assert!(
|
||||
app.chat_widget
|
||||
.model_catalog()
|
||||
.collaboration_modes
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.chat_widget.composer_text_with_pending(),
|
||||
if edit_offline {
|
||||
|
||||
@@ -269,6 +269,7 @@ where
|
||||
Some(json!({"result": {"account": null, "requiresOpenaiAuth": false}}))
|
||||
}
|
||||
"model/list" => Some(json!({"result": {"data": [], "nextCursor": null}})),
|
||||
"collaborationMode/list" => Some(json!({"result": {"data": []}})),
|
||||
"configRequirements/read" => Some(json!({"result": {"requirements": null}})),
|
||||
_ => respond(request).await,
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ pub(super) fn configure_reserve_catalog(app: &mut App) {
|
||||
let mut high = original.supported_reasoning_efforts[0].clone();
|
||||
high.effort = ReasoningEffortConfig::High;
|
||||
original.supported_reasoning_efforts.push(high);
|
||||
app.model_catalog = Arc::new(ModelCatalog::new(models));
|
||||
Arc::make_mut(&mut app.model_catalog).models = models;
|
||||
let mut tui = crate::tui::test_support::make_test_tui().unwrap();
|
||||
let mut init = app.chatwidget_init_for_forked_or_resumed_thread(
|
||||
&mut tui,
|
||||
|
||||
Reference in new issue
Block a user