Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Restore status after preamble (#10465)

pakrym-oaibf87468c2bbc
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs
index ce4af0d2ff..56cebb6abb 100644
--- a/codex-rs/tui/src/chatwidget.rs
+++ b/codex-rs/tui/src/chatwidget.rs
@@ -2081,6 +2081,7 @@ impl ChatWidget {
pub(crate) fn handle_exec_begin_now(&mut self, ev: ExecCommandBeginEvent) {
// Ensure the status indicator is visible while the command runs.
+ self.bottom_pane.ensure_status_indicator();
self.running_commands.insert(
ev.call_id.clone(),
RunningCommand {
diff --git a/codex-rs/tui/src/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rs
index 00141a0963..45fafec194 100644
--- a/codex-rs/tui/src/chatwidget/tests.rs
+++ b/codex-rs/tui/src/chatwidget/tests.rs
@@ -1830,6 +1830,25 @@ async fn streaming_final_answer_keeps_task_running_state() {
assert!(!chat.bottom_pane.quit_shortcut_hint_visible());
}
+#[tokio::test]
+async fn exec_begin_restores_status_indicator_after_preamble() {
+ let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
+
+ chat.on_task_started();
+ assert_eq!(chat.bottom_pane.status_indicator_visible(), true);
+
+ chat.on_agent_message_delta("Preamble line\n".to_string());
+ chat.on_commit_tick();
+ drain_insert_history(&mut rx);
+
+ assert_eq!(chat.bottom_pane.status_indicator_visible(), false);
+ assert_eq!(chat.bottom_pane.is_task_running(), true);
+
+ begin_exec(&mut chat, "call-1", "echo hi");
+
+ assert_eq!(chat.bottom_pane.status_indicator_visible(), true);
+}
+
#[tokio::test]
async fn ctrl_c_shutdown_works_with_caps_lock() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;