Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix(tui): clear completed safety buffering prompt (#30490)

Felipe Coury850da19dc4e1
diff --git a/codex-rs/tui/src/chatwidget/safety_buffering.rs b/codex-rs/tui/src/chatwidget/safety_buffering.rs
index 389048fb0b..aec589bdf0 100644
--- a/codex-rs/tui/src/chatwidget/safety_buffering.rs
+++ b/codex-rs/tui/src/chatwidget/safety_buffering.rs
@@ -5,7 +5,7 @@ use codex_app_server_protocol::ModelSafetyBufferingUpdatedNotification;
const SAFETY_BUFFERING_PROMPT_VIEW_ID: &str = "safety-buffering-prompt";
-const SAFETY_BUFFERING_MESSAGE_WITH_RETRY: &str = "This request requires additional safety checks, which can take extra time. You can retry with a faster model for a quicker response, though it may be less capable of handling complex requests.";
+const SAFETY_BUFFERING_MESSAGE_WITH_RETRY: &str = "This request requires additional safety checks, which can take extra time. Hang tight or retry with a faster model for a quicker response, though it may be less capable of handling complex requests.";
const SAFETY_BUFFERING_MESSAGE_WITHOUT_RETRY: &str =
"This request requires additional safety checks, which can take extra time.";
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__safety_buffering_retry_prompt.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__safety_buffering_retry_prompt.snap
index 60fd4d38c3..4498a472f5 100644
--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__safety_buffering_retry_prompt.snap
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__safety_buffering_retry_prompt.snap
@@ -4,8 +4,8 @@ expression: popup
---
Additional safety checks
This request requires additional safety checks, which can take extra time.
- You can retry with a faster model for a quicker response, though it may be
- less capable of handling complex requests.
+ Hang tight or retry with a faster model for a quicker response, though it
+ may be less capable of handling complex requests.
› 1. Retry with a faster model
2. Keep waiting
diff --git a/codex-rs/tui/src/chatwidget/tests/app_server.rs b/codex-rs/tui/src/chatwidget/tests/app_server.rs
index 3c7d9bbf50..2753d5c2da 100644
--- a/codex-rs/tui/src/chatwidget/tests/app_server.rs
+++ b/codex-rs/tui/src/chatwidget/tests/app_server.rs
@@ -146,7 +146,7 @@ async fn safety_buffering_offers_one_retry_with_app_wording() {
}
#[tokio::test]
-async fn safety_buffering_stops_retrying_after_agent_message_starts() {
+async fn safety_buffering_remains_visible_until_turn_completes() {
let (mut chat, _rx, mut op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
let (thread_id, turn_id, _) = start_safety_buffering_test_turn(&mut chat, &mut op_rx);
chat.handle_server_notification(
@@ -162,6 +162,11 @@ async fn safety_buffering_stops_retrying_after_agent_message_starts() {
chat.on_agent_message_delta("Visible response".to_string());
assert!(!chat.can_retry_safety_buffered_turn(turn_id));
+ assert!(render_bottom_popup(&chat, /*width*/ 80).contains("Additional safety checks"));
+
+ handle_turn_completed(&mut chat, turn_id, /*duration_ms*/ None);
+
+ assert!(!render_bottom_popup(&chat, /*width*/ 80).contains("Additional safety checks"));
}
#[tokio::test]
diff --git a/codex-rs/tui/src/chatwidget/turn_runtime.rs b/codex-rs/tui/src/chatwidget/turn_runtime.rs
index 8af43550e3..fdfad7f6d8 100644
--- a/codex-rs/tui/src/chatwidget/turn_runtime.rs
+++ b/codex-rs/tui/src/chatwidget/turn_runtime.rs
@@ -170,6 +170,7 @@ impl ChatWidget {
self.input_queue.user_turn_pending_start = false;
self.clear_active_hook_cell();
self.turn_lifecycle.finish();
+ self.clear_safety_buffering();
self.update_task_running_state();
self.running_commands.clear();
self.suppressed_exec_calls.clear();