mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Route escalated commands through synchronous Guardian review (#40005)
## Why Commands requesting `sandbox_permissions=require_escalated` need a full Guardian review even when they are not marked as retries. ## What changed - Treat escalated command requests, along with retries, as requiring synchronous Guardian review. - Bypass extension approval and Guardian V2 shortcuts for these requests. ## Testing Add an integration test that installs an auto-approving extension and verifies that an escalated command still reaches Guardian and honors its denial. GitOrigin-RevId: 30eed273460f3c3c6b24d1ce2d29889e34513afd
This commit is contained in:
1 parent
ad9e8097fd
commit
dbe9dac1ae
3 files changed
+134
-5
No files matched your search
@@ -319,14 +319,23 @@ async fn run_guardian_review(
|
||||
options: GuardianReviewOptions,
|
||||
) -> ReviewDecision {
|
||||
let turn = Arc::clone(context.turn());
|
||||
// Required models must use Guardian, but an enabled V2 monitor can satisfy the review.
|
||||
let requires_synchronous_review = reasons.retry.is_some()
|
||||
|| matches!(
|
||||
&request,
|
||||
GuardianApprovalRequest::ExecCommand {
|
||||
sandbox_permissions,
|
||||
..
|
||||
} if sandbox_permissions.requires_escalated_permissions()
|
||||
);
|
||||
// Guardian V2 may satisfy ordinary reviews, including required-model reviews, but broader
|
||||
// permission requests and retries must run Guardian synchronously.
|
||||
if (!turn
|
||||
.config
|
||||
.config_layer_stack
|
||||
.requirements()
|
||||
.auto_review_required_for_model(&turn.model_info.slug)
|
||||
|| turn.config.features.enabled(Feature::GuardianV2))
|
||||
&& reasons.retry.is_none()
|
||||
&& !requires_synchronous_review
|
||||
&& options
|
||||
.external_cancel
|
||||
.as_ref()
|
||||
|
||||
Reference in new issue
Block a user