From 8ba4ae3bf3bd1fa57e25ee5b63dd8ee29f0bd8be Mon Sep 17 00:00:00 2001 From: Qiyao Qin Date: Fri, 13 Mar 2026 14:03:11 -0700 Subject: [PATCH] add AcceptWithOverrideCommand in availableDecisions --- codex-rs/core/src/codex.rs | 1 + codex-rs/protocol/src/approvals.rs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 4aaa1df28c..6b970b73a6 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -2877,6 +2877,7 @@ impl Session { }); let available_decisions = available_decisions.unwrap_or_else(|| { ExecApprovalRequestEvent::default_available_decisions( + &command, network_approval_context.as_ref(), proposed_execpolicy_amendment.as_ref(), proposed_network_policy_amendments.as_deref(), diff --git a/codex-rs/protocol/src/approvals.rs b/codex-rs/protocol/src/approvals.rs index 848ea31c02..9a379a82c4 100644 --- a/codex-rs/protocol/src/approvals.rs +++ b/codex-rs/protocol/src/approvals.rs @@ -208,6 +208,7 @@ impl ExecApprovalRequestEvent { match &self.available_decisions { Some(decisions) => decisions.clone(), None => Self::default_available_decisions( + &self.command, self.network_approval_context.as_ref(), self.proposed_execpolicy_amendment.as_ref(), self.proposed_network_policy_amendments.as_deref(), @@ -217,6 +218,7 @@ impl ExecApprovalRequestEvent { } pub fn default_available_decisions( + command: &[String], network_approval_context: Option<&NetworkApprovalContext>, proposed_execpolicy_amendment: Option<&ExecPolicyAmendment>, proposed_network_policy_amendments: Option<&[NetworkPolicyAmendment]>, @@ -238,10 +240,21 @@ impl ExecApprovalRequestEvent { } if additional_permissions.is_some() { - return vec![ReviewDecision::Approved, ReviewDecision::Abort]; + return vec![ + ReviewDecision::Approved, + ReviewDecision::ApprovedOverrideCommand { + command: command.to_vec(), + }, + ReviewDecision::Abort, + ]; } - let mut decisions = vec![ReviewDecision::Approved]; + let mut decisions = vec![ + ReviewDecision::Approved, + ReviewDecision::ApprovedOverrideCommand { + command: command.to_vec(), + }, + ]; if let Some(prefix) = proposed_execpolicy_amendment { decisions.push(ReviewDecision::ApprovedExecpolicyAmendment { proposed_execpolicy_amendment: prefix.clone(),