Lightweight coding agent that runs in your terminal
Rust
Defer startup NUX impressions until startup succeeds (#22587)
Eric Traut6a225e400520
diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rsindex f3a7aaf992..aa22e9383d 100644--- a/codex-rs/tui/src/app.rs+++ b/codex-rs/tui/src/app.rs@@ -755,15 +755,13 @@ impl App {&initial_prompt,&initial_images,);- let startup_tooltip_override =- if Self::should_prepare_startup_tooltip_override(&session_selection) {- prepare_startup_tooltip_override(&mut config, &available_models, is_first_run).await- } else {- None- };let (mut chat_widget, initial_started_thread) = match session_selection {SessionSelection::StartFresh | SessionSelection::Exit => {let started = app_server.start_thread(&config).await?;+ // Only count a startup tooltip once the fresh thread can actually render it.+ let startup_tooltip_override =+ prepare_startup_tooltip_override(&mut config, &available_models, is_first_run)+ .await;let init = crate::chatwidget::ChatWidgetInit {config: config.clone(),environment_manager: environment_manager.clone(),diff --git a/codex-rs/tui/src/app/tests/startup.rs b/codex-rs/tui/src/app/tests/startup.rsindex 9f98f50fe9..c0aa1b61b7 100644--- a/codex-rs/tui/src/app/tests/startup.rs+++ b/codex-rs/tui/src/app/tests/startup.rs@@ -31,28 +31,6 @@ fn startup_waiting_gate_is_only_for_fresh_or_exit_session_selection() {);}-#[test]-fn startup_tooltip_override_is_only_prepared_for_fresh_or_exit_session_selection() {- assert!(App::should_prepare_startup_tooltip_override(- &SessionSelection::StartFresh- ));- assert!(App::should_prepare_startup_tooltip_override(- &SessionSelection::Exit- ));- assert!(!App::should_prepare_startup_tooltip_override(- &SessionSelection::Resume(crate::resume_picker::SessionTarget {- path: Some(PathBuf::from("/tmp/restore")),- thread_id: ThreadId::new(),- })- ));- assert!(!App::should_prepare_startup_tooltip_override(- &SessionSelection::Fork(crate::resume_picker::SessionTarget {- path: Some(PathBuf::from("/tmp/fork")),- thread_id: ThreadId::new(),- })- ));-}-#[test]fn startup_paused_goal_prompt_gate_is_only_for_quiet_resume() {let resume = SessionSelection::Resume(crate::resume_picker::SessionTarget {diff --git a/codex-rs/tui/src/app/thread_routing.rs b/codex-rs/tui/src/app/thread_routing.rsindex 9319319564..f25398b0b8 100644--- a/codex-rs/tui/src/app/thread_routing.rs+++ b/codex-rs/tui/src/app/thread_routing.rs@@ -1269,15 +1269,6 @@ impl App {)}- pub(super) fn should_prepare_startup_tooltip_override(- session_selection: &SessionSelection,- ) -> bool {- matches!(- session_selection,- SessionSelection::StartFresh | SessionSelection::Exit- )- }-pub(super) fn should_prompt_for_paused_goal_after_startup_resume(session_selection: &SessionSelection,initial_prompt: &Option<String>,