diff --git a/codex-rs/tui/src/app/agents_overview_actions.rs b/codex-rs/tui/src/app/agents_overview_actions.rs index 5b6fa74a27..f51b5e1ac2 100644 --- a/codex-rs/tui/src/app/agents_overview_actions.rs +++ b/codex-rs/tui/src/app/agents_overview_actions.rs @@ -154,7 +154,7 @@ impl App { tx.send(AppEvent::RunAgentsOverviewAction { thread_id, action }) })], dismiss_on_select: true, - require_explicit_confirmation: true, + require_explicit_confirmation: action == AgentsOverviewAction::Delete, ..Default::default() }, ], diff --git a/codex-rs/tui/src/app/agents_overview_actions_tests.rs b/codex-rs/tui/src/app/agents_overview_actions_tests.rs index 344cf51a2c..79fc6d4e43 100644 --- a/codex-rs/tui/src/app/agents_overview_actions_tests.rs +++ b/codex-rs/tui/src/app/agents_overview_actions_tests.rs @@ -11,6 +11,48 @@ use core_test_support::streaming_sse::StreamingSseChunk; use core_test_support::streaming_sse::start_streaming_sse_server; use pretty_assertions::assert_eq; +#[tokio::test] +async fn archive_confirmation_number_keys_act_immediately() { + for key in ['1', '2'] { + let (mut app, mut rx, _op_rx) = crate::app::tests::make_test_app_with_channels().await; + let id = ThreadId::new(); + app.agents_overview.threads.insert( + id, + Some(overview_thread( + id, + /*parent_thread_id*/ None, + "Current task", + ThreadStatus::Idle, + )), + ); + app.confirm_agents_overview_action(id, AgentsOverviewAction::Archive); + insta::assert_snapshot!( + "archive_task_confirmation", + render_bottom_popup(&app.chat_widget, /*width*/ 72) + ); + + app.chat_widget.handle_key_event(KeyCode::Char(key).into()); + + assert!(!app.chat_widget.has_active_view()); + let actions = std::iter::from_fn(|| rx.try_recv().ok()) + .filter_map(|event| match event { + AppEvent::RunAgentsOverviewAction { thread_id, action } => { + Some((thread_id, action)) + } + _ => None, + }) + .collect::>(); + assert_eq!( + actions, + if key == '2' { + vec![(id, AgentsOverviewAction::Archive)] + } else { + Vec::new() + } + ); + } +} + #[tokio::test] async fn lifecycle_shortcuts_target_filtered_task_in_any_state() { let mut app = make_test_app().await;