Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Show strict review warnings in the TUI (#39635)

Dylan Hurd7edd0a4c9dc6
diff --git a/codex-rs/tui/src/chatwidget/protocol.rs b/codex-rs/tui/src/chatwidget/protocol.rs
index 7e687f332b..1f1408f13a 100644
--- a/codex-rs/tui/src/chatwidget/protocol.rs
+++ b/codex-rs/tui/src/chatwidget/protocol.rs
@@ -161,6 +161,15 @@ impl ChatWidget {
self.on_warning(notification.message);
}
}
+ ServerNotification::StrictReviewRequired(_) => {
+ self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
+ history_cell::new_warning_event(
+ "This request requires additional safety checks, some tool calls might take extra time"
+ .to_string(),
+ ),
+ )));
+ self.request_redraw();
+ }
ServerNotification::DeprecationNotice(notification) => {
self.on_deprecation_notice(notification.summary, notification.details)
}
@@ -208,7 +217,6 @@ impl ChatWidget {
| ServerNotification::ThreadArchived(_)
| ServerNotification::ThreadDeleted(_)
| ServerNotification::ThreadUnarchived(_)
- | ServerNotification::StrictReviewRequired(_)
| ServerNotification::RawResponseItemCompleted(_)
| ServerNotification::RawResponseCompleted(_)
| ServerNotification::CommandExecOutputDelta(_)
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__strict_review_required.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__strict_review_required.snap
new file mode 100644
index 0000000000..7c018ca1aa
--- /dev/null
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__strict_review_required.snap
@@ -0,0 +1,6 @@
+---
+source: tui/src/chatwidget/tests/app_server.rs
+expression: "lines_to_single_string(&cells[0])"
+---
+⚠ This request requires additional safety checks, some tool calls might take
+ extra time
diff --git a/codex-rs/tui/src/chatwidget/tests/app_server.rs b/codex-rs/tui/src/chatwidget/tests/app_server.rs
index ae2e7d8150..56ba697a23 100644
--- a/codex-rs/tui/src/chatwidget/tests/app_server.rs
+++ b/codex-rs/tui/src/chatwidget/tests/app_server.rs
@@ -751,6 +751,39 @@ async fn live_app_server_guardian_warning_notification_renders_message() {
);
}
+#[tokio::test]
+async fn live_app_server_strict_review_required_notification_renders_message() {
+ let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
+ handle_turn_started(&mut chat, "turn-1");
+ begin_exec(&mut chat, "cmd-1", "printf 'streamed output\\n'");
+ drain_insert_history(&mut rx);
+
+ chat.handle_server_notification(
+ ServerNotification::StrictReviewRequired(
+ codex_app_server_protocol::StrictReviewRequiredNotification {
+ thread_id: "thread-1".to_string(),
+ turn_id: "turn-1".to_string(),
+ started_at_ms: 1_000,
+ },
+ ),
+ /*replay_kind*/ None,
+ );
+
+ let cells = drain_insert_history(&mut rx);
+ assert_eq!(cells.len(), 1, "expected one warning history cell");
+ assert_chatwidget_snapshot!("strict_review_required", lines_to_single_string(&cells[0]));
+ chat.on_exec_command_output_delta("cmd-1", "streamed output\n");
+ assert!(
+ lines_to_single_string(
+ &chat
+ .active_cell_transcript_lines(/*width*/ 80)
+ .expect("strict review should preserve the active command")
+ )
+ .contains("streamed output")
+ );
+ assert!(chat.bottom_pane.is_task_running());
+}
+
#[tokio::test]
async fn live_app_server_config_warning_prefixes_summary() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;