feat: surface Guardian recovery after retry exhaustion

Co-authored-by: Codex noreply@openai.com
This commit is contained in:
viyatb-oai
2026-06-04 00:33:14 -07:00
co-authored by Codex noreply@openai.com
parent 3dab5cabc9
commit 46f77df8cc
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -238,7 +238,7 @@ async fn record_guardian_denial(session: &Arc<Session>, turn: &Arc<TurnContext>,
turn.as_ref(),
EventMsg::GuardianWarning(WarningEvent {
message: format!(
"Automatic approval review rejected too many approval requests for this turn ({consecutive_denials} consecutive, {recent_denials} in the last {AUTO_REVIEW_DENIAL_WINDOW_SIZE} reviews); interrupting the turn."
"Automatic approval review rejected too many approval requests for this turn ({consecutive_denials} consecutive, {recent_denials} in the last {AUTO_REVIEW_DENIAL_WINDOW_SIZE} reviews); interrupting the turn. Run /approve to review eligible soft denials, or add context and retry with a safer action."
),
}),
)
+8
View File
@@ -8405,6 +8405,14 @@ async fn guardian_auto_review_interrupts_after_three_consecutive_denials() {
)
});
assert_eq!(aborted.reason, TurnAbortReason::Interrupted);
assert!(observed.iter().any(|event| {
matches!(
event,
EventMsg::GuardianWarning(event)
if event.message.contains("Run /approve")
&& event.message.contains("eligible soft denials")
)
}));
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]