mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Skip Guardian reviews in Full Access (#42147)
## Why Full Access already combines `approvalPolicy: "never"` with unrestricted permissions, so confirmation-only actions do not require a model review. ## What changed - Detect Full Access consistently across the thread and every selected environment. Pending, failed, or restricted environments are not treated as Full Access. - Approve confirmation-only Guardian and MCP requests without synchronous review, sampler prewarming, or background scoring. Cancellation, explicit denials, and forms that require user input keep their existing behavior. - Re-evaluate the active permission state on each turn so an existing thread can enter or leave Full Access safely. ## Testing Added coverage for switching approval modes, strict sensitive MCP confirmations, failed and pending environments, and suppression of Guardian requests and background-scoring connections. GitOrigin-RevId: 089ab4296dde473b8e33ab8324be79c5446c46f6
This commit is contained in:
1 parent
cd8bd62c6e
commit
e576993911
14 files changed
+295
-22
No files matched your search
@@ -1,5 +1,6 @@
|
||||
//! Guardian review decides whether an `on-request` approval should be granted
|
||||
//! automatically instead of shown to the user.
|
||||
//! Full Access (`never` approvals with a disabled sandbox) approves without review.
|
||||
//!
|
||||
//! High-level approach:
|
||||
//! 1. Reconstruct a compact transcript that preserves user intent plus the most
|
||||
|
||||
@@ -315,7 +315,7 @@ pub(crate) async fn record_guardian_denial_for_test(
|
||||
record_guardian_denial(session, turn, turn_id).await;
|
||||
}
|
||||
|
||||
/// Runs Guardian unless an installed extension explicitly claims the review.
|
||||
/// Runs Guardian unless Full Access or an installed extension resolves the review.
|
||||
/// Guardian timeouts, review-session failures, and parse failures all block
|
||||
/// execution, with timeouts surfaced separately from explicit denials.
|
||||
async fn run_guardian_review(
|
||||
@@ -327,6 +327,20 @@ async fn run_guardian_review(
|
||||
options: GuardianReviewOptions,
|
||||
) -> ReviewDecision {
|
||||
let turn = Arc::clone(context.turn());
|
||||
if context.environments().has_full_access(
|
||||
context.approval_policy,
|
||||
&turn.config.permissions.effective_permission_profile(),
|
||||
) {
|
||||
return if options
|
||||
.external_cancel
|
||||
.as_ref()
|
||||
.is_some_and(CancellationToken::is_cancelled)
|
||||
{
|
||||
ReviewDecision::Abort
|
||||
} else {
|
||||
ReviewDecision::Approved
|
||||
};
|
||||
}
|
||||
let requires_synchronous_review = options.require_synchronous_review
|
||||
|| reasons.retry.is_some()
|
||||
|| matches!(
|
||||
|
||||
Reference in new issue
Block a user