mirror of
https://github.com/openai/codex.git
synced 2026-11-04 00:24:43 +00:00
feat(auto-review) short-circuit (#18890)
## Summary Short circuit the convo if auto-review hits too many denials ## Testing - [x] Added unit tests --------- Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
b77791c228
commit
ed4def8286
28 files changed
+645
-22
No files matched your search
@@ -51,6 +51,7 @@ pub(super) use codex_app_server_protocol::GuardianApprovalReviewStatus;
|
||||
pub(super) use codex_app_server_protocol::GuardianCommandSource as AppServerGuardianCommandSource;
|
||||
pub(super) use codex_app_server_protocol::GuardianRiskLevel as AppServerGuardianRiskLevel;
|
||||
pub(super) use codex_app_server_protocol::GuardianUserAuthorization as AppServerGuardianUserAuthorization;
|
||||
pub(super) use codex_app_server_protocol::GuardianWarningNotification;
|
||||
pub(super) use codex_app_server_protocol::HookCompletedNotification as AppServerHookCompletedNotification;
|
||||
pub(super) use codex_app_server_protocol::HookEventName as AppServerHookEventName;
|
||||
pub(super) use codex_app_server_protocol::HookExecutionMode as AppServerHookExecutionMode;
|
||||
|
||||
@@ -212,6 +212,27 @@ async fn live_app_server_warning_notification_renders_message() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn live_app_server_guardian_warning_notification_renders_message() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
chat.handle_server_notification(
|
||||
ServerNotification::GuardianWarning(GuardianWarningNotification {
|
||||
thread_id: "thread-1".to_string(),
|
||||
message: "Automatic approval review denied the requested action.".to_string(),
|
||||
}),
|
||||
/*replay_kind*/ None,
|
||||
);
|
||||
|
||||
let cells = drain_insert_history(&mut rx);
|
||||
assert_eq!(cells.len(), 1, "expected one warning history cell");
|
||||
let rendered = lines_to_single_string(&cells[0]);
|
||||
assert!(
|
||||
rendered.contains("Automatic approval review denied the requested action."),
|
||||
"expected guardian warning notification message, got {rendered}"
|
||||
);
|
||||
}
|
||||
|
||||
#[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;
|
||||
|
||||
@@ -28,7 +28,7 @@ async fn guardian_denied_exec_renders_warning_and_denied_request() {
|
||||
});
|
||||
chat.handle_codex_event(Event {
|
||||
id: "guardian-warning".into(),
|
||||
msg: EventMsg::Warning(WarningEvent {
|
||||
msg: EventMsg::GuardianWarning(WarningEvent {
|
||||
message: "Automatic approval review denied (risk: high): The planned action would transmit the full contents of a workspace source file (`core/src/codex.rs`) to `https://example.com`, which is an external and untrusted endpoint.".into(),
|
||||
}),
|
||||
});
|
||||
@@ -228,7 +228,7 @@ async fn guardian_timed_out_exec_renders_warning_and_timed_out_request() {
|
||||
});
|
||||
chat.handle_codex_event(Event {
|
||||
id: "guardian-warning".into(),
|
||||
msg: EventMsg::Warning(WarningEvent {
|
||||
msg: EventMsg::GuardianWarning(WarningEvent {
|
||||
message: "Automatic approval review timed out while evaluating the requested approval."
|
||||
.into(),
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user