Lightweight coding agent that runs in your terminal
Rust
Use a consistent borderless session header in the TUI (#48562)
Felipe Courye8fdbf1f7c87
diff --git a/codex-rs/tui/src/app/history_ui.rs b/codex-rs/tui/src/app/history_ui.rsindex 4726e8d911..52e7e0203e 100644--- a/codex-rs/tui/src/app/history_ui.rs+++ b/codex-rs/tui/src/app/history_ui.rs@@ -307,7 +307,8 @@ impl App {width: u16,version: &'static str,) -> Vec<Line<'static>> {- self.clear_ui_header_cell(version).display_lines(width)+ self.clear_ui_header_cell(version)+ .display_lines_for_mode(width, self.chat_widget.history_render_mode())}/// Share the source-backed header between retained drawing and legacy terminal insertion.@@ -318,10 +319,6 @@ impl App {let mut header = history_cell::SessionHeaderHistoryCell::new(self.chat_widget.model_display_name().to_string(),self.chat_widget.current_reasoning_effort(),- self.chat_widget.should_show_fast_status(- self.chat_widget.current_model(),- self.chat_widget.current_service_tier(),- ),self.config.cwd.to_path_buf(),version,)@@ -355,7 +352,10 @@ impl App {.history_wrap_width(tui.terminal.last_known_screen_size.width);let header_lines = self.clear_ui_header_lines(width);if !header_lines.is_empty() {- tui.insert_history_lines(header_lines);+ tui.insert_history_lines_with_wrap_policy(+ header_lines,+ self.history_line_wrap_policy(),+ );self.has_emitted_history_lines = true;}}diff --git a/codex-rs/tui/src/app/history_ui_tests.rs b/codex-rs/tui/src/app/history_ui_tests.rsindex e07f8cb3c0..252eb046b4 100644--- a/codex-rs/tui/src/app/history_ui_tests.rs+++ b/codex-rs/tui/src/app/history_ui_tests.rs@@ -53,6 +53,11 @@ async fn owned_clear_resets_navigation_and_retains_one_fresh_header() -> Result<app.transcript_cells[0].display_lines(/*width*/ 80),app.clear_ui_header_lines(/*width*/ 80),);+ app.chat_widget.set_raw_output_mode(/*enabled*/ true);+ assert_eq!(+ app.transcript_cells[0].raw_lines(),+ app.clear_ui_header_lines(/*width*/ 80),+ );assert!(app.transcript_view.is_following());assert!(tui.pending_history_lines_for_test().is_empty());tui.set_owned_screen(/*owned*/ false)?;diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__app_server_thread_replacement_clears_previous_transcript_before_replay-2.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__app_server_thread_replacement_clears_previous_transcript_before_replay-2.snapindex 4b9aa6a689..8aa1bca71b 100644--- a/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__app_server_thread_replacement_clears_previous_transcript_before_replay-2.snap+++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__tests__app_server_thread_replacement_clears_previous_transcript_before_replay-2.snap@@ -1,14 +1,11 @@---source: tui/src/app/tests.rs-assertion_line: 6350+assertion_line: 6513expression: rendered----╭────────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: gpt-test /model to change │-│ directory: <thread cwd> │-╰────────────────────────────────────────╯++ >_ OpenAI Codex (v0.0.0)+ <thread cwd>› Next thread promptdiff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rsindex aaf745c149..1920ce4970 100644--- a/codex-rs/tui/src/app/tests.rs+++ b/codex-rs/tui/src/app/tests.rs@@ -4731,13 +4731,7 @@ async fn thread_read_session_state_does_not_reuse_primary_permission_profile() {app.enqueue_primary_thread_session(session, Vec::new()).await.expect("switch to read thread");- let header =- lines_to_single_string(&app.clear_ui_header_lines_with_version(/*width*/ 80, "<VERSION>"));- let model_line = header- .lines()- .find(|line| line.contains("model:"))- .expect("rendered model line");- assert_app_snapshot!("thread_read_model_after_switch", model_line);+ assert_eq!(app.chat_widget.current_model(), "server-reported-model");}#[test]@@ -5936,7 +5930,9 @@ async fn ctrl_l_clears_owned_history_and_preserves_the_draft() -> Result<()> {.is::<history_cell::SessionHeaderHistoryCell>());let header = lines_to_single_string(&app.transcript_cells[0].display_lines(/*width*/ 80));- assert!(header.contains("gpt-test"));+ assert!(header.contains("OpenAI Codex"));+ let raw_header = lines_to_single_string(&app.transcript_cells[0].raw_lines());+ assert!(raw_header.contains("gpt-test"));assert!(!header.contains("old transcript row"));assert_eq!(app.chat_widget.composer_text_with_pending(),@@ -5948,41 +5944,6 @@ async fn ctrl_l_clears_owned_history_and_preserves_the_draft() -> Result<()> {Ok(())}-#[tokio::test]-#[cfg_attr(- target_os = "windows",- ignore = "snapshot path rendering differs on Windows"-)]-async fn clear_ui_header_shows_fast_status_for_fast_capable_models() {- let mut app = make_test_app().await;- app.config.cwd = test_path_buf("/tmp/project").abs();- app.chat_widget.set_model("gpt-5.4");- set_fast_mode_test_catalog(&mut app.chat_widget);- app.chat_widget- .set_reasoning_effort(Some(ReasoningEffortConfig::XHigh));- app.chat_widget.set_service_tier(Some(- codex_protocol::config_types::ServiceTier::Fast- .request_value()- .to_string(),- ));- set_chatgpt_auth(&mut app.chat_widget);- set_fast_mode_test_catalog(&mut app.chat_widget);-- let rendered = app- .clear_ui_header_lines_with_version(/*width*/ 80, "<VERSION>")- .iter()- .map(|line| {- line.spans- .iter()- .map(|span| span.content.as_ref())- .collect::<String>()- })- .collect::<Vec<_>>()- .join("\n");-- assert_app_snapshot!("clear_ui_header_fast_status_fast_capable_models", rendered);-}-async fn make_test_app() -> Box<App> {let (mut chat_widget, app_event_tx, _rx, _op_rx) = make_chatwidget_manual_with_sender().await;let test_codex_home = chat_widget.test_codex_home.take();@@ -6539,8 +6500,8 @@ async fn app_server_thread_replacement_clears_previous_transcript_before_replay(.iter().map(|line| {let text = rendered_line_text(line);- if text.contains("│ directory: ") {- "│ directory: <thread cwd> │".to_string()+ if text.trim() == test_path_buf("/tmp/next").display().to_string() {+ " <thread cwd>".to_string()} else {text}diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_buffered_replay_reconciles_captions.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_buffered_replay_reconciles_captions.snapindex 0b25023363..ab3a8c84c9 100644--- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_buffered_replay_reconciles_captions.snap+++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_buffered_replay_reconciles_captions.snap@@ -1,14 +1,11 @@---source: tui/src/app/tests/realtime_requests.rs-assertion_line: 645+assertion_line: 889expression: "normalize_voice_snapshot_directory(&rendered, &app.config.cwd)"----╭────────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: gpt-test /model to change │-│ directory: /tmp/project │-╰────────────────────────────────────────╯++ >_ OpenAI Codex (v0.0.0)+ /tmp/projectTo get started, describe a task or try one of these commands:diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_completed_after_thread_switch.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_completed_after_thread_switch.snapindex 8893207f3b..2ecde209a2 100644--- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_completed_after_thread_switch.snap+++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_completed_after_thread_switch.snap@@ -1,14 +1,11 @@---source: tui/src/app/tests/realtime_requests.rs-assertion_line: 1023+assertion_line: 1093expression: "normalize_voice_snapshot_directory(&rendered, &app.config.cwd)"----╭────────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: gpt-test /model to change │-│ directory: /tmp/project │-╰────────────────────────────────────────╯++ >_ OpenAI Codex (v0.0.0)+ /tmp/projectTo get started, describe a task or try one of these commands:diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snapindex 20fa80e4f8..5c3a9d2bce 100644--- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap+++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_partial_completed_after_thread_switch.snap@@ -1,5 +1,6 @@---source: tui/src/app/tests/realtime_requests.rs+assertion_line: 479expression: "normalize_voice_snapshot_directory(&format!(\"Other task:\\n{other_ui}\\nRestored owner:\\n{}\\n{rendered}\",\nrender_bottom_popup(&app.chat_widget, 80)), &app.config.cwd,)"---Other task:@@ -13,12 +14,9 @@ Restored owner:› Ask Codex to do anythinggpt-test default · /tmp/project-╭────────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: gpt-test /model to change │-│ directory: /tmp/project │-╰────────────────────────────────────────╯++ >_ OpenAI Codex (v0.0.0)+ /tmp/projectTo get started, describe a task or try one of these commands:diff --git a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_replay_reconciles_matching_captions.snap b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_replay_reconciles_matching_captions.snapindex 76e81da3ea..0dfd7333b6 100644--- a/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_replay_reconciles_matching_captions.snap+++ b/codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__realtime_requests__voice_replay_reconciles_matching_captions.snap@@ -1,14 +1,11 @@---source: tui/src/app/tests/realtime_requests.rs-assertion_line: 561+assertion_line: 716expression: "normalize_voice_snapshot_directory(&rendered, &app.config.cwd)"----╭────────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: gpt-test /model to change │-│ directory: /tmp/project │-╰────────────────────────────────────────╯++ >_ OpenAI Codex (v0.0.0)+ /tmp/projectTo get started, describe a task or try one of these commands:diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rsindex 56f85b46f5..bad73981fd 100644--- a/codex-rs/tui/src/chatwidget.rs+++ b/codex-rs/tui/src/chatwidget.rs@@ -158,7 +158,6 @@ use crossterm::event::KeyEventKind;use crossterm::event::KeyModifiers;use ratatui::buffer::Buffer;use ratatui::layout::Rect;-use ratatui::style::Modifier;use ratatui::style::Style;use ratatui::style::Stylize;use ratatui::text::Line;@@ -1485,13 +1484,10 @@ impl ChatWidget {/// Build a placeholder header cell while the session is configuring.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(+ history_cell::SessionHeaderHistoryCell::new(DEFAULT_MODEL_DISPLAY_NAME.to_string(),- placeholder_style,/*reasoning_effort*/ None,- /*show_fast_status*/ false,config.cwd.to_path_buf(),CODEX_CLI_VERSION,)diff --git a/codex-rs/tui/src/chatwidget/rendering_tests.rs b/codex-rs/tui/src/chatwidget/rendering_tests.rsindex dc483a41b8..624d58765f 100644--- a/codex-rs/tui/src/chatwidget/rendering_tests.rs+++ b/codex-rs/tui/src/chatwidget/rendering_tests.rs@@ -386,7 +386,7 @@ async fn initial_session_header_starts_at_the_top_of_the_viewport() {let header = frame.content.chunks(usize::from(frame.area.width))- .take(/*n*/ 6)+ .take(/*n*/ 3).map(|row| {row.iter().map(ratatui::buffer::Cell::symbol)@@ -399,15 +399,10 @@ async fn initial_session_header_starts_at_the_top_of_the_viewport() {.replace(crate::version::CODEX_CLI_VERSION, "<VERSION>");let cwd = widget.config.cwd.as_path().display().to_string();- let normalized_cwd = format!("{:<width$}", "/tmp/project", width = cwd.len());-- insta::assert_snapshot!(header.replace(&cwd, &normalized_cwd), @r"- ╭───────────────────────────────────────╮- │ >_ OpenAI Codex (v<VERSION>) │- │ │- │ model: loading /model to change │- │ directory: /tmp/project │- ╰───────────────────────────────────────╯++ insta::assert_snapshot!(header.replace(&cwd, "/tmp/project"), @r"+ >_ OpenAI Codex (v<VERSION>)+ /tmp/project");}diff --git a/codex-rs/tui/src/history_cell/session.rs b/codex-rs/tui/src/history_cell/session.rsindex e749c027fc..32d2f0d3ff 100644--- a/codex-rs/tui/src/history_cell/session.rs+++ b/codex-rs/tui/src/history_cell/session.rs@@ -10,21 +10,6 @@ use crate::line_truncation::truncate_line_with_ellipsis_if_overflow;use crate::style::accent_color;use crate::width::display_width;-pub(crate) const SESSION_HEADER_MAX_INNER_WIDTH: usize = 56; // Just an eyeballed value--pub(crate) fn card_inner_width(width: u16, max_inner_width: usize) -> Option<usize> {- if width < 4 {- return None;- }- let inner_width = std::cmp::min(width.saturating_sub(4) as usize, max_inner_width);- Some(inner_width)-}--/// Render `lines` inside a border sized to the widest span in the content.-pub(crate) fn with_border(lines: Vec<Line<'static>>) -> Vec<Line<'static>> {- with_border_internal(lines, /*forced_inner_width*/ None)-}-/// Render `lines` inside a border whose inner width is at least `inner_width`.////// This is useful when callers have already clamped their content to a@@ -33,18 +18,9 @@ pub(crate) fn with_border(lines: Vec<Line<'static>>) -> Vec<Line<'static>> {pub(crate) fn with_border_with_inner_width(lines: Vec<Line<'static>>,inner_width: usize,-) -> Vec<Line<'static>> {- with_border_internal(lines, Some(inner_width))-}--fn with_border_internal(- lines: Vec<Line<'static>>,- forced_inner_width: Option<usize>,) -> Vec<Line<'static>> {let max_line_width = lines.iter().map(line_width).max().unwrap_or(0);- let content_width = forced_inner_width- .unwrap_or(max_line_width)- .max(max_line_width);+ let content_width = inner_width.max(max_line_width);let mut out = Vec::with_capacity(lines.len() + 2);let border_inner_width = content_width + 2;@@ -68,6 +44,15 @@ fn with_border_internal(out}+/// Brand title shared by the session header and the status card; each owns its own indentation.+pub(crate) fn codex_title(version: &str) -> Vec<Span<'static>> {+ vec![+ ">_ ".fg(accent_color()),+ "OpenAI Codex".bold(),+ format!(" (v{version})").dim(),+ ]+}+#[derive(Debug)]struct TooltipHistoryCell {tip: String,@@ -210,11 +195,10 @@ pub(crate) fn new_session_info(auth_plan: Option<PlanType>,show_fast_status: bool,) -> SessionInfoCell {- // Header box rendered as history (so it appears at the very top)+ // Header rendered as history (so it appears at the very top).let header = SessionHeaderHistoryCell::new(model_display_name.to_string(),session.reasoning_effort.clone(),- show_fast_status,config.cwd.to_path_buf(),CODEX_CLI_VERSION,)@@ -308,9 +292,7 @@ pub(crate) fn has_yolo_permissions(pub(crate) struct SessionHeaderHistoryCell {version: &'static str,model: String,- model_style: Style,reasoning_effort: Option<ReasoningEffortConfig>,- show_fast_status: bool,directory: PathBuf,yolo_mode: bool,greeting: Arc<OnceLock<Greeting>>,@@ -320,34 +302,13 @@ impl SessionHeaderHistoryCell {pub(crate) fn new(model: String,reasoning_effort: Option<ReasoningEffortConfig>,- show_fast_status: bool,- directory: PathBuf,- version: &'static str,- ) -> Self {- Self::new_with_style(- model,- Style::default(),- reasoning_effort,- show_fast_status,- directory,- version,- )- }-- pub(crate) fn new_with_style(- model: String,- model_style: Style,- reasoning_effort: Option<ReasoningEffortConfig>,- show_fast_status: bool,directory: PathBuf,version: &'static str,) -> Self {Self {version,model,- model_style,reasoning_effort,- show_fast_status,directory,yolo_mode: false,greeting: Default::default(),@@ -394,19 +355,13 @@ impl SessionHeaderHistoryCell {}impl HistoryCell for SessionHeaderHistoryCell {- fn compact_hyperlink_lines(&self, width: u16) -> Vec<HyperlinkLine> {- if self.greeting.get().is_none() {- return self.display_hyperlink_lines(width);- }+ fn display_lines(&self, width: u16) -> Vec<Line<'static>> {let width = usize::from(width);+ let mut title = vec![" ".into()];+ title.extend(codex_title(self.version));let mut lines = vec![Line::default(),- Line::from(vec![- " ".into(),- ">_ ".fg(accent_color()),- "OpenAI Codex".bold(),- format!(" (v{})", self.version).dim(),- ]),+ Line::from(title),Line::from(vec![" ".into(),self.format_directory(Some(width.saturating_sub(/*rhs*/ 5)))@@ -426,99 +381,16 @@ impl HistoryCell for SessionHeaderHistoryCell {Line::from(vec![" ".into(), greeting.phrase.fg(accent_color())]),]);}- plain_hyperlink_lines(- lines- .into_iter()- .map(|line| truncate_line_with_ellipsis_if_overflow(line, width))- .collect(),- )- }-- fn display_lines(&self, width: u16) -> Vec<Line<'static>> {- if self.greeting.get().is_some() {- return visible_lines(self.compact_hyperlink_lines(width));- }- let Some(inner_width) = card_inner_width(width, SESSION_HEADER_MAX_INNER_WIDTH) else {- return Vec::new();- };-- let make_row = |spans: Vec<Span<'static>>| Line::from(spans);-- // Title line rendered inside the box: ">_ OpenAI Codex (vX)"- let title_spans: Vec<Span<'static>> = vec![- Span::from(">_ ").dim(),- Span::from("OpenAI Codex").bold(),- Span::from(" ").dim(),- Span::from(format!("(v{})", self.version)).dim(),- ];-- const CHANGE_MODEL_HINT_COMMAND: &str = "/model";- const CHANGE_MODEL_HINT_EXPLANATION: &str = " to change";- const DIR_LABEL: &str = "directory:";- const PERMISSIONS_LABEL: &str = "permissions:";- let label_width = if self.yolo_mode {- DIR_LABEL.len().max(PERMISSIONS_LABEL.len())- } else {- DIR_LABEL.len()- };-- 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),- ];- if let Some(reasoning) = reasoning_label {- spans.push(Span::from(" "));- spans.push(Span::from(reasoning.to_owned()));- }- if self.show_fast_status {- spans.push(" ".into());- spans.push(Span::styled("fast", self.model_style.magenta()));- }- spans.push(" ".dim());- spans.push(CHANGE_MODEL_HINT_COMMAND.fg(accent_color()));- spans.push(CHANGE_MODEL_HINT_EXPLANATION.dim());- spans- };-- let dir_label = format!("{DIR_LABEL:<label_width$}");- let dir_prefix = format!("{dir_label} ");- let dir_prefix_width = display_width(dir_prefix.as_str());- let dir_max_width = inner_width.saturating_sub(dir_prefix_width);- let dir = self.format_directory(Some(dir_max_width));- let dir_spans = vec![Span::from(dir_prefix).dim(), Span::from(dir)];-- let mut lines = vec![- make_row(title_spans),- make_row(Vec::new()),- make_row(model_spans),- make_row(dir_spans),- ];-- if self.yolo_mode {- let permissions_label = format!("{PERMISSIONS_LABEL:<label_width$}");- lines.push(make_row(vec![- Span::from(format!("{permissions_label} ")).dim(),- "YOLO mode".magenta().bold(),- ]));- }-- let lines = lines+ lines.into_iter()- .map(|line| truncate_line_with_ellipsis_if_overflow(line, inner_width))- .collect();- with_border(lines)+ .map(|line| truncate_line_with_ellipsis_if_overflow(line, width))+ .collect()}fn raw_lines(&self) -> Vec<Line<'static>> {if self.greeting.get().is_some() {- return visible_lines(self.compact_hyperlink_lines(u16::MAX))+ return self+ .display_lines(u16::MAX).into_iter().map(|line| Line::from(line.to_string())).collect();diff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_clamps_to_narrow_width.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_clamps_to_narrow_width.snapindex 2baf486e51..13e70b5d2d 100644--- a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_clamps_to_narrow_width.snap+++ b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_clamps_to_narrow_width.snap@@ -1,11 +1,9 @@---source: tui/src/history_cell/tests.rs+assertion_line: 1867expression: "render_lines(&lines).join(\"\\n\")"----╭──────────────────────────────────────────╮-│ >_ OpenAI Codex (vtest) │-│ │-│ model: gpt-5.6-sol xhigh fast … │-│ directory: project │-│ permissions: YOLO mode │-╰──────────────────────────────────────────╯++ >_ OpenAI Codex (vtest)+ project+ permissions: YOLO modediff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_directory.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_directory.snapindex 333f12aa5c..fa464a0b7d 100644--- a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_directory.snap+++ b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_directory.snap@@ -1,27 +1,48 @@---source: tui/src/history_cell/tests.rs-assertion_line: 1908+assertion_line: 1903expression: "format!(\"{buf:?}\")"---Buffer {- area: Rect { x: 0, y: 0, width: 42, height: 6 },+ area: Rect { x: 0, y: 0, width: 42, height: 3 },content: [- "╭────────────────────────────────────────╮",- "│ >_ OpenAI Codex (vtest) │",- "│ │",- "│ model: gpt-5 /model to change │",- "│ directory: …パガパガパガパガパ-project │", // hidden by multi-width symbols: [(15, " "), (17, " "), (19, " "), (21, " "), (23, " "), (25, " "), (27, " "), (29, " "), (31, " ")]- "╰────────────────────────────────────────╯",+ " ",+ " >_ OpenAI Codex (vtest) ",+ " …ガパガパガパガパガパガパガパ-project", // hidden by multi-width symbols: [(7, " "), (9, " "), (11, " "), (13, " "), (15, " "), (17, " "), (19, " "), (21, " "), (23, " "), (25, " "), (27, " "), (29, " "), (31, " "), (33, " ")]],styles: [- x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,x: 5, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,x: 17, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 13, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 18, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 21, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 27, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 13, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 40, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 25, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 5, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 7, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 8, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 9, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 10, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 11, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 12, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 13, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 14, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 15, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 16, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 17, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 18, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 19, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 20, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 21, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 22, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 23, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 24, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 25, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 26, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 27, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 28, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 29, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 30, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 31, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 32, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,+ x: 33, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,+ x: 34, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,]}diff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_sound_marks.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_sound_marks.snapdeleted file mode 100644index a42c314b0b..0000000000--- a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_halfwidth_sound_marks.snap+++ /dev/null@@ -1,38 +0,0 @@-----source: tui/src/history_cell/tests.rs-assertion_line: 1889-expression: "format!(\"{buf:?}\")"-----Buffer {- area: Rect { x: 0, y: 0, width: 80, height: 6 },- content: [- "╭───────────────────────────────────────────╮ ",- "│ >_ OpenAI Codex (vtest) │ ",- "│ │ ",- "│ model: gpt-5-ガ-パ /model to change │ ", // hidden by multi-width symbols: [(20, " "), (23, " ")]- "│ directory: project │ ",- "╰───────────────────────────────────────────╯ ",- ],- styles: [- x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 45, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 0, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 5, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,- x: 17, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 45, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 0, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 45, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 0, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 13, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 24, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 27, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 33, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 45, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 0, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 13, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 20, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 45, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- x: 0, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,- x: 45, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,- ]-}diff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_indicates_yolo_mode.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_indicates_yolo_mode.snapindex 04f64584f6..ab195e3d1a 100644--- a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_indicates_yolo_mode.snap+++ b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_header_indicates_yolo_mode.snap@@ -1,11 +1,9 @@----source: tui/src/history_cell.rs+source: tui/src/history_cell/tests.rs+assertion_line: 1885expression: rendered----╭───────────────────────────────────────╮-│ >_ OpenAI Codex (vtest) │-│ │-│ model: gpt-5 /model to change │-│ directory: /tmp/project │-│ permissions: YOLO mode │-╰───────────────────────────────────────╯++ >_ OpenAI Codex (vtest)+ /tmp/project+ permissions: YOLO modediff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snapindex ad0fc4be1c..e5cc9a0cec 100644--- a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap+++ b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap@@ -1,12 +1,10 @@----source: tui/src/history_cell.rs+source: tui/src/history_cell/tests.rs+assertion_line: 778expression: rendered----╭─────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: gpt-5 /model to change │-│ directory: /tmp/project │-╰─────────────────────────────────────╯++ >_ OpenAI Codex (v0.0.0)+ /tmp/projectTip: Model just became availablediff --git a/codex-rs/tui/src/history_cell/tests.rs b/codex-rs/tui/src/history_cell/tests.rsindex 0be28aec0d..3d841f5eb4 100644--- a/codex-rs/tui/src/history_cell/tests.rs+++ b/codex-rs/tui/src/history_cell/tests.rs@@ -1849,53 +1849,12 @@ fn completed_mcp_tool_call_multiple_outputs_inline_snapshot() {insta::assert_snapshot!(rendered);}-#[test]-fn session_header_includes_reasoning_level_when_present() {- let cell = SessionHeaderHistoryCell::new(- "gpt-4o".to_string(),- Some(ReasoningEffortConfig::High),- /*show_fast_status*/ true,- std::env::temp_dir(),- "test",- );-- let lines = render_lines(&cell.display_lines(/*width*/ 80));- let model_line = lines- .iter()- .find(|line| line.contains("model:"))- .expect("model line");-- assert!(model_line.contains("gpt-4o high fast"));- assert!(model_line.contains("/model to change"));-}--#[test]-fn session_header_hides_fast_status_when_disabled() {- let cell = SessionHeaderHistoryCell::new(- "gpt-4o".to_string(),- Some(ReasoningEffortConfig::High),- /*show_fast_status*/ false,- std::env::temp_dir(),- "test",- );-- let lines = render_lines(&cell.display_lines(/*width*/ 80));- let model_line = lines- .iter()- .find(|line| line.contains("model:"))- .expect("model line");-- assert!(model_line.contains("gpt-4o high"));- assert!(!model_line.contains("fast"));-}-#[test]fn session_header_clamps_to_narrow_width() {const WIDTH: u16 = 44;let cell = SessionHeaderHistoryCell::new("gpt-5.6-sol".to_string(),Some(ReasoningEffortConfig::XHigh),- /*show_fast_status*/ true,PathBuf::from("project"),"test",)@@ -1904,7 +1863,7 @@ fn session_header_clamps_to_narrow_width() {let lines = cell.display_lines(WIDTH);let widths = lines.iter().map(line_width).collect::<Vec<_>>();- assert_eq!(widths, vec![usize::from(WIDTH); lines.len()]);+ assert!(widths.iter().all(|width| *width <= usize::from(WIDTH)));insta::assert_snapshot!(render_lines(&lines).join("\n"));}@@ -1917,7 +1876,6 @@ fn session_header_indicates_yolo_mode() {let cell = SessionHeaderHistoryCell::new("gpt-5".to_string(),/*reasoning_effort*/ None,- /*show_fast_status*/ false,test_path_buf("/tmp/project").abs().to_path_buf(),"test",)@@ -1927,31 +1885,11 @@ fn session_header_indicates_yolo_mode() {insta::assert_snapshot!(rendered);}-#[test]-fn session_header_aligns_halfwidth_sound_marks() {- let cell: Box<dyn HistoryCell> = Box::new(SessionHeaderHistoryCell::new(- "gpt-5-ガ-パ".to_string(),- /*reasoning_effort*/ None,- /*show_fast_status*/ false,- PathBuf::from("project"),- "test",- ));-- let width = 80;- let height = cell.desired_height(width);- let area = Rect::new(0, 0, width, height);- let mut buf = Buffer::empty(area);- cell.render(area, &mut buf);-- insta::assert_snapshot!("session_header_halfwidth_sound_marks", format!("{buf:?}"));-}-#[test]fn session_header_truncates_halfwidth_directory() {let cell: Box<dyn HistoryCell> = Box::new(SessionHeaderHistoryCell::new("gpt-5".to_string(),/*reasoning_effort*/ None,- /*show_fast_status*/ false,PathBuf::from("ガパガパガパガパガパガパガパガパ-project"),"test",));diff --git a/codex-rs/tui/src/pager_overlay/transcript_tests.rs b/codex-rs/tui/src/pager_overlay/transcript_tests.rsindex 97a0a6a700..05aaff0b66 100644--- a/codex-rs/tui/src/pager_overlay/transcript_tests.rs+++ b/codex-rs/tui/src/pager_overlay/transcript_tests.rs@@ -518,7 +518,6 @@ fn transcript_overlay_absorbs_older_tail_into_live_without_duplicate_cells() {let header: Arc<dyn HistoryCell> = Arc::new(history_cell::SessionHeaderHistoryCell::new("test model".to_owned(),/*reasoning_effort*/ None,- /*show_fast_status*/ false,std::path::PathBuf::from("/project"),"test",));diff --git a/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap b/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snapindex 98d6015064..b11e54d20f 100644--- a/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap+++ b/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap@@ -1,10 +1,8 @@----source: tui/src/app.rs+source: tui/src/app/tests.rs+assertion_line: 5874expression: rendered----╭─────────────────────────────────────────────╮-│ >_ OpenAI Codex (v<VERSION>) │-│ │-│ model: gpt-test high /model to change │-│ directory: /tmp/project │-╰─────────────────────────────────────────────╯++ >_ OpenAI Codex (v<VERSION>)+ /tmp/projectdiff --git a/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_header_fast_status_fast_capable_models.snap b/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_header_fast_status_fast_capable_models.snapdeleted file mode 100644index 08afd027ac..0000000000--- a/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_header_fast_status_fast_capable_models.snap+++ /dev/null@@ -1,10 +0,0 @@-----source: tui/src/app.rs-expression: rendered-----╭────────────────────────────────────────────────────╮-│ >_ OpenAI Codex (v<VERSION>) │-│ │-│ model: gpt-5.4 xhigh fast /model to change │-│ directory: /tmp/project │-╰────────────────────────────────────────────────────╯diff --git a/codex-rs/tui/src/snapshots/codex_tui__app__tests__thread_read_model_after_switch.snap b/codex-rs/tui/src/snapshots/codex_tui__app__tests__thread_read_model_after_switch.snapdeleted file mode 100644index 2a2d06db87..0000000000--- a/codex-rs/tui/src/snapshots/codex_tui__app__tests__thread_read_model_after_switch.snap+++ /dev/null@@ -1,5 +0,0 @@-----source: tui/src/app/tests.rs-expression: model_line-----│ model: server-reported-model /model to change │diff --git a/codex-rs/tui/src/snapshots/codex_tui__startup_draft__tests__startup_draft_full_frames.snap b/codex-rs/tui/src/snapshots/codex_tui__startup_draft__tests__startup_draft_full_frames.snapindex 3eb081d7d4..13af775d7e 100644--- a/codex-rs/tui/src/snapshots/codex_tui__startup_draft__tests__startup_draft_full_frames.snap+++ b/codex-rs/tui/src/snapshots/codex_tui__startup_draft__tests__startup_draft_full_frames.snap@@ -1,6 +1,6 @@---source: tui/src/startup_draft_tests.rs-assertion_line: 148+assertion_line: 154expression: "snapshots.join(\"\\n---\\n\")"---empty (48 columns):@@ -19,8 +19,6 @@ resuming (48 columns):>_ OpenAI Codex (v<VERSION>)loading-- Pull up a prompt.Resuming session…› Ask Codex to do anything@@ -31,8 +29,6 @@ forking (48 columns):>_ OpenAI Codex (v<VERSION>)loading-- Pull up a prompt.Forking session…› draft while loadingdiff --git a/codex-rs/tui/src/startup_draft.rs b/codex-rs/tui/src/startup_draft.rsindex dd6cda869c..96ffcecd70 100644--- a/codex-rs/tui/src/startup_draft.rs+++ b/codex-rs/tui/src/startup_draft.rs@@ -11,8 +11,6 @@ use tokio::time::Instant;use crossterm::SynchronizedUpdate;use ratatui::layout::Size;-use ratatui::style::Modifier;-use ratatui::style::Style;use ratatui::style::Stylize;use tokio::sync::mpsc::UnboundedReceiver;use tokio::sync::mpsc::unbounded_channel;@@ -468,17 +466,14 @@ impl StartupDraftPump {}fn startup_session_header(config: Option<&Config>) -> Box<dyn HistoryCell> {- let placeholder_style = Style::default().add_modifier(Modifier::DIM | Modifier::ITALIC);let directory = config.map_or_else(|| PathBuf::from("loading"),|config| config.cwd.to_path_buf(),);Box::new(- history_cell::SessionHeaderHistoryCell::new_with_style(+ history_cell::SessionHeaderHistoryCell::new("loading".to_string(),- placeholder_style,/*reasoning_effort*/ None,- /*show_fast_status*/ false,directory,CODEX_CLI_VERSION,)diff --git a/codex-rs/tui/src/startup_draft_layout.rs b/codex-rs/tui/src/startup_draft_layout.rsindex 8b77ee5f59..da417ce52b 100644--- a/codex-rs/tui/src/startup_draft_layout.rs+++ b/codex-rs/tui/src/startup_draft_layout.rs@@ -17,7 +17,6 @@ use crate::bottom_pane::CommandPopupPlacement;use crate::bottom_pane::ComposerRenderOptions;use crate::render::renderable::Renderable;use crate::render::renderable::RenderableItem;-use crate::terminal_hyperlinks::HyperlinkLine;use crate::terminal_hyperlinks::HyperlinkParagraph;pub(super) struct OwnedStartupLayout<'a> {@@ -41,17 +40,6 @@ impl<'a> OwnedStartupLayout<'a> {}}- fn header_lines(&self, width: u16) -> Vec<HyperlinkLine> {- match self.pump.session_action {- StartupDraftSessionAction::New | StartupDraftSessionAction::NewFromCommandCenter => {- self.pump.header.compact_hyperlink_lines(width)- }- StartupDraftSessionAction::Resume | StartupDraftSessionAction::Fork => {- self.pump.header.display_hyperlink_lines(width)- }- }- }-pub(super) fn bottom_area(&self, area: Rect) -> Rect {let height = self.bottom.desired_height(area.width).min(area.height);Rect {@@ -65,7 +53,7 @@ impl<'a> OwnedStartupLayout<'a> {impl Renderable for OwnedStartupLayout<'_> {fn render(&self, area: Rect, buf: &mut Buffer) {let bottom = self.bottom_area(area);- let lines = self.header_lines(area.width);+ let lines = self.pump.header.display_hyperlink_lines(area.width);let paragraph = HyperlinkParagraph::new(&lines, Style::default());let header = Rect {height: u16::try_from(paragraph.line_count(area.width))@@ -111,7 +99,7 @@ impl Renderable for OwnedStartupLayout<'_> {}fn desired_height(&self, width: u16) -> u16 {- let lines = self.header_lines(width);+ let lines = self.pump.header.display_hyperlink_lines(width);u16::try_from(HyperlinkParagraph::new(&lines, Style::default()).line_count(width)).unwrap_or(u16::MAX).saturating_add(self.bottom.desired_height(width))diff --git a/codex-rs/tui/src/startup_draft_tests.rs b/codex-rs/tui/src/startup_draft_tests.rsindex d89b5d071e..baaa0ebdfe 100644--- a/codex-rs/tui/src/startup_draft_tests.rs+++ b/codex-rs/tui/src/startup_draft_tests.rs@@ -74,7 +74,6 @@ pub(crate) fn startup_test_pump_with_input(text: &str) -> StartupDraftPump {#[test]fn startup_draft_renders_full_empty_and_multiline_composer_frames() {- let mut pump = startup_test_pump(std::iter::empty());let mut snapshots = Vec::new();for (label, width, text, session_action) in [@@ -99,7 +98,15 @@ fn startup_draft_renders_full_empty_and_multiline_composer_frames() {StartupDraftSessionAction::New,),] {+ let mut pump = startup_test_pump(std::iter::empty());pump.session_action = session_action;+ // Resume and fork have no fresh-thread greeting. Exercise the real initial state.+ if matches!(+ session_action,+ StartupDraftSessionAction::Resume | StartupDraftSessionAction::Fork+ ) {+ pump.header = startup_session_header(/*config*/ None);+ }pump.bottom_pane.set_composer_text(text.to_string(), Vec::new(), Vec::new());let renderable =diff --git a/codex-rs/tui/src/status/card.rs b/codex-rs/tui/src/status/card.rsindex 369a6749b2..45dce342f6 100644--- a/codex-rs/tui/src/status/card.rs+++ b/codex-rs/tui/src/status/card.rs@@ -734,12 +734,9 @@ fn status_approval_label(impl StatusHistoryCell {fn content_lines(&self, width: u16) -> Vec<Line<'static>> {let mut lines: Vec<Line<'static>> = Vec::new();- lines.push(Line::from(vec![- Span::from(format!("{}>_ ", FieldFormatter::INDENT)).dim(),- Span::from("OpenAI Codex").bold(),- Span::from(" ").dim(),- Span::from(format!("(v{CODEX_CLI_VERSION})")).dim(),- ]));+ let mut title = vec![FieldFormatter::INDENT.into()];+ title.extend(crate::history_cell::codex_title(CODEX_CLI_VERSION));+ lines.push(Line::from(title));let available_inner_width = usize::from(width.saturating_sub(4));if available_inner_width == 0 {diff --git a/codex-rs/tui/src/transcript_view/search_tests.rs b/codex-rs/tui/src/transcript_view/search_tests.rsindex 70c34fb158..2eaac634e2 100644--- a/codex-rs/tui/src/transcript_view/search_tests.rs+++ b/codex-rs/tui/src/transcript_view/search_tests.rs@@ -500,7 +500,6 @@ fn search_scans_a_page_inserted_after_the_retained_session_header() {Arc::new(crate::history_cell::SessionHeaderHistoryCell::new("test model".to_string(),/*reasoning_effort*/ None,- /*show_fast_status*/ false,std::path::PathBuf::from("/project"),"test",));diff --git a/codex-rs/tui/src/transcript_view_tests.rs b/codex-rs/tui/src/transcript_view_tests.rsindex b1e1940847..9b9a570966 100644--- a/codex-rs/tui/src/transcript_view_tests.rs+++ b/codex-rs/tui/src/transcript_view_tests.rs@@ -69,7 +69,6 @@ fn startup_warning_keeps_first_visible_header_in_place() {Arc::new(crate::history_cell::SessionHeaderHistoryCell::new("gpt-test".into(),/*reasoning_effort*/ None,- /*show_fast_status*/ false,crate::test_support::test_path_buf("/project"),"test",));