From 246c6dc8a1db8803d740a4f9dae54d6c415ecc11 Mon Sep 17 00:00:00 2001 From: pash Date: Wed, 4 Mar 2026 01:10:04 -0800 Subject: [PATCH] [tui] Show speed in session header Co-authored-by: Codex --- codex-rs/tui/src/app.rs | 1 + codex-rs/tui/src/chatwidget.rs | 1 + codex-rs/tui/src/history_cell.rs | 39 ++++++++++++++++++- ...ter_long_transcript_fresh_header_only.snap | 1 + ...nfo_availability_nux_tooltip_snapshot.snap | 13 ++++--- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index dd20187508..f07e248198 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -801,6 +801,7 @@ impl App { history_cell::SessionHeaderHistoryCell::new( self.chat_widget.current_model().to_string(), self.chat_widget.current_reasoning_effort(), + self.chat_widget.current_service_tier(), self.config.cwd.clone(), version, ) diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 840505f36b..98f4b5d56a 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -7394,6 +7394,7 @@ impl ChatWidget { DEFAULT_MODEL_DISPLAY_NAME.to_string(), placeholder_style, None, + config.service_tier, config.cwd.clone(), CODEX_CLI_VERSION, )) diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 76e92ca0e3..e2562f162e 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -44,6 +44,7 @@ use codex_core::plugins::PluginsManager; use codex_core::web_search::web_search_detail; use codex_otel::RuntimeMetricsSummary; use codex_protocol::account::PlanType; +use codex_protocol::config_types::ServiceTier; use codex_protocol::mcp::Resource; use codex_protocol::mcp::ResourceTemplate; use codex_protocol::models::WebSearchAction; @@ -1056,6 +1057,7 @@ pub(crate) fn new_session_info( let header = SessionHeaderHistoryCell::new( model.clone(), reasoning_effort, + config.service_tier, config.cwd.clone(), CODEX_CLI_VERSION, ); @@ -1137,6 +1139,7 @@ pub(crate) struct SessionHeaderHistoryCell { model: String, model_style: Style, reasoning_effort: Option, + service_tier: Option, directory: PathBuf, } @@ -1144,6 +1147,7 @@ impl SessionHeaderHistoryCell { pub(crate) fn new( model: String, reasoning_effort: Option, + service_tier: Option, directory: PathBuf, version: &'static str, ) -> Self { @@ -1151,6 +1155,7 @@ impl SessionHeaderHistoryCell { model, Style::default(), reasoning_effort, + service_tier, directory, version, ) @@ -1160,6 +1165,7 @@ impl SessionHeaderHistoryCell { model: String, model_style: Style, reasoning_effort: Option, + service_tier: Option, directory: PathBuf, version: &'static str, ) -> Self { @@ -1168,6 +1174,7 @@ impl SessionHeaderHistoryCell { model, model_style, reasoning_effort, + service_tier, directory, } } @@ -1209,6 +1216,13 @@ impl SessionHeaderHistoryCell { ReasoningEffortConfig::None => "none", }) } + + fn speed_label(&self) -> &'static str { + match self.service_tier { + Some(ServiceTier::Fast) => "Fast", + _ => "Standard", + } + } } impl HistoryCell for SessionHeaderHistoryCell { @@ -1229,6 +1243,8 @@ impl HistoryCell for SessionHeaderHistoryCell { const CHANGE_MODEL_HINT_COMMAND: &str = "/model"; const CHANGE_MODEL_HINT_EXPLANATION: &str = " to change"; + const CHANGE_SPEED_HINT_COMMAND: &str = "/fast"; + const CHANGE_SPEED_HINT_EXPLANATION: &str = " to change"; const DIR_LABEL: &str = "directory:"; let label_width = DIR_LABEL.len(); @@ -1260,10 +1276,24 @@ impl HistoryCell for SessionHeaderHistoryCell { let dir = self.format_directory(Some(dir_max_width)); let dir_spans = vec![Span::from(dir_prefix).dim(), Span::from(dir)]; + let speed_label = format!( + "{speed_label:_ OpenAI Codex (v) │ │ │ │ model: gpt-test high /model to change │ +│ speed: Standard /fast to change │ │ directory: /tmp/project │ ╰─────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap index 82869c0171..8f25517140 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap @@ -3,11 +3,12 @@ source: tui/src/history_cell.rs assertion_line: 2608 expression: rendered --- -╭─────────────────────────────────────╮ -│ >_ OpenAI Codex (v0.0.0) │ -│ │ -│ model: gpt-5 /model to change │ -│ directory: /tmp/project │ -╰─────────────────────────────────────╯ +╭───────────────────────────────────────╮ +│ >_ OpenAI Codex (v0.0.0) │ +│ │ +│ model: gpt-5 /model to change │ +│ speed: Standard /fast to change │ +│ directory: /tmp/project │ +╰───────────────────────────────────────╯ Tip: Model just became available