mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Route approvals through the extension decision API (#43432)
## What changed - Let approval extensions choose between cached approval, synchronous review, and a user prompt for tool and permission requests, while core enforces mandatory Guardian and fresh-review requirements. - Carry an optional `review_reason` on Guardian assessment events and use it to trigger strict-review notifications, retaining the fallback for older events. - Require synchronous review when cached evidence has an unusable encrypted parent compaction. ## Testing Add regression coverage for manual prompts and cached approvals with non-UTF-8 working directories. Update approval contributors in existing tests to use the decision API. GitOrigin-RevId: a4e66416070bdaa881daa41429c49021629f44c1
This commit is contained in:
1 parent
0df39752cb
commit
e1eb98461c
24 files changed
+605
-250
No files matched your search
@@ -95,6 +95,7 @@ impl ChatWidget {
|
||||
};
|
||||
|
||||
self.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id,
|
||||
target_item_id: None,
|
||||
plugin_id: None,
|
||||
|
||||
@@ -3,6 +3,7 @@ use pretty_assertions::assert_eq;
|
||||
|
||||
fn auto_review_denial_event() -> GuardianAssessmentEvent {
|
||||
GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "auto-review-recent-1".into(),
|
||||
target_item_id: Some("target-auto-review-recent-1".into()),
|
||||
plugin_id: None,
|
||||
@@ -31,6 +32,7 @@ fn guardian_command_event(
|
||||
) -> GuardianAssessmentEvent {
|
||||
let terminal = status != GuardianAssessmentStatus::InProgress;
|
||||
GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: id.to_string(),
|
||||
target_item_id: Some(format!("{id}-target")),
|
||||
plugin_id: None,
|
||||
@@ -244,6 +246,7 @@ async fn guardian_denied_exec_renders_warning_and_denied_request() {
|
||||
};
|
||||
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-1".into(),
|
||||
target_item_id: Some("guardian-target-1".into()),
|
||||
plugin_id: None,
|
||||
@@ -260,6 +263,7 @@ async fn guardian_denied_exec_renders_warning_and_denied_request() {
|
||||
});
|
||||
chat.on_warning("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.");
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-1".into(),
|
||||
target_item_id: Some("guardian-target-1".into()),
|
||||
plugin_id: None,
|
||||
@@ -313,6 +317,7 @@ async fn guardian_approved_exec_is_hidden_from_history() {
|
||||
/*replay_kind*/ None,
|
||||
);
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "thread:child-thread:guardian-1".into(),
|
||||
target_item_id: Some("guardian-approved-target".into()),
|
||||
plugin_id: None,
|
||||
@@ -370,6 +375,7 @@ async fn guardian_approved_request_permissions_clears_status_without_history() {
|
||||
};
|
||||
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-request-permissions".into(),
|
||||
target_item_id: None,
|
||||
plugin_id: None,
|
||||
@@ -396,6 +402,7 @@ async fn guardian_approved_request_permissions_clears_status_without_history() {
|
||||
);
|
||||
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-request-permissions".into(),
|
||||
target_item_id: None,
|
||||
plugin_id: None,
|
||||
@@ -448,6 +455,7 @@ async fn guardian_timed_out_exec_renders_warning_and_timed_out_request() {
|
||||
};
|
||||
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-1".into(),
|
||||
target_item_id: Some("guardian-target-1".into()),
|
||||
plugin_id: None,
|
||||
@@ -464,6 +472,7 @@ async fn guardian_timed_out_exec_renders_warning_and_timed_out_request() {
|
||||
});
|
||||
chat.on_warning("Automatic approval review timed out while evaluating the requested approval.");
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-1".into(),
|
||||
target_item_id: Some("guardian-target-1".into()),
|
||||
plugin_id: None,
|
||||
|
||||
@@ -534,6 +534,7 @@ async fn mcp_startup_complete_preserves_review_status() {
|
||||
);
|
||||
|
||||
chat.on_guardian_assessment(GuardianAssessmentEvent {
|
||||
review_reason: None,
|
||||
id: "guardian-1".to_string(),
|
||||
target_item_id: Some("guardian-target-1".to_string()),
|
||||
plugin_id: None,
|
||||
|
||||
Reference in new issue
Block a user