tui: resolve interactive slash commands before queueing

Mark popup-opening slash commands as requiring interaction, open them immediately instead of queueing bare drafts while a task is running, and make queued replay restore any legacy bare interactive command draft instead of opening UI mid-drain.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Charles Cunningham
2026-03-11 17:32:36 -07:00
parent 8267155494
commit 173d0ef4e3
3 changed files with 66 additions and 4 deletions

View File

@@ -8232,6 +8232,18 @@ async fn model_slash_command_while_task_running_opens_popup_snapshot() {
);
}
#[tokio::test]
async fn theme_slash_command_while_task_running_opens_popup_instead_of_queueing() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
chat.on_task_started();
chat.dispatch_command(SlashCommand::Theme);
assert!(chat.queued_user_messages.is_empty());
assert!(chat.has_active_view(), "expected /theme popup to open");
assert!(drain_insert_history(&mut rx).is_empty());
}
#[tokio::test]
async fn model_selection_queues_selected_action_while_task_running() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.1-codex")).await;
@@ -11570,6 +11582,25 @@ async fn queued_review_selection_replays_after_turn_complete() {
}
}
#[tokio::test]
async fn queued_bare_theme_command_restores_to_composer_instead_of_opening_popup() {
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
chat.on_task_started();
chat.queued_user_messages
.push_back(UserMessage::from("/theme".to_string()));
chat.on_task_complete(None, false);
assert_eq!(chat.bottom_pane.composer_text(), "/theme");
assert!(!chat.has_active_view(), "expected no popup during replay");
assert!(chat.queued_user_messages.is_empty());
assert_no_submit_op(&mut op_rx);
assert!(
!drain_insert_history(&mut rx).is_empty(),
"expected replay failure to be surfaced to the user"
);
}
#[tokio::test]
async fn queued_custom_review_selection_preserves_branch_like_instructions_after_turn_complete() {
let (mut chat, _rx, mut op_rx) = make_chatwidget_manual(None).await;