From 2c43c6d71d6bc350587cd3147b44b83e9ccbfc7e Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Sun, 22 Mar 2026 01:12:48 -0700 Subject: [PATCH] codex: fix Bazel test failure on PR #15439 Co-authored-by: Codex --- .../core/src/guardian/approval_request.rs | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/codex-rs/core/src/guardian/approval_request.rs b/codex-rs/core/src/guardian/approval_request.rs index 652d2579e5..1ca808daa6 100644 --- a/codex-rs/core/src/guardian/approval_request.rs +++ b/codex-rs/core/src/guardian/approval_request.rs @@ -264,15 +264,7 @@ pub(crate) fn guardian_approval_request_to_json( ("host".to_string(), Value::String(host.clone())), ( "protocol".to_string(), - Value::String( - match protocol { - NetworkApprovalProtocol::Http => "Http", - NetworkApprovalProtocol::Https => "Https", - NetworkApprovalProtocol::Socks5Tcp => "Socks5Tcp", - NetworkApprovalProtocol::Socks5Udp => "Socks5Udp", - } - .to_string(), - ), + network_approval_protocol_value(protocol), ), ("port".to_string(), Value::from(*port)), ]); @@ -360,15 +352,7 @@ pub(crate) fn guardian_assessment_action_value(action: &GuardianApprovalRequest) ("host".to_string(), Value::String(host.clone())), ( "protocol".to_string(), - Value::String( - match protocol { - NetworkApprovalProtocol::Http => "Http", - NetworkApprovalProtocol::Https => "Https", - NetworkApprovalProtocol::Socks5Tcp => "Socks5Tcp", - NetworkApprovalProtocol::Socks5Udp => "Socks5Udp", - } - .to_string(), - ), + network_approval_protocol_value(protocol), ), ("port".to_string(), Value::from(*port)), ]); @@ -390,6 +374,18 @@ pub(crate) fn guardian_assessment_action_value(action: &GuardianApprovalRequest) } } +fn network_approval_protocol_value(protocol: &NetworkApprovalProtocol) -> Value { + Value::String( + match protocol { + NetworkApprovalProtocol::Http => "http", + NetworkApprovalProtocol::Https => "https", + NetworkApprovalProtocol::Socks5Tcp => "socks5_tcp", + NetworkApprovalProtocol::Socks5Udp => "socks5_udp", + } + .to_string(), + ) +} + pub(crate) fn guardian_request_id(request: &GuardianApprovalRequest) -> &str { match request { GuardianApprovalRequest::Shell { id, .. }