mirror of
https://github.com/openai/codex.git
synced 2026-11-16 14:55:43 +00:00
Preserve complete actions in Guardian approval reviews (#44569)
## Why Truncating action arguments can leave approval reviewers evaluating incomplete actions. Large actions need complete review input and explicit handling when they exceed the review budget. ## What changed - Remove action truncation and the fixed synchronous action byte limit. Admit complete actions against the whole-request budget, splitting long text losslessly into bounded transport parts and accounting for their framing. - Route actions exceeding the asynchronous action budget to synchronous review. Prevent cached scores from covering oversized calls, including expanded approval arguments, while allowing later small actions to recover score reuse. - Request user approval when optional review exhausts its local input budget. Keep required review and compaction service failures closed to approval, and retire exhausted review sessions. ## Testing Add coverage for complete large-action delivery, optional user fallback, required-review denial, subsequent review recovery, async overflow through MCP approval routing, and lossless text splitting with budget accounting. GitOrigin-RevId: 08f06e68a94b2f779480dd6b6cf5bc30b241f6dd
This commit is contained in:
1 parent
3319d9b296
commit
9c4879f3a5
33 files changed
+841
-547
No files matched your search
@@ -79,9 +79,6 @@ pub(crate) async fn decide_approval(
|
||||
.as_ref()
|
||||
.is_some_and(CancellationToken::is_cancelled)
|
||||
|| reasons.retry.is_some()
|
||||
|| request.request.as_ref().is_ok_and(|request| {
|
||||
super::approval_request::format_guardian_action_compact(request).is_err()
|
||||
})
|
||||
|| matches!(&request.request, Ok(GuardianApprovalRequest::ExecCommand { sandbox_permissions, .. })
|
||||
if sandbox_permissions.requires_escalated_permissions());
|
||||
let full_access = context.environments().has_full_access(
|
||||
@@ -115,7 +112,10 @@ pub(crate) async fn decide_approval(
|
||||
review_id: review_id.clone(),
|
||||
request: request.clone(),
|
||||
reasons,
|
||||
options,
|
||||
options: GuardianReviewOptions {
|
||||
require_guardian,
|
||||
..options
|
||||
},
|
||||
});
|
||||
let input = ApprovalDecisionInput {
|
||||
approval_id: &review_id,
|
||||
@@ -179,9 +179,7 @@ pub(crate) async fn decide_approval(
|
||||
record_guardian_non_denial(&session, turn_id).await;
|
||||
Some(ReviewDecision::Approved)
|
||||
}
|
||||
Some(ApprovalDecision::Allow) => {
|
||||
Some(runtime.review(GuardianReviewReason::FreshRequired).await)
|
||||
}
|
||||
Some(ApprovalDecision::Allow) => runtime.review(GuardianReviewReason::FreshRequired).await,
|
||||
Some(ApprovalDecision::AskUser) if !require_guardian => None,
|
||||
None if !require_guardian
|
||||
&& !super::review::routes_approval_policy_to_guardian(
|
||||
@@ -192,7 +190,7 @@ pub(crate) async fn decide_approval(
|
||||
None
|
||||
}
|
||||
None | Some(ApprovalDecision::AskUser) => {
|
||||
Some(runtime.review(GuardianReviewReason::Policy).await)
|
||||
runtime.review(GuardianReviewReason::Policy).await
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user