Rename code mode to default

This commit is contained in:
Charles Cunningham
2026-01-30 07:31:41 -08:00
parent 09d25e91e9
commit 560a1e2dda
25 changed files with 97 additions and 95 deletions
@@ -1,7 +1,7 @@
//! Validates that the collaboration mode list endpoint returns the expected default presets.
//!
//! The test drives the app server through the MCP harness and asserts that the list response
//! includes the plan, coding, pair programming, and execute modes with their default model and reasoning
//! includes the plan, default, pair programming, and execute modes with their default model and reasoning
//! effort settings, which keeps the API contract visible in one place.
#![allow(clippy::unwrap_used)]
@@ -47,7 +47,7 @@ async fn list_collaboration_modes_returns_presets() -> Result<()> {
let expected = [
plan_preset(),
code_preset(),
default_preset(),
pair_programming_preset(),
execute_preset(),
];
@@ -89,12 +89,12 @@ fn pair_programming_preset() -> CollaborationModeMask {
.unwrap()
}
/// Builds the code preset that the list response is expected to return.
fn code_preset() -> CollaborationModeMask {
/// Builds the default preset that the list response is expected to return.
fn default_preset() -> CollaborationModeMask {
let presets = test_builtin_collaboration_mode_presets();
presets
.into_iter()
.find(|p| p.mode == Some(ModeKind::Code))
.find(|p| p.mode == Some(ModeKind::Default))
.unwrap()
}
+1 -1
View File
@@ -375,7 +375,7 @@
"description": "Initial collaboration mode to use when the TUI starts.",
"enum": [
"plan",
"code",
"default",
"pair_programming",
"execute",
"custom"
+1 -1
View File
@@ -119,7 +119,7 @@ pub enum Feature {
SkillEnvVarDependencyPrompt,
/// Steer feature flag - when enabled, Enter submits immediately instead of queuing.
Steer,
/// Enable collaboration modes (Plan, Code, Pair Programming, Execute).
/// Enable collaboration modes (Plan, Default, Pair Programming, Execute).
CollaborationModes,
/// Enable personality selection in the TUI.
Personality,
@@ -3,7 +3,8 @@ use codex_protocol::config_types::ModeKind;
use codex_protocol::openai_models::ReasoningEffort;
const COLLABORATION_MODE_PLAN: &str = include_str!("../../templates/collaboration_mode/plan.md");
const COLLABORATION_MODE_CODE: &str = include_str!("../../templates/collaboration_mode/code.md");
const COLLABORATION_MODE_DEFAULT: &str =
include_str!("../../templates/collaboration_mode/default.md");
const COLLABORATION_MODE_PAIR_PROGRAMMING: &str =
include_str!("../../templates/collaboration_mode/pair_programming.md");
const COLLABORATION_MODE_EXECUTE: &str =
@@ -12,7 +13,7 @@ const COLLABORATION_MODE_EXECUTE: &str =
pub(super) fn builtin_collaboration_mode_presets() -> Vec<CollaborationModeMask> {
vec![
plan_preset(),
code_preset(),
default_preset(),
pair_programming_preset(),
execute_preset(),
]
@@ -33,13 +34,13 @@ fn plan_preset() -> CollaborationModeMask {
}
}
fn code_preset() -> CollaborationModeMask {
fn default_preset() -> CollaborationModeMask {
CollaborationModeMask {
name: "Code".to_string(),
mode: Some(ModeKind::Code),
name: "Default".to_string(),
mode: Some(ModeKind::Default),
model: None,
reasoning_effort: None,
developer_instructions: Some(Some(COLLABORATION_MODE_CODE.to_string())),
developer_instructions: Some(Some(COLLABORATION_MODE_DEFAULT.to_string())),
}
}
@@ -39,7 +39,7 @@ impl ToolHandler for RequestUserInputHandler {
let mode = session.collaboration_mode().await.mode;
if !matches!(mode, ModeKind::Plan | ModeKind::PairProgramming) {
let mode_name = match mode {
ModeKind::Code => "Code",
ModeKind::Default => "Default",
ModeKind::Execute => "Execute",
ModeKind::Custom => "Custom",
ModeKind::Plan | ModeKind::PairProgramming => unreachable!(),
@@ -1 +0,0 @@
you are now in code mode.
@@ -0,0 +1 @@
you are now in default mode.
@@ -286,9 +286,9 @@ async fn request_user_input_rejected_in_execute_mode() -> anyhow::Result<()> {
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn request_user_input_rejected_in_code_mode() -> anyhow::Result<()> {
assert_request_user_input_rejected("Code", |model| CollaborationMode {
mode: ModeKind::Code,
async fn request_user_input_rejected_in_default_mode() -> anyhow::Result<()> {
assert_request_user_input_rejected("Default", |model| CollaborationMode {
mode: ModeKind::Default,
settings: Settings {
model,
reasoning_effort: None,
+3 -3
View File
@@ -170,7 +170,7 @@ pub enum AltScreenMode {
#[serde(rename_all = "snake_case")]
pub enum ModeKind {
Plan,
Code,
Default,
PairProgramming,
Execute,
Custom,
@@ -273,7 +273,7 @@ mod tests {
#[test]
fn apply_mask_can_clear_optional_fields() {
let mode = CollaborationMode {
mode: ModeKind::Code,
mode: ModeKind::Default,
settings: Settings {
model: "gpt-5.2-codex".to_string(),
reasoning_effort: Some(ReasoningEffort::High),
@@ -289,7 +289,7 @@ mod tests {
};
let expected = CollaborationMode {
mode: ModeKind::Code,
mode: ModeKind::Default,
settings: Settings {
model: "gpt-5.2-codex".to_string(),
reasoning_effort: None,
+13 -11
View File
@@ -2395,7 +2395,8 @@ impl ChatComposer {
is_task_running: self.is_task_running,
quit_shortcut_key: self.quit_shortcut_key,
steer_enabled: self.steer_enabled,
collaboration_modes_enabled: self.collaboration_modes_enabled,
show_mode_cycle_hint: self.collaboration_modes_enabled
&& self.collaboration_mode_indicator.is_some(),
is_wsl,
context_window_percent: self.context_window_percent,
context_window_used_tokens: self.context_window_used_tokens,
@@ -2873,7 +2874,8 @@ impl ChatComposer {
}
ActivePopup::None => {
let footer_props = self.footer_props();
let show_cycle_hint = !footer_props.is_task_running;
let show_cycle_hint =
!footer_props.is_task_running && footer_props.show_mode_cycle_hint;
let show_shortcuts_hint = match footer_props.mode {
FooterMode::ComposerEmpty => !self.is_in_paste_burst(),
FooterMode::QuitShortcutReminder
@@ -3362,14 +3364,14 @@ mod tests {
// Empty textarea, agent idle: shortcuts hint can show, and cycle hint is available.
snapshot_composer_state_with_width("footer_collapse_empty_full", 120, true, |composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, CollaborationModeIndicator::Plan);
});
snapshot_composer_state_with_width(
"footer_collapse_empty_mode_cycle_with_context",
60,
true,
|composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, CollaborationModeIndicator::Plan);
},
);
snapshot_composer_state_with_width(
@@ -3377,7 +3379,7 @@ mod tests {
44,
true,
|composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, CollaborationModeIndicator::Plan);
},
);
snapshot_composer_state_with_width(
@@ -3385,13 +3387,13 @@ mod tests {
26,
true,
|composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, CollaborationModeIndicator::Plan);
},
);
// Textarea has content, agent running, steer enabled: queue hint is shown.
snapshot_composer_state_with_width("footer_collapse_queue_full", 120, true, |composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, CollaborationModeIndicator::Plan);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
@@ -3401,7 +3403,7 @@ mod tests {
50,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, CollaborationModeIndicator::Plan);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
@@ -3412,7 +3414,7 @@ mod tests {
40,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, CollaborationModeIndicator::Plan);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
@@ -3423,7 +3425,7 @@ mod tests {
30,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, CollaborationModeIndicator::Plan);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
@@ -3434,7 +3436,7 @@ mod tests {
20,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, CollaborationModeIndicator::Plan);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
+21 -24
View File
@@ -60,7 +60,7 @@ pub(crate) struct FooterProps {
pub(crate) use_shift_enter_hint: bool,
pub(crate) is_task_running: bool,
pub(crate) steer_enabled: bool,
pub(crate) collaboration_modes_enabled: bool,
pub(crate) show_mode_cycle_hint: bool,
pub(crate) is_wsl: bool,
/// Which key the user must press again to quit.
///
@@ -73,7 +73,6 @@ pub(crate) struct FooterProps {
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum CollaborationModeIndicator {
Plan,
Code,
PairProgramming,
Execute,
}
@@ -89,7 +88,6 @@ impl CollaborationModeIndicator {
};
match self {
CollaborationModeIndicator::Plan => format!("Plan mode{suffix}"),
CollaborationModeIndicator::Code => format!("Code mode{suffix}"),
CollaborationModeIndicator::PairProgramming => {
format!("Pair Programming mode{suffix}")
}
@@ -101,7 +99,6 @@ impl CollaborationModeIndicator {
let label = self.label(show_cycle_hint);
match self {
CollaborationModeIndicator::Plan => Span::from(label).magenta(),
CollaborationModeIndicator::Code => Span::from(label).dim(),
CollaborationModeIndicator::PairProgramming => Span::from(label).cyan(),
CollaborationModeIndicator::Execute => Span::from(label).dim(),
}
@@ -557,7 +554,7 @@ fn footer_from_props_lines(
use_shift_enter_hint: props.use_shift_enter_hint,
esc_backtrack_hint: props.esc_backtrack_hint,
is_wsl: props.is_wsl,
collaboration_modes_enabled: props.collaboration_modes_enabled,
show_mode_cycle_hint: props.show_mode_cycle_hint,
};
shortcut_overlay_lines(state)
}
@@ -620,7 +617,7 @@ struct ShortcutsState {
use_shift_enter_hint: bool,
esc_backtrack_hint: bool,
is_wsl: bool,
collaboration_modes_enabled: bool,
show_mode_cycle_hint: bool,
}
fn quit_shortcut_reminder_line(key: KeyBinding) -> Line<'static> {
@@ -787,7 +784,7 @@ enum DisplayCondition {
WhenShiftEnterHint,
WhenNotShiftEnterHint,
WhenUnderWSL,
WhenCollaborationModesEnabled,
WhenModeCycleHintVisible,
}
impl DisplayCondition {
@@ -797,7 +794,7 @@ impl DisplayCondition {
DisplayCondition::WhenShiftEnterHint => state.use_shift_enter_hint,
DisplayCondition::WhenNotShiftEnterHint => !state.use_shift_enter_hint,
DisplayCondition::WhenUnderWSL => state.is_wsl,
DisplayCondition::WhenCollaborationModesEnabled => state.collaboration_modes_enabled,
DisplayCondition::WhenModeCycleHintVisible => state.show_mode_cycle_hint,
}
}
}
@@ -944,7 +941,7 @@ const SHORTCUTS: &[ShortcutDescriptor] = &[
id: ShortcutId::ChangeMode,
bindings: &[ShortcutBinding {
key: key_hint::shift(KeyCode::Tab),
condition: DisplayCondition::WhenCollaborationModesEnabled,
condition: DisplayCondition::WhenModeCycleHintVisible,
}],
prefix: "",
label: " to change mode",
@@ -1071,7 +1068,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1087,7 +1084,7 @@ mod tests {
use_shift_enter_hint: true,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1096,14 +1093,14 @@ mod tests {
);
snapshot_footer(
"footer_shortcuts_collaboration_modes_enabled",
"footer_shortcuts_show_mode_cycle_hint",
FooterProps {
mode: FooterMode::ShortcutOverlay,
esc_backtrack_hint: false,
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: true,
show_mode_cycle_hint: true,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1119,7 +1116,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1135,7 +1132,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: true,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1151,7 +1148,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1167,7 +1164,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1183,7 +1180,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: true,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: Some(72),
@@ -1199,7 +1196,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1215,7 +1212,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: true,
steer_enabled: false,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1231,7 +1228,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: true,
steer_enabled: true,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1245,7 +1242,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: false,
steer_enabled: false,
collaboration_modes_enabled: true,
show_mode_cycle_hint: true,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1272,7 +1269,7 @@ mod tests {
use_shift_enter_hint: false,
is_task_running: true,
steer_enabled: false,
collaboration_modes_enabled: true,
show_mode_cycle_hint: true,
is_wsl: false,
quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')),
context_window_percent: None,
@@ -1316,7 +1313,7 @@ mod tests {
use_shift_enter_hint: false,
esc_backtrack_hint: false,
is_wsl,
collaboration_modes_enabled: false,
show_mode_cycle_hint: false,
})
.expect("shortcut binding")
.key;
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" ? for shortcuts · Code mode (shift+tab to cycle) 100% context left "
" ? for shortcuts · Plan mode (shift+tab to cycle) 100% context left "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode (shift+tab to cycle) 100% context left "
" Plan mode (shift+tab to cycle) 100% context left "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode (shift+tab to cycle) "
" Plan mode (shift+tab to cycle) "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode "
" Plan mode "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" tab to queue message · Code mode 98% context left "
" tab to queue message · Plan mode 98% context left "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" tab to queue message · Code mode "
" tab to queue message · Plan mode "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode "
" Plan mode "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" tab to queue · Code mode 98% context left "
" tab to queue · Plan mode 98% context left "
@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" tab to queue · Code mode "
" tab to queue · Plan mode "
+9 -9
View File
@@ -131,7 +131,7 @@ const DEFAULT_MODEL_DISPLAY_NAME: &str = "loading";
const PLAN_IMPLEMENTATION_TITLE: &str = "Implement this plan?";
const PLAN_IMPLEMENTATION_YES: &str = "Yes, implement this plan";
const PLAN_IMPLEMENTATION_NO: &str = "No, stay in Plan mode";
const PLAN_IMPLEMENTATION_CODING_MESSAGE: &str = "Implement the plan.";
const PLAN_IMPLEMENTATION_MESSAGE: &str = "Implement the plan.";
use crate::app_event::AppEvent;
use crate::app_event::ConnectorsSnapshot;
@@ -1023,10 +1023,10 @@ impl ChatWidget {
}
fn open_plan_implementation_prompt(&mut self) {
let code_mask = collaboration_modes::code_mask(self.models_manager.as_ref());
let (implement_actions, implement_disabled_reason) = match code_mask {
let default_mask = collaboration_modes::default_mask_for_tui(self.models_manager.as_ref());
let (implement_actions, implement_disabled_reason) = match default_mask {
Some(mask) => {
let user_text = PLAN_IMPLEMENTATION_CODING_MESSAGE.to_string();
let user_text = PLAN_IMPLEMENTATION_MESSAGE.to_string();
let actions: Vec<SelectionAction> = vec![Box::new(move |tx| {
tx.send(AppEvent::SubmitUserMessageWithMode {
text: user_text.clone(),
@@ -1035,13 +1035,13 @@ impl ChatWidget {
})];
(actions, None)
}
None => (Vec::new(), Some("Code mode unavailable".to_string())),
None => (Vec::new(), Some("Default mode unavailable".to_string())),
};
let items = vec![
SelectionItem {
name: PLAN_IMPLEMENTATION_YES.to_string(),
description: Some("Switch to Code and start coding.".to_string()),
description: Some("Switch to Default and start coding.".to_string()),
selected_description: None,
is_current: false,
actions: implement_actions,
@@ -5201,7 +5201,7 @@ impl ChatWidget {
}
match self.active_mode_kind() {
ModeKind::Plan => Some("Plan"),
ModeKind::Code => Some("Code"),
ModeKind::Default => None,
ModeKind::PairProgramming => Some("Pair Programming"),
ModeKind::Execute => Some("Execute"),
ModeKind::Custom => None,
@@ -5214,7 +5214,7 @@ impl ChatWidget {
}
match self.active_mode_kind() {
ModeKind::Plan => Some(CollaborationModeIndicator::Plan),
ModeKind::Code => Some(CollaborationModeIndicator::Code),
ModeKind::Default => None,
ModeKind::PairProgramming => Some(CollaborationModeIndicator::PairProgramming),
ModeKind::Execute => Some(CollaborationModeIndicator::Execute),
ModeKind::Custom => None,
@@ -5240,7 +5240,7 @@ impl ChatWidget {
}
}
/// Cycle to the next collaboration mode variant (Plan -> Code -> Plan).
/// Cycle to the next collaboration mode variant (Plan -> Default -> Plan).
fn cycle_collaboration_mode(&mut self) {
if !self.collaboration_modes_enabled() {
return;
@@ -4,7 +4,7 @@ expression: popup
---
Implement this plan?
› 1. Yes, implement this plan Switch to Code and start coding.
› 1. Yes, implement this plan Switch to Default and start coding.
2. No, stay in Plan mode Continue planning with the model.
Press enter to confirm or esc to go back
@@ -4,7 +4,7 @@ expression: popup
---
Implement this plan?
1. Yes, implement this plan Switch to Code and start coding.
1. Yes, implement this plan Switch to Default and start coding.
› 2. No, stay in Plan mode Continue planning with the model.
Press enter to confirm or esc to go back
+15 -15
View File
@@ -1206,32 +1206,32 @@ async fn plan_implementation_popup_yes_emits_submit_message_event() {
else {
panic!("expected SubmitUserMessageWithMode, got {event:?}");
};
assert_eq!(text, PLAN_IMPLEMENTATION_CODING_MESSAGE);
assert_eq!(collaboration_mode.mode, Some(ModeKind::Code));
assert_eq!(text, PLAN_IMPLEMENTATION_MESSAGE);
assert_eq!(collaboration_mode.mode, Some(ModeKind::Default));
}
#[tokio::test]
async fn submit_user_message_with_mode_sets_coding_collaboration_mode() {
async fn submit_user_message_with_mode_sets_default_collaboration_mode() {
let (mut chat, _rx, mut op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
chat.thread_id = Some(ThreadId::new());
chat.set_feature_enabled(Feature::CollaborationModes, true);
let code_mode = collaboration_modes::code_mask(chat.models_manager.as_ref())
.expect("expected code collaboration mode");
chat.submit_user_message_with_mode("Implement the plan.".to_string(), code_mode);
let default_mode = collaboration_modes::default_mask_for_tui(chat.models_manager.as_ref())
.expect("expected default collaboration mode");
chat.submit_user_message_with_mode("Implement the plan.".to_string(), default_mode);
match next_submit_op(&mut op_rx) {
Op::UserTurn {
collaboration_mode:
Some(CollaborationMode {
mode: ModeKind::Code,
mode: ModeKind::Default,
..
}),
personality: None,
..
} => {}
other => {
panic!("expected Op::UserTurn with code collab mode, got {other:?}")
panic!("expected Op::UserTurn with default collab mode, got {other:?}")
}
}
}
@@ -2210,7 +2210,7 @@ async fn collab_mode_shift_tab_cycles_only_when_enabled_and_idle() {
assert_eq!(chat.current_collaboration_mode(), &initial);
chat.handle_key_event(KeyEvent::from(KeyCode::BackTab));
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Code);
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Default);
assert_eq!(chat.current_collaboration_mode(), &initial);
chat.on_task_started();
@@ -2246,14 +2246,14 @@ async fn collab_slash_command_opens_picker_and_updates_mode() {
Op::UserTurn {
collaboration_mode:
Some(CollaborationMode {
mode: ModeKind::Code,
mode: ModeKind::Default,
..
}),
personality: None,
..
} => {}
other => {
panic!("expected Op::UserTurn with code collab mode, got {other:?}")
panic!("expected Op::UserTurn with default collab mode, got {other:?}")
}
}
@@ -2264,14 +2264,14 @@ async fn collab_slash_command_opens_picker_and_updates_mode() {
Op::UserTurn {
collaboration_mode:
Some(CollaborationMode {
mode: ModeKind::Code,
mode: ModeKind::Default,
..
}),
personality: None,
..
} => {}
other => {
panic!("expected Op::UserTurn with code collab mode, got {other:?}")
panic!("expected Op::UserTurn with default collab mode, got {other:?}")
}
}
}
@@ -2290,7 +2290,7 @@ async fn plan_slash_command_switches_to_plan_mode() {
}
#[tokio::test]
async fn collaboration_modes_defaults_to_code_on_startup() {
async fn collaboration_modes_defaults_to_default_on_startup() {
let codex_home = tempdir().expect("tempdir");
let cfg = ConfigBuilder::default()
.codex_home(codex_home.path().to_path_buf())
@@ -2324,7 +2324,7 @@ async fn collaboration_modes_defaults_to_code_on_startup() {
};
let chat = ChatWidget::new(init, thread_manager);
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Code);
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Default);
assert_eq!(chat.current_model(), resolved_model);
}
+6 -4
View File
@@ -3,7 +3,7 @@ use codex_protocol::config_types::CollaborationModeMask;
use codex_protocol::config_types::ModeKind;
fn is_tui_mode(kind: ModeKind) -> bool {
matches!(kind, ModeKind::Plan | ModeKind::Code)
matches!(kind, ModeKind::Plan | ModeKind::Default)
}
fn filtered_presets(models_manager: &ModelsManager) -> Vec<CollaborationModeMask> {
@@ -22,7 +22,7 @@ pub(crate) fn default_mask(models_manager: &ModelsManager) -> Option<Collaborati
let presets = filtered_presets(models_manager);
presets
.iter()
.find(|mask| mask.mode == Some(ModeKind::Code))
.find(|mask| mask.mode == Some(ModeKind::Default))
.cloned()
.or_else(|| presets.into_iter().next())
}
@@ -56,8 +56,10 @@ pub(crate) fn next_mask(
presets.get(next_index).cloned()
}
pub(crate) fn code_mask(models_manager: &ModelsManager) -> Option<CollaborationModeMask> {
mask_for_kind(models_manager, ModeKind::Code)
pub(crate) fn default_mask_for_tui(
models_manager: &ModelsManager,
) -> Option<CollaborationModeMask> {
mask_for_kind(models_manager, ModeKind::Default)
}
pub(crate) fn plan_mask(models_manager: &ModelsManager) -> Option<CollaborationModeMask> {