From 1106793bf7cd1da455e7aca7ff9e03d58cf1209f Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Fri, 20 Mar 2026 18:41:12 -0700 Subject: [PATCH] app-server: handle guardian review notifications in tui Co-authored-by: Codex --- .../app-server/src/bespoke_event_handling.rs | 2 +- .../src/app/app_server_adapter.rs | 18 +++++++ codex-rs/tui_app_server/src/chatwidget.rs | 48 +++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index dde37a1bd1..6a1c18f860 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -3276,7 +3276,7 @@ mod tests { assert_eq!(payload.review.risk_score, None); assert_eq!(payload.review.risk_level, None); assert_eq!(payload.review.rationale, None); - assert_eq!(payload.action, Some(action.clone())); + assert_eq!(payload.action, Some(action)); } other => panic!("unexpected notification: {other:?}"), } diff --git a/codex-rs/tui_app_server/src/app/app_server_adapter.rs b/codex-rs/tui_app_server/src/app/app_server_adapter.rs index c144e36dbe..1ddad4b162 100644 --- a/codex-rs/tui_app_server/src/app/app_server_adapter.rs +++ b/codex-rs/tui_app_server/src/app/app_server_adapter.rs @@ -436,6 +436,24 @@ fn server_notification_thread_target( ServerNotification::TurnDiffUpdated(notification) => Some(notification.thread_id.as_str()), ServerNotification::TurnPlanUpdated(notification) => Some(notification.thread_id.as_str()), ServerNotification::ItemStarted(notification) => Some(notification.thread_id.as_str()), + ServerNotification::CommandExecutionGuardianApprovalReviewStarted(notification) => { + Some(notification.thread_id.as_str()) + } + ServerNotification::CommandExecutionGuardianApprovalReviewCompleted(notification) => { + Some(notification.thread_id.as_str()) + } + ServerNotification::FileChangeGuardianApprovalReviewStarted(notification) => { + Some(notification.thread_id.as_str()) + } + ServerNotification::FileChangeGuardianApprovalReviewCompleted(notification) => { + Some(notification.thread_id.as_str()) + } + ServerNotification::McpToolCallGuardianApprovalReviewStarted(notification) => { + Some(notification.thread_id.as_str()) + } + ServerNotification::McpToolCallGuardianApprovalReviewCompleted(notification) => { + Some(notification.thread_id.as_str()) + } ServerNotification::ItemGuardianApprovalReviewStarted(notification) => { Some(notification.thread_id.as_str()) } diff --git a/codex-rs/tui_app_server/src/chatwidget.rs b/codex-rs/tui_app_server/src/chatwidget.rs index 0d53ae3f7a..29acded4de 100644 --- a/codex-rs/tui_app_server/src/chatwidget.rs +++ b/codex-rs/tui_app_server/src/chatwidget.rs @@ -5982,6 +5982,54 @@ impl ChatWidget { .map(|details| format!("{}: {details}", notification.summary)) .unwrap_or(notification.summary), ), + ServerNotification::CommandExecutionGuardianApprovalReviewStarted(notification) => { + self.on_guardian_review_notification( + notification.item_id, + notification.turn_id, + notification.review, + notification.action, + ); + } + ServerNotification::CommandExecutionGuardianApprovalReviewCompleted(notification) => { + self.on_guardian_review_notification( + notification.item_id, + notification.turn_id, + notification.review, + notification.action, + ); + } + ServerNotification::FileChangeGuardianApprovalReviewStarted(notification) => { + self.on_guardian_review_notification( + notification.item_id, + notification.turn_id, + notification.review, + notification.action, + ); + } + ServerNotification::FileChangeGuardianApprovalReviewCompleted(notification) => { + self.on_guardian_review_notification( + notification.item_id, + notification.turn_id, + notification.review, + notification.action, + ); + } + ServerNotification::McpToolCallGuardianApprovalReviewStarted(notification) => { + self.on_guardian_review_notification( + notification.item_id, + notification.turn_id, + notification.review, + notification.action, + ); + } + ServerNotification::McpToolCallGuardianApprovalReviewCompleted(notification) => { + self.on_guardian_review_notification( + notification.item_id, + notification.turn_id, + notification.review, + notification.action, + ); + } ServerNotification::ItemGuardianApprovalReviewStarted(notification) => { self.on_guardian_review_notification( notification.target_item_id,