mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Use issuing step settings for approval decisions (#40821)
## Why Tool actions and approval retries can outlive the step that issued them. If approval handling reads newer turn settings, a delayed action can use the wrong approval policy or reviewer. ## What changed - Capture the approval policy and reviewer in `GuardianReviewContext` from the issuing step. - Use step settings for command, patch, permission, sandbox-retry, and remote-network approval decisions. - Use the active task's published settings for background network approvals and long-lived Unix shell interception. - Preserve explicit MCP reviewer overrides. ## Testing Added regression coverage for permission requests, same-turn network policy changes, delayed commands after a new turn starts, sandbox retries, patch policy selection, and MCP reviewer overrides. GitOrigin-RevId: b7e84a2e1e79a71502272b15b5ef5b0e5643f8b0
This commit is contained in:
1 parent
21c58c90f2
commit
a26f1806a4
16 files changed
+671
-60
No files matched your search
@@ -14,7 +14,6 @@ use crate::hook_runtime::run_permission_request_hooks;
|
||||
use crate::mcp_tool_call::request_mcp_tool_user_approval;
|
||||
use crate::sandboxing::SandboxPermissions;
|
||||
use crate::session::session::Session;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use crate::tools::hook_names::HookToolName;
|
||||
use crate::tools::runtimes::apply_patch::ApplyPatchApprovalKey;
|
||||
use crate::tools::runtimes::unified_exec::UnifiedExecApprovalKey;
|
||||
@@ -377,10 +376,6 @@ enum ApprovalReviewer {
|
||||
}
|
||||
|
||||
impl ApprovalReviewer {
|
||||
fn for_turn(turn: &TurnContext) -> Self {
|
||||
Self::for_policy(turn.approval_policy(), turn.config.approvals_reviewer)
|
||||
}
|
||||
|
||||
fn for_policy(approval_policy: AskForApproval, reviewer: ApprovalsReviewer) -> Self {
|
||||
if routes_approval_policy_to_guardian(approval_policy, reviewer) {
|
||||
Self::Guardian
|
||||
@@ -515,7 +510,10 @@ impl Session {
|
||||
{
|
||||
ApprovalReviewer::for_policy(*approval_policy, *reviewer)
|
||||
} else {
|
||||
ApprovalReviewer::for_turn(ctx.review_context.turn())
|
||||
ApprovalReviewer::for_policy(
|
||||
ctx.review_context.approval_policy,
|
||||
ctx.review_context.approvals_reviewer,
|
||||
)
|
||||
};
|
||||
|
||||
let decision = match reviewer {
|
||||
|
||||
Reference in new issue
Block a user