mirror of
https://github.com/openai/codex.git
synced 2026-05-03 02:46:39 +00:00
nit: do not render terminal interactions if no task running (#9374)
To prevent race where the terminal interaction message is processed after the last message
This commit is contained in:
@@ -1719,9 +1719,32 @@ async fn unified_exec_end_after_task_complete_is_suppressed() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unified_exec_interaction_after_task_complete_is_suppressed() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||
chat.on_task_started();
|
||||
chat.on_task_complete(None);
|
||||
|
||||
chat.handle_codex_event(Event {
|
||||
id: "call-1".to_string(),
|
||||
msg: EventMsg::TerminalInteraction(TerminalInteractionEvent {
|
||||
call_id: "call-1".to_string(),
|
||||
process_id: "proc-1".to_string(),
|
||||
stdin: "ls\n".to_string(),
|
||||
}),
|
||||
});
|
||||
|
||||
let cells = drain_insert_history(&mut rx);
|
||||
assert!(
|
||||
cells.is_empty(),
|
||||
"expected unified exec interaction after task complete to be suppressed"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unified_exec_wait_status_header_updates_on_late_command_display() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||
chat.on_task_started();
|
||||
chat.unified_exec_processes.push(UnifiedExecProcessSummary {
|
||||
key: "proc-1".to_string(),
|
||||
command_display: "sleep 5".to_string(),
|
||||
@@ -1743,6 +1766,7 @@ async fn unified_exec_wait_status_header_updates_on_late_command_display() {
|
||||
#[tokio::test]
|
||||
async fn unified_exec_waiting_multiple_empty_snapshots() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||
chat.on_task_started();
|
||||
begin_unified_exec_startup(&mut chat, "call-wait-1", "proc-1", "just fix");
|
||||
|
||||
terminal_interaction(&mut chat, "call-wait-1a", "proc-1", "");
|
||||
@@ -1770,6 +1794,7 @@ async fn unified_exec_waiting_multiple_empty_snapshots() {
|
||||
#[tokio::test]
|
||||
async fn unified_exec_empty_then_non_empty_snapshot() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||
chat.on_task_started();
|
||||
begin_unified_exec_startup(&mut chat, "call-wait-2", "proc-2", "just fix");
|
||||
|
||||
terminal_interaction(&mut chat, "call-wait-2a", "proc-2", "");
|
||||
@@ -1786,6 +1811,7 @@ async fn unified_exec_empty_then_non_empty_snapshot() {
|
||||
#[tokio::test]
|
||||
async fn unified_exec_non_empty_then_empty_snapshots() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||
chat.on_task_started();
|
||||
begin_unified_exec_startup(&mut chat, "call-wait-3", "proc-3", "just fix");
|
||||
|
||||
terminal_interaction(&mut chat, "call-wait-3a", "proc-3", "pwd\n");
|
||||
|
||||
Reference in New Issue
Block a user