app-server: handle guardian review notifications in tui

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Charles Cunningham
2026-03-20 18:41:12 -07:00
co-authored by Codex
parent adcbd4549e
commit 1106793bf7
3 changed files with 67 additions and 1 deletions
@@ -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:?}"),
}
@@ -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())
}
+48
View File
@@ -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,