Lightweight coding agent that runs in your terminal
Rust
Limit the welcome logo animation to onboarding (#46859)
Eric Trautad538e1c2dc5
diff --git a/codex-rs/tui/src/app/empty_state_animation_tests.rs b/codex-rs/tui/src/app/empty_state_animation_tests.rsindex c304767a27..a7b53d490f 100644--- a/codex-rs/tui/src/app/empty_state_animation_tests.rs+++ b/codex-rs/tui/src/app/empty_state_animation_tests.rs@@ -5,12 +5,18 @@ use super::*;use pretty_assertions::assert_eq;use ratatui::buffer::Buffer;-fn has_logo(buffer: &Buffer) -> bool {- buffer.content.iter().any(|cell| {- cell.symbol()- .chars()- .any(|c| ('\u{2801}'..='\u{28ff}').contains(&c))- })+fn animation_is_eligible(app: &App) -> bool {+ app.empty_state_presentation(+ crate::motion::MotionMode::from_animations_enabled(+ app.local_settings.tui.animations && app.local_settings.tui.effects.welcome,+ ),+ /*focused*/ true,+ ) == crate::empty_state_animation::Presentation::Animated+ && app+ .chat_widget+ .empty_state_animation+ .borrow()+ .is_eligible_for_test()}fn text(buffer: &Buffer) -> String {@@ -40,8 +46,6 @@ fn draw(app: &mut App, tui: &mut tui::Tui, size: Size) -> Result<Rect> {async fn fresh_logo_returns_only_to_the_ordinary_composer() -> Result<()> {let mut app = crate::app::test_support::make_test_app().await;app.local_settings.tui.animations = true;- app.chat_widget- .apply_external_edit("preserved draft".into());let size = Size::new(/*width*/ 120, /*height*/ 44);let mut tui = crate::tui::test_support::make_test_tui()?;tui.set_owned_screen(/*owned*/ true)?;@@ -52,56 +56,37 @@ async fn fresh_logo_returns_only_to_the_ordinary_composer() -> Result<()> {.start_fresh();draw(&mut app, &mut tui, size)?;let cursor = tui.terminal.last_known_cursor_pos;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));app.open_transcript_overlay(&mut tui);draw(&mut app, &mut tui, size)?;- let detailed = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal);- assert!(!has_logo(detailed));+ assert!(!animation_is_eligible(&app));assert_eq!(tui.terminal.last_known_cursor_pos, cursor);app.close_transcript_overlay(&mut tui);draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));app.transcript_view.begin_search();draw(&mut app, &mut tui, size)?;- assert!(!has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(!animation_is_eligible(&app));app.transcript_view.handle_key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE),&app.transcript_cells,);draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));for enabled in [true, false] {app.apply_raw_output_mode(&mut tui, enabled, /*notify*/ false);draw(&mut app, &mut tui, size)?;- assert_eq!(- has_logo(crate::custom_terminal::test_support::last_rendered_buffer(- &tui.terminal- )),- !enabled- );+ assert_eq!(animation_is_eligible(&app), !enabled);}app.chat_widget.apply_external_edit(String::new());for (key, visible) in [(KeyCode::Char('?'), false), (KeyCode::Right, true)] {app.chat_widget.handle_key_event(KeyEvent::new(key, KeyModifiers::NONE));draw(&mut app, &mut tui, size)?;- assert_eq!(- has_logo(crate::custom_terminal::test_support::last_rendered_buffer(- &tui.terminal- )),- visible- );+ assert_eq!(animation_is_eligible(&app), visible);}tui.set_owned_screen(/*owned*/ false)?;Ok(())@@ -157,9 +142,7 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {)),);draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));crate::chatwidget::tests::set_chatgpt_auth(&mut app.chat_widget);let request = app.chat_widget.start_rate_limit_reset_startup_check();@@ -174,14 +157,10 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {// The same startup notice stays eligible both pending and committed to history.assert!(app.chat_widget.empty_state_composer().is_some());draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));app.insert_pending_usage_output_if_ready(&mut tui);draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));// Even invisible non-startup content ends eligibility before a frame or clear can erase it.app.insert_history_cell(@@ -191,27 +170,21 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {app.reset_transcript_state_after_clear();app.queue_clear_ui_header(&mut tui);draw(&mut app, &mut tui, size)?;- assert!(!has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(!animation_is_eligible(&app));app.chat_widget.empty_state_animation.borrow_mut().start_fresh();draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));tui.set_owned_screen(/*owned*/ false)?;Ok(())}#[tokio::test]-async fn empty_state_animation_preserves_header_draft_cursor_and_footer() -> Result<()> {+async fn empty_state_animation_preserves_header_cursor_and_footer() -> Result<()> {let mut app = crate::app::test_support::make_test_app().await;app.local_settings.tui.animations = true;- app.chat_widget- .apply_external_edit("draft stays here".to_string());let size = Size::new(/*width*/ 120, /*height*/ 44);let mut tui = crate::tui::test_support::make_test_tui()?;tui.set_owned_screen(/*owned*/ true)?;@@ -226,12 +199,14 @@ async fn empty_state_animation_preserves_header_draft_cursor_and_footer() -> Reslet history_len = app.transcript_cells.len();let before = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal).clone();let cursor = tui.terminal.last_known_cursor_pos;- assert!(!has_logo(&before));- *app.chat_widget.empty_state_animation.borrow_mut() =- crate::empty_state_animation::tests::fixture().0;+ assert!(!animation_is_eligible(&app));+ app.chat_widget+ .empty_state_animation+ .borrow_mut()+ .start_fresh();assert_eq!(draw(&mut app, &mut tui, size)?, before_bottom);let after = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal);- assert!(has_logo(after));+ assert!(animation_is_eligible(&app));assert_eq!(tui.terminal.last_known_cursor_pos, cursor);for (a, b) in before.content.iter().zip(&after.content) {if a.symbol() != " " {@@ -242,19 +217,14 @@ async fn empty_state_animation_preserves_header_draft_cursor_and_footer() -> Res&after.content[after.index_of(/*x*/ 0, before_bottom.y)..],&before.content[before.index_of(/*x*/ 0, before_bottom.y)..]);- insta::assert_snapshot!("fresh_thread_with_draft", text(after));+ insta::assert_snapshot!("fresh_thread_header", text(after));app.chat_widget.apply_external_edit("/m".to_string());draw(&mut app, &mut tui, size)?;- assert!(!has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));- app.chat_widget- .apply_external_edit("draft stays here".to_string());+ assert!(!animation_is_eligible(&app));+ app.chat_widget.apply_external_edit(String::new());draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));assert_eq!(app.transcript_cells.len(), history_len);app.local_settings.tui.animations = false;draw(&mut app, &mut tui, size)?;@@ -270,9 +240,7 @@ async fn empty_state_animation_preserves_header_draft_cursor_and_footer() -> Resapp.local_settings.tui.effects.welcome = true;app.local_settings.tui.effects.shimmer = false;draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));tui.set_owned_screen(/*owned*/ false)?;Ok(())}@@ -290,26 +258,20 @@ async fn submitting_a_draft_dismisses_logo_even_after_clear() -> Result<()> {.borrow_mut().start_fresh();draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));app.chat_widget.apply_external_edit("first prompt".to_string());draw(&mut app, &mut tui, size)?;let drafting = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal);- assert!(has_logo(drafting));+ assert!(!animation_is_eligible(&app));assert!(text(drafting).contains("first prompt"));app.chat_widget.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));draw(&mut app, &mut tui, size)?;- assert!(!has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(!animation_is_eligible(&app));app.reset_transcript_state_after_clear();draw(&mut app, &mut tui, size)?;- assert!(!has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(!animation_is_eligible(&app));tui.set_owned_screen(/*owned*/ false)?;Ok(())}@@ -349,12 +311,7 @@ async fn empty_state_animation_survives_plain_transcript_clicks() -> Result<()>&app.transcript_cells,);draw(&mut app, &mut tui, size)?;- assert_eq!(- has_logo(crate::custom_terminal::test_support::last_rendered_buffer(- &tui.terminal- )),- visible- );+ assert_eq!(animation_is_eligible(&app), visible);if visible {assert_eq!(tui.terminal.last_known_cursor_pos, cursor);}@@ -366,9 +323,7 @@ async fn empty_state_animation_survives_plain_transcript_clicks() -> Result<()>);app.transcript_view.end_selection(&app.transcript_cells);draw(&mut app, &mut tui, size)?;- assert!(has_logo(- crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal)- ));+ assert!(animation_is_eligible(&app));tui.set_owned_screen(/*owned*/ false)?;Ok(())}diff --git a/codex-rs/tui/src/app/owned_transcript.rs b/codex-rs/tui/src/app/owned_transcript.rsindex 6f688197be..bb22b2f1d0 100644--- a/codex-rs/tui/src/app/owned_transcript.rs+++ b/codex-rs/tui/src/app/owned_transcript.rs@@ -1,7 +1,6 @@//! Compose the owned transcript above the composer and route their selection gestures.//! Reserve a cleared row between transcript content and the composer. Slash suggestions overlay//! already-painted rows so opening or closing them leaves transcript geometry unchanged.-//! Fresh-thread decoration is painted separately in unused cells and never enters history.//! Plain Enter returns an empty composer to latest after transcript interactions and prompt editing.use super::*;@@ -71,7 +70,7 @@ impl App {self.local_settings.tui.animations && self.local_settings.tui.effects.shimmer,);let focused = tui.is_terminal_focused();- let logo = self.empty_state_presentation(+ self.empty_state_presentation(MotionMode::from_animations_enabled(self.local_settings.tui.animations && self.local_settings.tui.effects.welcome,),@@ -130,7 +129,6 @@ impl App {);let mut rendered_cursor = None;let mut footer_height_changed = false;- let mut decoration_tick = None;let mut feedback_tick = None;tui.draw(screen_size.height, |frame| {ratatui::widgets::Clear.render(@@ -147,12 +145,6 @@ impl App {frame.buffer,&self.transcript_cells,);- decoration_tick = chat_widget.empty_state_animation.borrow_mut().render(- screen_size,- bottom_area,- frame.buffer,- logo,- );let follow_area =(available > 0 && chat_widget.no_modal_or_popup_active()).then(|| {Rect::new(@@ -206,9 +198,6 @@ impl App {if let Some(delay) = feedback_tick {tui.frame_requester().schedule_frame_in(delay);}- if let Some(delay) = decoration_tick {- tui.frame_requester().schedule_frame_in(delay);- }let animating =view.is_following() && active_key.is_some_and(|key| key.animation_tick.is_some());let loading = view.is_loading_history() && motion == MotionMode::Animated;diff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snapnew file mode 100644index 0000000000..28f70200c0--- /dev/null+++ b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_header.snap@@ -0,0 +1,48 @@+---+source: tui/src/app/empty_state_animation_tests.rs+expression: text(after)+---+╭───────────────────────────────────────────╮+│ >_ OpenAI Codex (v0.0.0) │+│ │+│ model: GPT-5.6-Sol /model to change │+│ directory: /tmp/project │+╰───────────────────────────────────────────╯+++++++++++++++++++++++++++++++++ Tip: @ mentions files, skills, and plugins++› Ask Codex to do anything++ GPT-5.6-Sol default · /tmp/project+ ? for shortcuts ⚠ 1 warning · f2 to viewdiff --git a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_with_draft.snap b/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_with_draft.snapdeleted file mode 100644index a23405ba1e..0000000000--- a/codex-rs/tui/src/app/snapshots/codex_tui__app__owned_transcript__empty_state_animation_tests__fresh_thread_with_draft.snap+++ /dev/null@@ -1,49 +0,0 @@-----source: tui/src/app/empty_state_animation_tests.rs-assertion_line: 278-expression: text(after)-----╭───────────────────────────────────────────╮-│ >_ OpenAI Codex (v0.0.0) │-│ │-│ model: GPT-5.6-Sol /model to change │-│ directory: /tmp/project │ ⢀⣀⣠⣤⣤⣤⣤⣤⣤⣀⣀-╰───────────────────────────────────────────╯ ⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀- ⢀⣠⣾⣿⣿⣿⣿⡿⠟⠛⠋⠉⠉⠙⠛⠛⠿⣿⣿⣿⣿⣿⣷⡄- ⣠⣾⣿⣿⣿⠿⠋ ⠉⠛⣿⣿⣿⣿⣷⡀- ⣰⣿⣿⣿⡟⠁ ⠹⣿⣿⣿⣿⡄- ⣼⣿⣿⣿⠟ ⣀⣤⡀ ⠈⢿⣿⣿⣷⡀- ⢠⣿⣿⣿⡟ ⣿⣿⣿⣄ ⠘⣿⣿⣿⣧- ⢸⣿⣿⣿⠁ ⠙⣿⣿⣿⣆ ⢿⣿⣿⣿- ⢾⣿⣿⣿ ⢸⣿⣿⣿⠆ ⢸⣿⣿⣿⠆- ⣾⣿⣿⣿ ⣠⣿⣿⣿⠏ ⢀⣀⣀⣀⣀⣀⣀⡀ ⢸⣿⣿⣿- ⠸⣿⣿⣿⡆ ⢰⣿⣿⣿⠇ ⣿⣿⣿⣿⣿⣿⣿⣿⡆ ⢀⣿⣿⣿⡟- ⢻⣿⣿⣿⣄ ⠉⠛⠁ ⠙⠛⠛⠛⠛⠛⠛⠋ ⢀⣼⣿⣿⣿⠃- ⠈⢻⣿⣿⣿⣦⡀ ⣠⣾⣿⣿⣿⠇- ⠻⣿⣿⣿⣿⣤⣀ ⢀⣠⣾⣿⣿⣿⡿⠃- ⠈⠻⣿⣿⣿⣿⣷⣶⣤⣄⣀⣀⣀⢀⣀⣠⣤⣴⣿⣿⣿⣿⣿⠛- ⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋- ⠉⠙⠛⠿⠿⠿⠿⠿⠿⠿⠛⠋⠁--------------------› draft stays here-- GPT-5.6-Sol default · /tmp/project- ⚠ 1 warning · f2 to viewdiff --git a/codex-rs/tui/src/chatwidget/tests/mcp_startup.rs b/codex-rs/tui/src/chatwidget/tests/mcp_startup.rsindex 5ce38e2eb9..58bc2153d1 100644--- a/codex-rs/tui/src/chatwidget/tests/mcp_startup.rs+++ b/codex-rs/tui/src/chatwidget/tests/mcp_startup.rs@@ -370,7 +370,6 @@ async fn pending_mcp_startup_dispatches_queued_slash_commands() {area,&mut buffer,crate::empty_state_animation::Presentation::Animated,- crate::empty_state_animation::AnimationEnd::Hide,).is_some());diff --git a/codex-rs/tui/src/empty_state_animation.rs b/codex-rs/tui/src/empty_state_animation.rsindex 5e4d298da0..192bd230dc 100644--- a/codex-rs/tui/src/empty_state_animation.rs+++ b/codex-rs/tui/src/empty_state_animation.rs@@ -1,15 +1,5 @@-//! Decoration for a fresh owned-screen conversation, independent of transcript/history data.-//!-//! Eligibility is opt-in at genuine thread creation and ends on first submission/activity.-//! The UI supplies an explicit presentation; unused screen space only controls placement.-//! Rendering never changes layout or cursor state; reduced motion hides the decoration entirely.-//! The stage is anchored near the top-right corner, with room around the terminal edges.-//! A nonempty composer or unfocused terminal fades and holds the current Codex pose.-//! The intact logo spins immediately; focus loss and drafting fade it into rest.-//! Motion is limited to three rotations, followed by a fade to nothing. Focus and drafting-//! pause that budget; completed animations never restart until a genuinely fresh thread.-//! Owners pause visible time when a handoff skips rendering; returning never catches up offscreen.-//! Onboarding can reserve a header stage and retain the faded mark after the same sequence.+//! The blossom welcome animation for onboarding, with a full-color final pose.+//! Visible time pauses while hidden; conversation lifecycle tracking is retained for the header.mod geometry;mod lighting;@@ -24,7 +14,6 @@ use std::time::Instant;use ratatui::buffer::Buffer;use ratatui::layout::Rect;-use ratatui::layout::Size;use ratatui::style::Color;use crate::terminal_palette;@@ -43,12 +32,6 @@ pub(crate) enum ComposerState {Draft,}-#[derive(Clone, Copy)]-pub(crate) enum AnimationEnd {- Hide,- Faded,-}-#[derive(Default)]pub(crate) struct EmptyStateAnimation {eligible: bool,@@ -59,7 +42,6 @@ pub(crate) struct EmptyStateAnimation {opacity: f32,fade_from: f32,renderer: Option<Renderer>,- cell_aspect: Option<(Size, f64)>,}impl EmptyStateAnimation {@@ -82,45 +64,6 @@ impl EmptyStateAnimation {self.last_frame = None;}- /// Paint only in unused cells. Returns a redraw deadline only for visible motion.- pub(crate) fn render(- &mut self,- screen: Size,- bottom: Rect,- buffer: &mut Buffer,- presentation: Presentation,- ) -> Option<Duration> {- if !self.eligible {- return None;- }- if presentation == Presentation::Hidden {- self.pause_clock();- return None;- }- let aspect = match self.cell_aspect {- Some((size, aspect)) if size == screen => aspect,- _ => {- let aspect = crossterm::terminal::window_size()- .ok()- .filter(|size| {- size.width > 0 && size.height > 0 && size.columns > 0 && size.rows > 0- })- .map_or(/*default*/ 0.5, |size| {- (f64::from(size.width) * f64::from(size.rows)- / (f64::from(size.height) * f64::from(size.columns)))- .clamp(/*min*/ 0.25, /*max*/ 1.0)- });- self.cell_aspect = Some((screen, aspect));- aspect- }- };- let Some(area) = stage(screen, bottom, buffer, aspect) else {- self.pause_clock();- return None;- };- self.render_in(area, buffer, presentation, AnimationEnd::Hide)- }-/// Paint the shared logo sequence inside a caller-owned, reserved rectangle./// The caller clears the stage and keeps its layout stable after motion finishes.pub(crate) fn render_in(@@ -128,10 +71,9 @@ impl EmptyStateAnimation {area: Rect,buffer: &mut Buffer,presentation: Presentation,- end: AnimationEnd,) -> Option<Duration> {let now = Instant::now();- self.render_in_at(area, buffer, presentation, end, now)+ self.render_in_at(area, buffer, presentation, now)}fn render_in_at(@@ -139,7 +81,6 @@ impl EmptyStateAnimation {area: Rect,buffer: &mut Buffer,presentation: Presentation,- end: AnimationEnd,now: Instant,) -> Option<Duration> {if !self.eligible@@ -165,38 +106,16 @@ impl EmptyStateAnimation {let elapsed = now.saturating_duration_since(previous);self.fade_elapsed += elapsed;if !static_mark {- self.spin_elapsed += if self.spin_elapsed >= sequence::SPIN_DURATION {- self.fade_elapsed- .saturating_sub(sequence::STATIC_FADE)- .min(elapsed)- } else {- elapsed- };+ self.spin_elapsed += elapsed;}}self.static_mark = Some(static_mark);- let completing = !static_mark && self.spin_elapsed >= sequence::SPIN_DURATION;- let finished = self.spin_elapsed >= sequence::SPIN_DURATION + sequence::COMPLETION_FADE;- if finished && matches!(end, AnimationEnd::Hide) {- self.dismiss();- return None;- }- let phase = if finished {- 0.0- } else {- self.spin_elapsed.min(sequence::SPIN_DURATION).as_secs_f64() / sequence::LOOP_SECONDS- };+ let finished = self.spin_elapsed >= sequence::SPIN_DURATION;+ let phase =+ self.spin_elapsed.min(sequence::SPIN_DURATION).as_secs_f64() / sequence::LOOP_SECONDS;let settling = !finished && static_mark && self.fade_elapsed < sequence::STATIC_FADE;self.opacity = if finished {- sequence::STATIC_OPACITY- } else if completing {- let opacity = sequence::completion_opacity(self.spin_elapsed - sequence::SPIN_DURATION);- match end {- AnimationEnd::Hide => opacity,- AnimationEnd::Faded => {- sequence::STATIC_OPACITY + (1.0 - sequence::STATIC_OPACITY) * opacity- }- }+ 1.0} else if static_mark {sequence::static_opacity(self.fade_elapsed, self.fade_from)} else {@@ -258,34 +177,10 @@ impl EmptyStateAnimation {target.set_style(target.style().dim());}}- (!finished && (!static_mark || settling || completing)).then_some(FRAME_INTERVAL)+ (!finished && (!static_mark || settling)).then_some(FRAME_INTERVAL)}}-fn stage(screen: Size, bottom: Rect, buffer: &Buffer, aspect: f64) -> Option<Rect> {- const RIGHT_MARGIN: u16 = 4;- const TOP_MARGIN: u16 = 2;- (32..=MAX_COLUMNS.min(screen.width.saturating_sub(RIGHT_MARGIN * 2)))- .rev()- .find_map(|width| {- let height = (f64::from(width) * 550.0 / 800.0 * aspect).round() as u16;- if height == 0 || height > MAX_ROWS || height > screen.height {- return None;- }- let area = Rect::new(- screen.width - width - RIGHT_MARGIN,- TOP_MARGIN,- width,- height,- );- (area.bottom() < bottom.y- && area.intersection(buffer.area) == area- && (area.y..area.bottom())- .all(|y| (area.x..area.right()).all(|x| buffer[(x, y)].symbol() == " ")))- .then_some(area)- })-}-#[cfg(test)]#[path = "empty_state_animation_tests.rs"]-pub(crate) mod tests;+mod tests;diff --git a/codex-rs/tui/src/empty_state_animation/sequence.rs b/codex-rs/tui/src/empty_state_animation/sequence.rsindex d972937f87..095556886a 100644--- a/codex-rs/tui/src/empty_state_animation/sequence.rs+++ b/codex-rs/tui/src/empty_state_animation/sequence.rs@@ -1,4 +1,4 @@-//! Timing and easing for smooth rotation and fades to a static mark or empty space.+//! Timing and easing for smooth rotation and focus fades.use std::time::Duration;@@ -7,16 +7,11 @@ pub(super) const STATIC_OPACITY: f32 = 0.18;// The renderer performs two complete rotations per loop.pub(super) const LOOP_SECONDS: f64 = 7.2;pub(super) const SPIN_DURATION: Duration = Duration::from_millis(/*millis*/ 10_800);-pub(super) const COMPLETION_FADE: Duration = Duration::from_millis(/*millis*/ 600);pub(super) fn static_opacity(elapsed: Duration, from: f32) -> f32 {STATIC_OPACITY + (from - STATIC_OPACITY) * (1.0 - progress(elapsed, STATIC_FADE)) as f32}-pub(super) fn completion_opacity(elapsed: Duration) -> f32 {- (1.0 - progress(elapsed, COMPLETION_FADE)) as f32-}-pub(super) fn progress(elapsed: Duration, duration: Duration) -> f64 {let t = (elapsed.as_secs_f64() / duration.as_secs_f64()).min(/*other*/ 1.0);t * t * t * (t * (t * 6.0 - 15.0) + 10.0)diff --git a/codex-rs/tui/src/empty_state_animation_tests.rs b/codex-rs/tui/src/empty_state_animation_tests.rsindex 766075aafa..cfa12959ba 100644--- a/codex-rs/tui/src/empty_state_animation_tests.rs+++ b/codex-rs/tui/src/empty_state_animation_tests.rs@@ -3,6 +3,13 @@use super::*;use pretty_assertions::assert_eq;+impl EmptyStateAnimation {+ // App integration tests inspect lifecycle eligibility without advancing the render clock.+ pub(crate) fn is_eligible_for_test(&self) -> bool {+ self.eligible+ }+}+#[test]fn loop_closes_and_light_themes_preserve_coverage() {let mut renderer = Renderer::default();@@ -41,32 +48,6 @@ fn loop_closes_and_light_themes_preserve_coverage() {}}-pub(crate) fn fixture() -> (EmptyStateAnimation, Size, Rect, Buffer) {- let size = Size::new(/*width*/ 120, /*height*/ 44);- let mut animation = EmptyStateAnimation::default();- animation.start_fresh();- animation.cell_aspect = Some((size, 0.5));- let area = Rect::new(/*x*/ 0, /*y*/ 0, size.width, size.height);- let bottom = Rect::new(/*x*/ 0, /*y*/ 39, size.width, /*height*/ 5);- (animation, size, bottom, Buffer::empty(area))-}--#[test]-fn upper_right_stage_shrinks_and_hides_without_touching_occupied_cells() {- let (_, size, bottom, mut buffer) = fixture();- assert_eq!(- stage(size, bottom, &buffer, /*aspect*/ 0.5),- Some(Rect::new(- /*x*/ 56, /*y*/ 2, /*width*/ 60, /*height*/ 21- ))- );- buffer[(56, 2)].set_symbol("header");- let smaller = stage(size, bottom, &buffer, /*aspect*/ 0.5).unwrap();- assert!(smaller.width < 60);- buffer[(115, 2)].set_symbol("notice");- assert_eq!(stage(size, bottom, &buffer, /*aspect*/ 0.5), None);-}-#[test]fn faded_presentation_settles_without_redraws_then_resumes() {let area = Rect::new(@@ -75,19 +56,13 @@ fn faded_presentation_settles_without_redraws_then_resumes() {let start = Instant::now();for elapsed in [Duration::from_secs(/*secs*/ 2),- sequence::SPIN_DURATION + sequence::COMPLETION_FADE - FRAME_INTERVAL,+ sequence::SPIN_DURATION - FRAME_INTERVAL * 2,] {let mut animation = EmptyStateAnimation::default();animation.start_fresh();animation.spin_elapsed = elapsed;let mut buffer = Buffer::empty(area);- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Hide,- start,- );+ animation.render_in_at(area, &mut buffer, Presentation::Animated, start);let moving = buffer.clone();buffer.reset();assert_eq!(@@ -95,7 +70,6 @@ fn faded_presentation_settles_without_redraws_then_resumes() {area,&mut buffer,Presentation::Faded,- AnimationEnd::Hide,start + FRAME_INTERVAL,),Some(FRAME_INTERVAL)@@ -104,13 +78,7 @@ fn faded_presentation_settles_without_redraws_then_resumes() {let settled_at = start + FRAME_INTERVAL + sequence::STATIC_FADE;buffer.reset();assert_eq!(- animation.render_in_at(- area,- &mut buffer,- Presentation::Faded,- AnimationEnd::Hide,- settled_at,- ),+ animation.render_in_at(area, &mut buffer, Presentation::Faded, settled_at,),None);assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));@@ -131,7 +99,6 @@ fn faded_presentation_settles_without_redraws_then_resumes() {area,&mut buffer,Presentation::Faded,- AnimationEnd::Hide,settled_at + Duration::from_secs(/*secs*/ 60),),None@@ -143,7 +110,6 @@ fn faded_presentation_settles_without_redraws_then_resumes() {area,&mut buffer,Presentation::Animated,- AnimationEnd::Hide,settled_at + Duration::from_secs(/*secs*/ 61),),Some(FRAME_INTERVAL)@@ -156,7 +122,6 @@ fn faded_presentation_settles_without_redraws_then_resumes() {area,&mut buffer,Presentation::Animated,- AnimationEnd::Hide,settled_at + Duration::from_secs(/*secs*/ 61) + FRAME_INTERVAL,),Some(FRAME_INTERVAL)@@ -165,54 +130,6 @@ fn faded_presentation_settles_without_redraws_then_resumes() {}}-#[test]-fn three_rotations_stop_then_fade_without_restarting() {- let (mut animation, size, bottom, mut buffer) = fixture();- animation.spin_elapsed = sequence::SPIN_DURATION;- assert_eq!(- animation.render(size, bottom, &mut buffer, Presentation::Animated,),- Some(FRAME_INTERVAL)- );- assert_eq!(animation.opacity, 1.0);- let stopped = buffer.clone();- animation.last_frame = None;- animation.spin_elapsed += sequence::COMPLETION_FADE / 2;- buffer.reset();- assert_eq!(- animation.render(size, bottom, &mut buffer, Presentation::Animated,),- Some(FRAME_INTERVAL)- );- assert_eq!(animation.opacity, 0.5);- // Fading changes color only: rotation has stopped on the third completed turn.- assert_eq!(- buffer- .content- .iter()- .map(ratatui::buffer::Cell::symbol)- .collect::<Vec<_>>(),- stopped- .content- .iter()- .map(ratatui::buffer::Cell::symbol)- .collect::<Vec<_>>()- );- animation.spin_elapsed = sequence::SPIN_DURATION + sequence::COMPLETION_FADE;- for presentation in [Presentation::Animated, Presentation::Faded] {- buffer.reset();- assert_eq!(- animation.render(size, bottom, &mut buffer, presentation,),- None- );- assert_eq!(buffer, Buffer::empty(buffer.area));- }- animation.start_fresh();- assert_eq!(- animation.render(size, bottom, &mut buffer, Presentation::Animated,),- Some(FRAME_INTERVAL)- );- assert_eq!(animation.spin_elapsed, Duration::ZERO);-}-#[test]fn skipped_frames_preserve_spin_until_visible_time_resumes() {let area = Rect::new(@@ -224,34 +141,16 @@ fn skipped_frames_preserve_spin_until_visible_time_resumes() {let mut animation = EmptyStateAnimation::default();animation.start_fresh();let mut buffer = Buffer::empty(area);- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Hide,- start,- );+ animation.render_in_at(area, &mut buffer, Presentation::Animated, start);let visible = Duration::from_millis(/*millis*/ 150);buffer.reset();- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Hide,- start + visible,- );+ animation.render_in_at(area, &mut buffer, Presentation::Animated, start + visible);let before = buffer.clone();animation.pause_clock();let resumed = start + Duration::from_secs(/*secs*/ 3600);buffer.reset();assert_eq!(- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Hide,- resumed- ),+ animation.render_in_at(area, &mut buffer, Presentation::Animated, resumed),Some(FRAME_INTERVAL));assert_eq!(buffer, before);@@ -261,14 +160,13 @@ fn skipped_frames_preserve_spin_until_visible_time_resumes() {area,&mut buffer,Presentation::Animated,- AnimationEnd::Hide,resumed + FRAME_INTERVAL,);assert_eq!(animation.spin_elapsed, visible + FRAME_INTERVAL);}#[test]-fn hidden_and_clipped_frames_preserve_completion_fade_without_restarting() {+fn hidden_and_clipped_frames_preserve_spin_budget_without_restarting() {let area = Rect::new(/*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,);@@ -276,15 +174,9 @@ fn hidden_and_clipped_frames_preserve_completion_fade_without_restarting() {for hidden_area in [area, Rect::default()] {let mut animation = EmptyStateAnimation::default();animation.start_fresh();- animation.spin_elapsed = sequence::SPIN_DURATION + sequence::COMPLETION_FADE / 2;+ animation.spin_elapsed = sequence::SPIN_DURATION - FRAME_INTERVAL;let mut buffer = Buffer::empty(area);- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Hide,- start,- );+ animation.render_in_at(area, &mut buffer, Presentation::Animated, start);let before = buffer.clone();buffer.reset();let hidden = if hidden_area.is_empty() {@@ -297,20 +189,13 @@ fn hidden_and_clipped_frames_preserve_completion_fade_without_restarting() {hidden_area,&mut buffer,hidden,- AnimationEnd::Hide,start + Duration::from_secs(/*secs*/ 20)),None);assert_eq!(buffer, Buffer::empty(area));let resumed = start + Duration::from_secs(/*secs*/ 40);- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Hide,- resumed,- );+ animation.render_in_at(area, &mut buffer, Presentation::Animated, resumed);assert_eq!(buffer, before);buffer.reset();assert_eq!(@@ -318,50 +203,71 @@ fn hidden_and_clipped_frames_preserve_completion_fade_without_restarting() {area,&mut buffer,Presentation::Animated,- AnimationEnd::Hide,- resumed + sequence::COMPLETION_FADE / 2+ resumed + FRAME_INTERVAL),None);- assert_eq!(buffer, Buffer::empty(area));+ assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));+ assert_eq!(animation.opacity, 1.0);animation.pause_clock();- assert!(!animation.eligible);}}#[test]-fn onboarding_keeps_a_settled_mark_after_budget_and_pause() {- let area = Rect::new(- /*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,- );- let start = Instant::now();- let mut animation = EmptyStateAnimation::default();- animation.start_fresh();- animation.spin_elapsed = sequence::SPIN_DURATION + sequence::COMPLETION_FADE;- let mut buffer = Buffer::empty(area);- assert_eq!(- animation.render_in_at(- area,- &mut buffer,- Presentation::Animated,- AnimationEnd::Faded,- start- ),- None- );- assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));- let settled = buffer.clone();- animation.pause_clock();- buffer.reset();- assert_eq!(- animation.render_in_at(- area,- &mut buffer,- Presentation::Faded,- AnimationEnd::Faded,- start + Duration::from_secs(/*secs*/ 3600)- ),- None+fn onboarding_keeps_full_color_after_budget_and_pause() {+ crate::terminal_palette::with_test_default_colors(+ crate::terminal_probe::DefaultColors {+ fg: (210, 221, 235),+ bg: (15, 20, 37),+ },+ || {+ let area = Rect::new(+ /*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,+ );+ let start = Instant::now();+ let mut animation = EmptyStateAnimation::default();+ animation.start_fresh();+ let mut buffer = Buffer::empty(area);+ animation.render_in_at(area, &mut buffer, Presentation::Animated, start);+ buffer.reset();+ assert_eq!(+ animation.render_in_at(+ area,+ &mut buffer,+ Presentation::Animated,+ start + sequence::SPIN_DURATION+ ),+ None+ );+ assert_eq!(animation.opacity, 1.0);+ assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));+ insta::assert_snapshot!(+ "onboarding_settled_logo",+ buffer+ .content+ .chunks(usize::from(area.width))+ .map(|row| row+ .iter()+ .map(ratatui::buffer::Cell::symbol)+ .collect::<String>()+ .trim_end()+ .to_owned())+ .collect::<Vec<_>>()+ .join("\n")+ );+ let settled = buffer.clone();+ animation.pause_clock();+ buffer.reset();+ assert_eq!(+ animation.render_in_at(+ area,+ &mut buffer,+ Presentation::Faded,+ start + Duration::from_secs(/*secs*/ 3600)+ ),+ None+ );+ assert_eq!(buffer, settled);+ },);- assert_eq!(buffer, settled);}diff --git a/codex-rs/tui/src/onboarding/snapshots/codex_tui__onboarding__welcome__tests__welcome_logo_160x48.snap b/codex-rs/tui/src/onboarding/snapshots/codex_tui__onboarding__welcome__tests__welcome_logo_160x48.snapindex 5b7d067762..b4f744e2d0 100644--- a/codex-rs/tui/src/onboarding/snapshots/codex_tui__onboarding__welcome__tests__welcome_logo_160x48.snap+++ b/codex-rs/tui/src/onboarding/snapshots/codex_tui__onboarding__welcome__tests__welcome_logo_160x48.snap@@ -1,24 +1,25 @@---source: tui/src/onboarding/welcome.rs-assertion_line: 227expression: visible.trim_end()---+ ⢀⣀⣠⣤⣤⣤⣤⣤⣤⣀⣀+ ⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀+ ⢀⣠⣾⣿⣿⣿⣿⡿⠟⠛⠋⠉⠉⠙⠛⠛⠿⣿⣿⣿⣿⣿⣷⡄+ ⣠⣾⣿⣿⣿⠿⠋ ⠉⠛⣿⣿⣿⣿⣷⡀+ ⣰⣿⣿⣿⡟⠁ ⠹⣿⣿⣿⣿⡄+ ⣼⣿⣿⣿⠟ ⣀⣤⡀ ⠈⢿⣿⣿⣷⡀+ ⢠⣿⣿⣿⡟ ⣿⣿⣿⣄ ⠘⣿⣿⣿⣧+ ⢸⣿⣿⣿⠁ ⠙⣿⣿⣿⣆ ⢿⣿⣿⣿+ ⢾⣿⣿⣿ ⢸⣿⣿⣿⠆ ⢸⣿⣿⣿⠆+ ⣾⣿⣿⣿ ⣠⣿⣿⣿⠏ ⢀⣀⣀⣀⣀⣀⣀⡀ ⢸⣿⣿⣿+ ⠸⣿⣿⣿⡆ ⢰⣿⣿⣿⠇ ⣿⣿⣿⣿⣿⣿⣿⣿⡆ ⢀⣿⣿⣿⡟+ ⢻⣿⣿⣿⣄ ⠉⠛⠁ ⠙⠛⠛⠛⠛⠛⠛⠋ ⢀⣼⣿⣿⣿⠃+ ⠈⢻⣿⣿⣿⣦⡀ ⣠⣾⣿⣿⣿⠇+ ⠻⣿⣿⣿⣿⣤⣀ ⢀⣠⣾⣿⣿⣿⡿⠃+ ⠈⠻⣿⣿⣿⣿⣷⣶⣤⣄⣀⣀⣀⢀⣀⣠⣤⣴⣿⣿⣿⣿⣿⠛+ ⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋+ ⠉⠙⠛⠿⠿⠿⠿⠿⠿⠿⠛⠋⠁- ⢀⣠⣤⣶⣶⣿⣿⣿⣿⣿⣶⣶⣤⣀- ⣠⣶⣿⣿⣿⣿⠿⠿⠛⠛⠛⠿⢿⣿⣿⣿⣷⣦⡀- ⢀⣾⣿⣿⡿⠟⠁ ⠙⠻⣿⣿⣿⣆- ⢠⣿⣿⣿⠏ ⠘⢿⣿⣿⣇- ⣿⣿⣿⠃ ⣴⣿⣦ ⠈⢿⣿⣿⡆- ⢸⣿⣿⡇ ⠹⣿⣿⣷⡀ ⠸⣿⣿⣷- ⢾⣿⣿⡇ ⢸⣿⣿⡷ ⣿⣿⣿- ⢸⣿⣿⡇ ⣰⣿⣿⡿⠁ ⣠⣤⣤⣤⣤⣤⡀ ⢠⣿⣿⣿- ⠘⣿⣿⣿⡄ ⠻⣿⠟ ⠿⣿⣿⣿⣿⣿⠇ ⣼⣿⣿⡇- ⠹⣿⣿⣿⣄ ⢀⣾⣿⣿⡟- ⠘⢿⣿⣿⣷⣄ ⢀⣴⣿⣿⣿⠟⠁- ⠈⠙⢿⣿⣿⣿⣶⣤⣤⣤⣀⣠⣤⣴⣾⣿⣿⣿⠟⠃- ⠉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁- ⠈⠉⠉⠉⠉⠁-Welcome to Codex, OpenAI's command-line coding agentdiff --git a/codex-rs/tui/src/onboarding/welcome.rs b/codex-rs/tui/src/onboarding/welcome.rsindex 0964076ffe..9c9e7b8f1d 100644--- a/codex-rs/tui/src/onboarding/welcome.rs+++ b/codex-rs/tui/src/onboarding/welcome.rs@@ -15,7 +15,6 @@ use ratatui::widgets::Wrap;use std::cell::Cell;use std::cell::RefCell;-use crate::empty_state_animation::AnimationEnd;use crate::empty_state_animation::EmptyStateAnimation;use crate::empty_state_animation::Presentation;use crate::key_hint::KeyBindingListExt;@@ -26,10 +25,10 @@ use crate::tui::FrameRequester;use super::onboarding_screen::StepState;-const MIN_ANIMATION_HEIGHT: u16 = 37;-const MIN_ANIMATION_WIDTH: u16 = 60;-const ANIMATION_WIDTH: u16 = 48;-const ANIMATION_HEIGHT: u16 = 17;+const MIN_ANIMATION_HEIGHT: u16 = 41;+const MIN_ANIMATION_WIDTH: u16 = 64;+const ANIMATION_WIDTH: u16 = 60;+const ANIMATION_HEIGHT: u16 = 21;pub(crate) struct WelcomeWidget {pub is_logged_in: bool,@@ -109,16 +108,11 @@ impl WidgetRef for &WelcomeWidget {} else {self.presentation.get()};- let stage = Rect::new(- area.x.saturating_add(/*rhs*/ 2),- area.y,- ANIMATION_WIDTH,- ANIMATION_HEIGHT,- );- if let Some(delay) =- self.animation- .borrow_mut()- .render_in(stage, buf, presentation, AnimationEnd::Faded)+ let stage = Rect::new(area.x, area.y, ANIMATION_WIDTH, ANIMATION_HEIGHT);+ if let Some(delay) = self+ .animation+ .borrow_mut()+ .render_in(stage, buf, presentation){self.request_frame.schedule_frame_in(delay);}diff --git a/codex-rs/tui/src/snapshots/codex_tui__empty_state_animation__tests__onboarding_settled_logo.snap b/codex-rs/tui/src/snapshots/codex_tui__empty_state_animation__tests__onboarding_settled_logo.snapnew file mode 100644index 0000000000..3a68cdb2db--- /dev/null+++ b/codex-rs/tui/src/snapshots/codex_tui__empty_state_animation__tests__onboarding_settled_logo.snap@@ -0,0 +1,18 @@+---+source: tui/src/empty_state_animation_tests.rs+expression: "buffer.content.chunks(usize::from(area.width)).map(|row|\nrow.iter().map(|cell|\ncell.symbol()).collect::<String>().trim_end().to_owned()).collect::<Vec<_>>().join(\"\\n\")"+---+ ⣠⣴⣶⣿⣿⣷⣶⣤⣀⣀⣀⣀⣀+ ⢠⣾⣿⡿⠟⠛⠉⣻⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀+ ⢀⣀⣿⣿⡟⢀⣠⣶⣿⣿⠿⠛⢉⣀⣀ ⠙⢿⣿⣿⣆+ ⢀⣾⣿⣿⣿⣿ ⢸⣿⡿⠋⢁⣤⣶⣿⣿⣿⣿⣦⣄⣻⣿⣿+ ⢠⣿⣿⡟⢹⣿⣿ ⢸⣿⣷⣾⣿⣿⣿⣯⣀⠉⠛⢿⣿⣿⣿⣿+ ⣼⣿⣿ ⢸⣿⣿ ⢸⣿⡿⠛⠁⠈⠛⢿⣿⣿⣦⣄⡈⠙⢿⣿⣷⡀+ ⢸⣿⣿⡀⠸⣿⣿⣶⣼⣿⡇ ⢸⣿⣟⠿⣿⣿⡆ ⢻⣿⣧+ ⢻⣿⣿⣄⡈⠙⠻⣿⣿⣷⣤⡀⢀⣤⣾⣿⣿ ⢸⣿⡇ ⣸⣿⣿+ ⣿⣿⣿⣿⣷⣦⣀⠉⣻⣿⣿⣿⡿⢿⣿⣿ ⢸⣿⡇⣠⣿⣿⡟+ ⢿⣿⣧⠉⠻⣿⣿⣿⣿⡿⠛⠉⣀⣼⣿⣿ ⣸⣿⣿⣿⣿⠟+ ⠘⢿⣿⣷⣄⡀⠉⠉⢁⣠⣴⣿⣿⡿⠟⠋⢀⣿⣿⡟⠋⠁+ ⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣛⣉⣀⣀⣴⣿⣿⡟+ ⠈⠉⠉⠉⠙⠻⣿⣿⣿⣿⣿⣿⠿⠋+ ⠈⠉⠉