Wire native voice dependencies into full Rust CI (#58719)

## What changed

- Build native voice SDK and runtime artifacts with Bazel for Linux GNU, macOS, and Windows on x64 and ARM64, then configure Cargo jobs to consume them. Keep musl builds in a separate job without these inputs.
- Validate artifact receipts against the target, source commit, and source manifest; verify SDK file hashes and relocate pkg-config metadata. Package the runtime and plugins with nextest archives and restore `CODEX_TEST_VOICE_RUNTIME` when running shards.
- Prepare native Windows voice tools for argument-comment linting and install ARM64 DotSlash on Windows ARM64. Reduce archive disk usage, bound Linux ARM64 build concurrency, and correct the JUnit artifact path.
- Recognize TLS errors wrapped directly in `io::Error`. Make TLS fallback fixtures select the native backend explicitly, allow the MCP test server's non-loopback address, and isolate skill-root tests from ancestor Git markers. Install `git` in remote test containers and filter MCP discovery assertions to POST requests.

## Testing

Add tests for relocated voice inputs, Windows ARM64 import libraries with host-native pkgconf, and rejection of mismatched receipts or corrupt SDK files. Extend untrusted-certificate coverage to an explicitly selected rustls backend.

GitOrigin-RevId: da3ff690b94906edc1f8f60a3c7feda1bf66134a
This commit is contained in:
Benjamin Carlsson
2026-11-01 15:50:50 +00:00
committed by copyberry
parent 8c811e8d93
commit e02a32cd51
17 changed files with 748 additions and 47 deletions
@@ -110,13 +110,6 @@ impl RouteAwareRequestError {
if self.status() == Some(StatusCode::PROXY_AUTHENTICATION_REQUIRED) {
return Some(RouteFailureClass::ProxyAuthenticationRequired);
}
if let Self::Route(RouteAwareClientPoolError::Resolve(error)) = self
&& let Some(source) = error.get_ref()
&& source.is::<rustls::Error>()
{
return Some(RouteFailureClass::TlsError);
}
let mut source: Option<&(dyn std::error::Error + 'static)> = Some(self);
while let Some(error) = source {
if error.downcast_ref::<rustls::Error>().is_some()
@@ -127,7 +120,14 @@ impl RouteAwareRequestError {
if error.to_string() == "tunnel error: proxy authorization required" {
return Some(RouteFailureClass::ProxyAuthenticationRequired);
}
source = error.source();
// io::Error::source skips its inner error, which may itself be the TLS error.
source = match error
.downcast_ref::<io::Error>()
.and_then(io::Error::get_ref)
{
Some(inner) => Some(inner),
None => error.source(),
};
}
match self {
@@ -227,6 +227,15 @@ async fn direct_and_routed_clients_build_equivalent_requests() {
#[tokio::test]
async fn request_failures_classify_real_untrusted_certificate_handshakes() {
assert_untrusted_certificate_classified(HttpClientBuilder::new()).await;
}
#[tokio::test]
async fn request_failures_classify_real_untrusted_rustls_certificate_handshakes() {
assert_untrusted_certificate_classified(HttpClientBuilder::new().with_rustls_tls()).await;
}
async fn assert_untrusted_certificate_classified(client_builder: HttpClientBuilder) {
codex_utils_rustls_provider::ensure_rustls_crypto_provider();
let certificate = rcgen::generate_simple_self_signed(vec!["localhost".to_string()])
.expect("self-signed certificate should generate");
@@ -252,9 +261,10 @@ async fn request_failures_classify_real_untrusted_certificate_handshakes() {
.expect("TLS server connection should be created");
let _ = connection.complete_io(&mut stream);
});
let pool = RouteAwareClientPool::new_without_request_logging(
let pool = RouteAwareClientPool::with_builder(
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
ClientRouteClass::Api,
client_builder.without_request_logging(),
);
let mut request = reqwest::Request::new(
@@ -29,6 +29,13 @@ use crate::tls_backend_fallback::should_retry_with_rustls;
const PROTOCOL_VERSION_TLS_ALERT: &[u8] = &[21, 3, 3, 0, 2, 2, 70];
// Schannel ARM needs TLS 1.1 to expose the protocol-version alert; the x64 CI image
// disables TLS 1.1, so x64 and other platforms retain TLS 1.2.
#[cfg(all(windows, target_arch = "aarch64"))]
const NATIVE_TLS_TEST_VERSION: reqwest::tls::Version = reqwest::tls::Version::TLS_1_1;
#[cfg(not(all(windows, target_arch = "aarch64")))]
const NATIVE_TLS_TEST_VERSION: reqwest::tls::Version = reqwest::tls::Version::TLS_1_2;
type SuccessfulTlsFallbackServer = (
String,
TransportClient,
@@ -44,6 +51,7 @@ async fn default_pool_does_not_retry_a_native_tls_protocol_failure() {
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
ClientRouteClass::Other,
);
use_native_tls_for_direct_route(&pool);
let request = reqwest::Request::new(
Method::POST,
reqwest::Url::parse(&url).expect("valid HTTPS URL"),
@@ -75,6 +83,7 @@ async fn retries_a_native_tls_protocol_failure_once_with_rustls() {
ClientRouteClass::Other,
)
.with_tls_backend_fallback();
use_native_tls_for_direct_route(&pool);
let destination = reqwest::Url::parse(&url).expect("valid HTTPS URL");
let mut request = reqwest::Request::new(Method::POST, destination.clone());
*request.body_mut() = Some(Bytes::from_static(b"mcp-initialize").into());
@@ -116,6 +125,7 @@ async fn retries_a_native_tls_failure_after_another_request_caches_rustls() {
ClientRouteClass::Other,
)
.with_tls_backend_fallback();
use_native_tls_for_direct_route(&pool);
let destination = reqwest::Url::parse(&url).expect("valid HTTPS URL");
let (route, native_client, selected_tls_backend) = pool
.client_for_url_with_resolver(destination.as_str(), |_| async {
@@ -211,6 +221,7 @@ async fn successful_rustls_fallback_replays_the_request_and_reuses_the_destinati
ClientRouteClass::Other,
)
.with_tls_backend_fallback();
use_native_tls_for_direct_route(&pool);
let destination = reqwest::Url::parse(&url).expect("valid HTTPS URL");
let existing_destination =
reqwest::Url::parse("https://another-mcp.example.com/mcp").expect("valid HTTPS URL");
@@ -276,6 +287,7 @@ async fn retries_a_tls_protocol_failure_when_request_url_contains_certificate_ma
ClientRouteClass::Other,
)
.with_tls_backend_fallback();
use_native_tls_for_direct_route(&pool);
let mut destination = reqwest::Url::parse(&url).expect("valid HTTPS URL");
destination.set_path("/certificate/hostname/expired/revoked/mcp");
let request = reqwest::Request::new(Method::POST, destination);
@@ -307,6 +319,7 @@ async fn does_not_retry_a_non_replayable_streaming_request() {
ClientRouteClass::Other,
)
.with_tls_backend_fallback();
use_native_tls_for_direct_route(&pool);
let mut request = reqwest::Request::new(
Method::POST,
reqwest::Url::parse(&url).expect("valid HTTPS URL"),
@@ -341,6 +354,20 @@ async fn does_not_retry_a_non_replayable_streaming_request() {
);
}
fn use_native_tls_for_direct_route(pool: &RouteAwareClientPool) {
// Start with reqwest's default native backend even when the environment supplies a CA bundle.
let client = reqwest::Client::builder()
.no_proxy()
.min_tls_version(NATIVE_TLS_TEST_VERSION)
.max_tls_version(NATIVE_TLS_TEST_VERSION)
.build()
.expect("native TLS client should build");
pool.clients.lock().expect("client cache lock").insert(
OutboundProxyRoute::Direct,
TransportClient::new(client, RequestLogging::Enabled, http::HeaderMap::new()),
);
}
fn spawn_successful_tls_fallback_server() -> io::Result<SuccessfulTlsFallbackServer> {
codex_utils_rustls_provider::ensure_rustls_crypto_provider();
let CertifiedKey { cert, signing_key } =