mirror of
https://github.com/openai/codex.git
synced 2026-09-14 11:57:03 +00:00
add AcceptWithOverrideCommand in availableDecisions
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user