mirror of
https://github.com/openai/codex.git
synced 2026-09-15 12:08:01 +00:00
Make archive confirmation number shortcuts act immediately (#44744)
## What changed Allow `2` to confirm archiving a task and its child agents in the agents overview without an additional confirmation keystroke. Keep explicit confirmation for permanent deletion. ## Testing Add a regression test verifying that `1` cancels and `2` dispatches the archive action, with both shortcuts closing the confirmation popup. GitOrigin-RevId: 9a4b941f36a7876eccf9d8b0ea6a63e799f53b98
This commit is contained in:
@@ -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()
|
||||
},
|
||||
],
|
||||
|
||||
@@ -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::<Vec<_>>();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user