mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Read approval policy from the current turn configuration (#36912)
## Why Thread settings can update the approval policy after a turn context is created. Keeping a separate copy on `TurnContext` could leave tool approval checks using the previous policy. ## What changed - Remove the duplicated approval-policy field from `TurnContext`. - Resolve the policy through the turn's current configuration everywhere it is needed, including tool execution, Guardian routing, MCP handling, and permission requests. ## Testing - Update the shell escalation test to apply a thread-level policy override and verify that the next turn rejects an escalation using the updated policy. GitOrigin-RevId: e5966ba08f179d53fd76871ad904762958c0f5ea
This commit is contained in:
1 parent
ee46c5ba0e
commit
6a828ca26f
25 files changed
+119
-89
No files matched your search
@@ -179,7 +179,7 @@ pub(crate) fn routes_approval_to_guardian_with_reviewer(
|
||||
turn: &TurnContext,
|
||||
approvals_reviewer: ApprovalsReviewer,
|
||||
) -> bool {
|
||||
routes_approval_policy_to_guardian(turn.approval_policy.value(), approvals_reviewer)
|
||||
routes_approval_policy_to_guardian(turn.approval_policy(), approvals_reviewer)
|
||||
}
|
||||
|
||||
/// Whether an exact approval policy and reviewer should route through Guardian.
|
||||
|
||||
@@ -1242,7 +1242,9 @@ async fn routes_approval_to_guardian_allows_granular_review_policy() {
|
||||
let mut config = (*turn.config).clone();
|
||||
config.approvals_reviewer = ApprovalsReviewer::AutoReview;
|
||||
turn.config = Arc::new(config);
|
||||
turn.approval_policy
|
||||
Arc::make_mut(&mut turn.config)
|
||||
.permissions
|
||||
.approval_policy
|
||||
.set(AskForApproval::Granular(GranularApprovalConfig {
|
||||
sandbox_approval: true,
|
||||
rules: true,
|
||||
|
||||
Reference in new issue
Block a user