From 04808fa86c14a143d9e2cc76b7ccbc1bb066f03d Mon Sep 17 00:00:00 2001 From: Matthew Zeng Date: Wed, 18 Mar 2026 22:57:16 -0700 Subject: [PATCH] update --- codex-rs/core/src/codex_delegate.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/codex-rs/core/src/codex_delegate.rs b/codex-rs/core/src/codex_delegate.rs index e560cd9c7f..d0cca768c6 100644 --- a/codex-rs/core/src/codex_delegate.rs +++ b/codex-rs/core/src/codex_delegate.rs @@ -42,8 +42,6 @@ use crate::error::CodexErr; use crate::guardian::GuardianApprovalRequest; use crate::guardian::review_approval_request_with_cancel; use crate::guardian::routes_approval_to_guardian; -use crate::mcp_tool_call::MCP_TOOL_APPROVAL_ACCEPT; -use crate::mcp_tool_call::MCP_TOOL_APPROVAL_ACCEPT_FOR_SESSION; use crate::mcp_tool_call::MCP_TOOL_APPROVAL_DECLINE_SYNTHETIC; use crate::mcp_tool_call::build_guardian_mcp_tool_review_request; use crate::mcp_tool_call::is_mcp_tool_approval_question_id; @@ -693,15 +691,22 @@ async fn maybe_auto_review_mcp_request_user_input( .options .as_ref() .and_then(|options| { - options - .iter() - .find(|option| option.label == MCP_TOOL_APPROVAL_ACCEPT_FOR_SESSION) + if options.len() > 2 { + options.get(1) + } else { + options.first() + } }) .map(|option| option.label.clone()) - .unwrap_or_else(|| MCP_TOOL_APPROVAL_ACCEPT.to_string()), + .unwrap_or_default(), ReviewDecision::Approved | ReviewDecision::ApprovedExecpolicyAmendment { .. } - | ReviewDecision::NetworkPolicyAmendment { .. } => MCP_TOOL_APPROVAL_ACCEPT.to_string(), + | ReviewDecision::NetworkPolicyAmendment { .. } => question + .options + .as_ref() + .and_then(|options| options.first()) + .map(|option| option.label.clone()) + .unwrap_or_default(), ReviewDecision::Denied | ReviewDecision::Abort => { MCP_TOOL_APPROVAL_DECLINE_SYNTHETIC.to_string() }