From a3275210bd253f1902bf688b25bc84adaf5d144e Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Tue, 22 Sep 2026 15:56:08 +0000 Subject: [PATCH] Match agent status symbols to the selected row style (#47319) ## Why Status symbols in the agents overview retained their status color when selected, making their styling inconsistent with the rest of the selected row. ## What changed Apply the row's selection style to its status symbol while preserving status colors for unselected rows. ## Testing Extend rendering tests to assert and snapshot selected status symbol styles across status variants, and verify that an unselected idle symbol retains its cyan color. GitOrigin-RevId: a5163841bed80d6d43e7c62a7596c6e48b9dc886 --- codex-rs/tui/src/app/agent_center/rows.rs | 5 ++- codex-rs/tui/src/app/agent_center_tests.rs | 33 ++++++++++++++++++- codex-rs/tui/src/app/agents_overview_tests.rs | 5 +++ ...r__live_center_selected_status_styles.snap | 11 +++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 codex-rs/tui/src/app/snapshots/codex_tui__app__agents_overview__tests__command_center__live_center_selected_status_styles.snap diff --git a/codex-rs/tui/src/app/agent_center/rows.rs b/codex-rs/tui/src/app/agent_center/rows.rs index f9860ca0cc..8178ab1c89 100644 --- a/codex-rs/tui/src/app/agent_center/rows.rs +++ b/codex-rs/tui/src/app/agent_center/rows.rs @@ -153,7 +153,10 @@ impl AgentsOverviewView { }, style, ); - let (status, dot) = Self::status(task); + let (status, mut dot) = Self::status(task); + if index == self.selected { + dot.style = style; + } line( Line::from(if index == self.selected { "›" } else { " " }).style(style), rect, diff --git a/codex-rs/tui/src/app/agent_center_tests.rs b/codex-rs/tui/src/app/agent_center_tests.rs index b371380609..2408927964 100644 --- a/codex-rs/tui/src/app/agent_center_tests.rs +++ b/codex-rs/tui/src/app/agent_center_tests.rs @@ -66,8 +66,39 @@ async fn live_center_columns() { thread }) .collect::>(); - let view = app.agents_overview_view(threads, Some(current)); + let mut view = app.agents_overview_view(threads, Some(current)); insta::assert_snapshot!(screen(&view, /*width*/ 160, /*height*/ 22)); + let mut selected_status_styles = Vec::new(); + for _ in 0..fixtures.len() { + let area = Rect::new( + /*x*/ 0, /*y*/ 0, /*width*/ 160, /*height*/ 22, + ); + let mut buf = ratatui::buffer::Buffer::empty(area); + view.render(area, &mut buf); + let selected_row = buf + .content + .chunks(usize::from(area.width)) + .find(|row| row.iter().any(|cell| cell.symbol() == "›")) + .unwrap(); + let marker = selected_row + .iter() + .position(|cell| cell.symbol() == "›") + .unwrap(); + assert_eq!( + selected_row[marker + 2].style(), + selected_row[marker].style() + ); + selected_status_styles.push(format!( + "{} | {:?}", + selected_row[marker + 2].symbol(), + selected_row[marker + 2].style() + )); + view.handle_key_event(KeyCode::Down.into()); + } + insta::assert_snapshot!( + "live_center_selected_status_styles", + selected_status_styles.join("\n") + ); } #[tokio::test] diff --git a/codex-rs/tui/src/app/agents_overview_tests.rs b/codex-rs/tui/src/app/agents_overview_tests.rs index 5c7e553757..182d7ac643 100644 --- a/codex-rs/tui/src/app/agents_overview_tests.rs +++ b/codex-rs/tui/src/app/agents_overview_tests.rs @@ -61,6 +61,10 @@ async fn overview_thread_colors_match_footer_and_respect_color_suppression() { let text: String = row.iter().map(ratatui::buffer::Cell::symbol).collect(); if let Some(x) = text.find("Named task") { let x = text[..x].chars().count(); + let dot = row.iter().find(|cell| cell.symbol() == "○").unwrap(); + let mut expected = ratatui::buffer::Cell::default(); + expected.set_symbol("○").set_style(Style::default().cyan()); + assert_eq!(dot, &expected); snapshot.push(format!( "{} | title style: {:?}", normalize_agent_center_snapshot(&text), @@ -147,6 +151,7 @@ use pretty_assertions::assert_eq; use ratatui::Terminal; use ratatui::backend::TestBackend; use ratatui::layout::Rect; +use ratatui::style::Style; static OVERVIEW_TIMESTAMP: std::sync::LazyLock = std::sync::LazyLock::new(|| chrono::Utc::now().timestamp() - 120); diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__agents_overview__tests__command_center__live_center_selected_status_styles.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__agents_overview__tests__command_center__live_center_selected_status_styles.snap new file mode 100644 index 0000000000..7d804f48b7 --- /dev/null +++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__agents_overview__tests__command_center__live_center_selected_status_styles.snap @@ -0,0 +1,11 @@ +--- +source: tui/src/app/agent_center_tests.rs +assertion_line: 98 +expression: "selected_status_styles.join(\"\\n\")" +--- +○ | Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold().reversed() +○ | Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold().reversed() +! | Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold().reversed() +● | Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold().reversed() +● | Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold().reversed() +○ | Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold().reversed()