Lightweight coding agent that runs in your terminal
Rust
Chore: remove mode from header (#9792)
Ahmed Ibrahim1167465bf65d
diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rsindex 03aac67bbc..7063f8f5ba 100644--- a/codex-rs/tui/src/app.rs+++ b/codex-rs/tui/src/app.rs@@ -2583,11 +2583,6 @@ mod tests {app.chat_widget.current_model(),event,is_first,- app.chat_widget- .config_ref()- .features- .enabled(codex_core::features::Feature::CollaborationModes),- app.chat_widget.stored_collaboration_mode().clone(),)) as Arc<dyn HistoryCell>};diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rsindex 5a96e4e381..137e0f3195 100644--- a/codex-rs/tui/src/chatwidget.rs+++ b/codex-rs/tui/src/chatwidget.rs@@ -746,8 +746,6 @@ impl ChatWidget {&model_for_header,event,self.show_welcome_banner,- self.collaboration_modes_enabled(),- self.stored_collaboration_mode.clone(),);self.apply_session_info_cell(session_info_cell);@@ -1948,11 +1946,7 @@ impl ChatWidget {CollaborationMode::Custom(fallback_custom)};- let active_cell = Some(Self::placeholder_session_header_cell(- &config,- config.features.enabled(Feature::CollaborationModes),- stored_collaboration_mode.clone(),- ));+ let active_cell = Some(Self::placeholder_session_header_cell(&config));let mut widget = Self {app_event_tx: app_event_tx.clone(),@@ -2070,11 +2064,7 @@ impl ChatWidget {CollaborationMode::Custom(fallback_custom)};- let active_cell = Some(Self::placeholder_session_header_cell(- &config,- config.features.enabled(Feature::CollaborationModes),- stored_collaboration_mode.clone(),- ));+ let active_cell = Some(Self::placeholder_session_header_cell(&config));let mut widget = Self {app_event_tx: app_event_tx.clone(),@@ -4698,11 +4688,7 @@ impl ChatWidget {}/// Build a placeholder header cell while the session is configuring.- fn placeholder_session_header_cell(- config: &Config,- is_collaboration: bool,- collaboration_mode: CollaborationMode,- ) -> Box<dyn HistoryCell> {+ fn placeholder_session_header_cell(config: &Config) -> Box<dyn HistoryCell> {let placeholder_style = Style::default().add_modifier(Modifier::DIM | Modifier::ITALIC);Box::new(history_cell::SessionHeaderHistoryCell::new_with_style(DEFAULT_MODEL_DISPLAY_NAME.to_string(),@@ -4710,8 +4696,6 @@ impl ChatWidget {None,config.cwd.clone(),CODEX_CLI_VERSION,- is_collaboration,- collaboration_mode,))}diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rsindex 8bd4eda851..174f2a7f6a 100644--- a/codex-rs/tui/src/history_cell.rs+++ b/codex-rs/tui/src/history_cell.rs@@ -19,7 +19,6 @@ use crate::exec_cell::output_lines;use crate::exec_cell::spinner;use crate::exec_command::relativize_to_home;use crate::exec_command::strip_bash_lc_and_escape;-use crate::key_hint;use crate::live_wrap::take_prefix_by_width;use crate::markdown::append_markdown;use crate::render::line_utils::line_to_static;@@ -44,13 +43,11 @@ use codex_core::protocol::FileChange;use codex_core::protocol::McpAuthStatus;use codex_core::protocol::McpInvocation;use codex_core::protocol::SessionConfiguredEvent;-use codex_protocol::config_types::CollaborationMode;use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;use codex_protocol::plan_tool::PlanItemArg;use codex_protocol::plan_tool::StepStatus;use codex_protocol::plan_tool::UpdatePlanArgs;use codex_protocol::user_input::TextElement;-use crossterm::event::KeyCode;use image::DynamicImage;use image::ImageReader;use mcp_types::EmbeddedResourceResource;@@ -906,8 +903,6 @@ pub(crate) fn new_session_info(requested_model: &str,event: SessionConfiguredEvent,is_first_event: bool,- is_collaboration: bool,- collaboration_mode: CollaborationMode,) -> SessionInfoCell {let SessionConfiguredEvent {model,@@ -920,8 +915,6 @@ pub(crate) fn new_session_info(reasoning_effort,config.cwd.clone(),CODEX_CLI_VERSION,- is_collaboration,- collaboration_mode,);let mut parts: Vec<Box<dyn HistoryCell>> = vec![Box::new(header)];@@ -1003,8 +996,6 @@ pub(crate) struct SessionHeaderHistoryCell {model_style: Style,reasoning_effort: Option<ReasoningEffortConfig>,directory: PathBuf,- is_collaboration: bool,- collaboration_mode: CollaborationMode,}impl SessionHeaderHistoryCell {@@ -1013,8 +1004,6 @@ impl SessionHeaderHistoryCell {reasoning_effort: Option<ReasoningEffortConfig>,directory: PathBuf,version: &'static str,- is_collaboration: bool,- collaboration_mode: CollaborationMode,) -> Self {Self::new_with_style(model,@@ -1022,8 +1011,6 @@ impl SessionHeaderHistoryCell {reasoning_effort,directory,version,- is_collaboration,- collaboration_mode,)}@@ -1033,8 +1020,6 @@ impl SessionHeaderHistoryCell {reasoning_effort: Option<ReasoningEffortConfig>,directory: PathBuf,version: &'static str,- is_collaboration: bool,- collaboration_mode: CollaborationMode,) -> Self {Self {version,@@ -1042,20 +1027,6 @@ impl SessionHeaderHistoryCell {model_style,reasoning_effort,directory,- is_collaboration,- collaboration_mode,- }- }-- fn collaboration_mode_label(&self) -> Option<&'static str> {- if !self.is_collaboration {- return None;- }- match &self.collaboration_mode {- CollaborationMode::Plan(_) => Some("Plan"),- CollaborationMode::PairProgramming(_) => Some("Pair Programming"),- CollaborationMode::Execute(_) => Some("Execute"),- CollaborationMode::Custom(_) => None,}}@@ -1116,38 +1087,16 @@ impl HistoryCell for SessionHeaderHistoryCell {const CHANGE_MODEL_HINT_COMMAND: &str = "/model";const CHANGE_MODEL_HINT_EXPLANATION: &str = " to change";- const CHANGE_MODE_HINT_EXPLANATION: &str = " to change mode";const DIR_LABEL: &str = "directory:";let label_width = DIR_LABEL.len();- let model_spans: Vec<Span<'static>> = if self.is_collaboration {- // Render collaboration mode instead of model- let collab_label = format!(- "{collab_label:<label_width$}",- collab_label = "mode:",- label_width = label_width- );- let mut spans = vec![Span::from(format!("{collab_label} ")).dim()];- if self.model == "loading" {- spans.push(Span::styled(self.model.clone(), self.model_style));- } else if let Some(mode_label) = self.collaboration_mode_label() {- spans.push(Span::styled(mode_label.to_string(), self.model_style));- } else {- spans.push(Span::styled("Custom", self.model_style));- }- spans.push(" ".dim());- let shift_tab_span: Span<'static> = key_hint::shift(KeyCode::Tab).into();- spans.push(shift_tab_span.cyan());- spans.push(CHANGE_MODE_HINT_EXPLANATION.dim());- spans- } else {- // Render model as before- let model_label = format!(- "{model_label:<label_width$}",- model_label = "model:",- label_width = label_width- );- let reasoning_label = self.reasoning_label();+ let model_label = format!(+ "{model_label:<label_width$}",+ model_label = "model:",+ label_width = label_width+ );+ let reasoning_label = self.reasoning_label();+ let model_spans: Vec<Span<'static>> = {let mut spans = vec![Span::from(format!("{model_label} ")).dim(),Span::styled(self.model.clone(), self.model_style),@@ -1888,8 +1837,6 @@ mod tests {use codex_core::config::types::McpServerConfig;use codex_core::config::types::McpServerTransportConfig;use codex_core::protocol::McpAuthStatus;- use codex_protocol::config_types::CollaborationMode;- use codex_protocol::config_types::Settings;use codex_protocol::parse_command::ParsedCommand;use dirs::home_dir;use pretty_assertions::assert_eq;@@ -2346,12 +2293,6 @@ mod tests {Some(ReasoningEffortConfig::High),std::env::temp_dir(),"test",- false,- CollaborationMode::Custom(Settings {- model: "gpt-4o".to_string(),- reasoning_effort: Some(ReasoningEffortConfig::High),- developer_instructions: None,- }),);let lines = render_lines(&cell.display_lines(80));