diff --git a/codex-rs/tui/src/app/session_lifecycle.rs b/codex-rs/tui/src/app/session_lifecycle.rs index 33bab9e55a..4072c5d8fb 100644 --- a/codex-rs/tui/src/app/session_lifecycle.rs +++ b/codex-rs/tui/src/app/session_lifecycle.rs @@ -33,7 +33,7 @@ impl App { { let is_running = channel.store.lock().await.active_turn_id().is_some(); self.agent_navigation.set_running(thread_id, is_running); - } else { + } else if self.thread_event_channels.contains_key(&thread_id) { self.agent_navigation .set_running(thread_id, /*is_running*/ false); } diff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rs index 7c19d33222..7086bd11e4 100644 --- a/codex-rs/tui/src/app/tests.rs +++ b/codex-rs/tui/src/app/tests.rs @@ -1303,7 +1303,7 @@ async fn open_agent_picker_clears_completed_path_backed_agent_running_state() -> } #[tokio::test] -async fn open_agent_picker_clears_replay_only_path_backed_running_hint() -> Result<()> { +async fn open_agent_picker_uses_local_path_backed_running_state() -> Result<()> { let mut app = Box::pin(make_test_app()).await; let mut app_server = Box::pin(crate::start_embedded_app_server_for_picker( app.chat_widget.config_ref(), @@ -1337,6 +1337,12 @@ async fn open_agent_picker_clears_replay_only_path_backed_running_hint() -> Resu is_closed: false, }) ); + app.thread_event_channels.remove(&thread_id); + app.agent_navigation.set_running(thread_id, true); + + Box::pin(app.open_agent_picker(&mut app_server)).await; + + assert!(app.agent_navigation.get(&thread_id).unwrap().is_running); Ok(()) } diff --git a/codex-rs/tui/src/session_log.rs b/codex-rs/tui/src/session_log.rs index 369e19d7fd..597d288cd1 100644 --- a/codex-rs/tui/src/session_log.rs +++ b/codex-rs/tui/src/session_log.rs @@ -121,7 +121,7 @@ pub(crate) fn maybe_init(config: &Config) { pub(crate) fn log_inbound_app_event(event: &AppEvent) { // Log only if enabled - if !LOGGER.is_enabled() { + if !LOGGER.is_enabled() || matches!(event, AppEvent::AgentThreadSelectionPrepared { .. }) { return; }