add AcceptWithOverrideCommand in availableDecisions

This commit is contained in:
Qiyao Qin
2026-03-13 14:03:11 -07:00
parent 4c5d2f4f07
commit 8ba4ae3bf3
2 changed files with 16 additions and 2 deletions

View File

@@ -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(),

View File

@@ -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(),