Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

nit: ui on interruption (#9606)

jif-oai338f2d634b23
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs
index 110280612c..ff6db40bfa 100644
--- a/codex-rs/tui/src/chatwidget.rs
+++ b/codex-rs/tui/src/chatwidget.rs
@@ -1010,6 +1010,7 @@ impl ChatWidget {
self.running_commands.clear();
self.suppressed_exec_calls.clear();
self.last_unified_wait = None;
+ self.unified_exec_wait_streak = None;
self.clear_unified_exec_processes();
self.stream_controller = None;
self.maybe_show_pending_rate_limit_prompt();
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_clears_unified_exec_wait_streak.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_clears_unified_exec_wait_streak.snap
new file mode 100644
index 0000000000..bf70c40460
--- /dev/null
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_clears_unified_exec_wait_streak.snap
@@ -0,0 +1,6 @@
+---
+source: tui/src/chatwidget/tests.rs
+expression: snapshot
+---
+cells=1
+■ Conversation interrupted - tell the model what to do differently. Something went wrong? Hit `/feedback` to report the issue.
diff --git a/codex-rs/tui/src/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rs
index 35ab9579e4..a056cb2902 100644
--- a/codex-rs/tui/src/chatwidget/tests.rs
+++ b/codex-rs/tui/src/chatwidget/tests.rs
@@ -3393,6 +3393,38 @@ async fn interrupt_clears_unified_exec_processes() {
let _ = drain_insert_history(&mut rx);
}
+#[tokio::test]
+async fn interrupt_clears_unified_exec_wait_streak_snapshot() {
+ let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
+
+ chat.handle_codex_event(Event {
+ id: "turn-1".into(),
+ msg: EventMsg::TurnStarted(TurnStartedEvent {
+ model_context_window: None,
+ }),
+ });
+
+ let begin = begin_unified_exec_startup(&mut chat, "call-1", "process-1", "just fix");
+ terminal_interaction(&mut chat, "call-1a", "process-1", "");
+
+ chat.handle_codex_event(Event {
+ id: "turn-1".into(),
+ msg: EventMsg::TurnAborted(codex_core::protocol::TurnAbortedEvent {
+ reason: TurnAbortReason::Interrupted,
+ }),
+ });
+
+ end_exec(&mut chat, begin, "", "", 0);
+ let cells = drain_insert_history(&mut rx);
+ let combined = cells
+ .iter()
+ .map(|lines| lines_to_single_string(lines))
+ .collect::<Vec<_>>()
+ .join("\n");
+ let snapshot = format!("cells={}\n{combined}", cells.len());
+ assert_snapshot!("interrupt_clears_unified_exec_wait_streak", snapshot);
+}
+
#[tokio::test]
async fn turn_complete_clears_unified_exec_processes() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;