mirror of
https://github.com/openai/codex.git
synced 2026-05-03 02:46:39 +00:00
Show model/reasoning hint when switching modes (#12307)
## Summary - show an info message when switching collaboration modes changes the effective model or reasoning - include the target mode in the message (for example `... for Plan mode.`) - add TUI tests for model-change and reasoning-only change notifications on mode switch <img width="715" height="184" alt="Screenshot 2026-02-20 at 2 01 40 PM" src="https://github.com/user-attachments/assets/18d1beb3-ab87-4e1c-9ada-a10218520420" />
This commit is contained in:
committed by
GitHub
parent
65b9fe8f30
commit
021e39b303
@@ -3584,6 +3584,66 @@ async fn collab_mode_shift_tab_cycles_only_when_enabled_and_idle() {
|
||||
assert_eq!(chat.active_collaboration_mode_kind(), before);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn mode_switch_surfaces_model_change_notification_when_effective_model_changes() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
chat.set_feature_enabled(Feature::CollaborationModes, true);
|
||||
let default_model = chat.current_model().to_string();
|
||||
|
||||
let mut plan_mask =
|
||||
collaboration_modes::mask_for_kind(chat.models_manager.as_ref(), ModeKind::Plan)
|
||||
.expect("expected plan collaboration mode");
|
||||
plan_mask.model = Some("gpt-5.1-codex-mini".to_string());
|
||||
chat.set_collaboration_mask(plan_mask);
|
||||
|
||||
let plan_messages = drain_insert_history(&mut rx)
|
||||
.iter()
|
||||
.map(|lines| lines_to_single_string(lines))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
assert!(
|
||||
plan_messages.contains("Model changed to gpt-5.1-codex-mini medium for Plan mode."),
|
||||
"expected Plan-mode model switch notice, got: {plan_messages:?}"
|
||||
);
|
||||
|
||||
let default_mask = collaboration_modes::default_mask(chat.models_manager.as_ref())
|
||||
.expect("expected default collaboration mode");
|
||||
chat.set_collaboration_mask(default_mask);
|
||||
|
||||
let default_messages = drain_insert_history(&mut rx)
|
||||
.iter()
|
||||
.map(|lines| lines_to_single_string(lines))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
let expected_default_message =
|
||||
format!("Model changed to {default_model} default for Default mode.");
|
||||
assert!(
|
||||
default_messages.contains(&expected_default_message),
|
||||
"expected Default-mode model switch notice, got: {default_messages:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn mode_switch_surfaces_reasoning_change_notification_when_model_stays_same() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.3-codex")).await;
|
||||
chat.set_feature_enabled(Feature::CollaborationModes, true);
|
||||
chat.set_reasoning_effort(Some(ReasoningEffortConfig::High));
|
||||
|
||||
let plan_mask = collaboration_modes::plan_mask(chat.models_manager.as_ref())
|
||||
.expect("expected plan collaboration mode");
|
||||
chat.set_collaboration_mask(plan_mask);
|
||||
|
||||
let plan_messages = drain_insert_history(&mut rx)
|
||||
.iter()
|
||||
.map(|lines| lines_to_single_string(lines))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
assert!(
|
||||
plan_messages.contains("Model changed to gpt-5.3-codex medium for Plan mode."),
|
||||
"expected reasoning-change notice in Plan mode, got: {plan_messages:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn collab_slash_command_opens_picker_and_updates_mode() {
|
||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||
@@ -3649,7 +3709,12 @@ async fn plan_slash_command_switches_to_plan_mode() {
|
||||
|
||||
chat.dispatch_command(SlashCommand::Plan);
|
||||
|
||||
assert!(rx.try_recv().is_err(), "plan should not emit an app event");
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
assert!(
|
||||
matches!(event, AppEvent::InsertHistoryCell(_)),
|
||||
"plan should not emit a non-history app event: {event:?}"
|
||||
);
|
||||
}
|
||||
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Plan);
|
||||
assert_eq!(chat.current_collaboration_mode(), &initial);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user