diff --git a/codex-rs/app-server/src/message_processor.rs b/codex-rs/app-server/src/message_processor.rs index 6512b59d9a..6929eec073 100644 --- a/codex-rs/app-server/src/message_processor.rs +++ b/codex-rs/app-server/src/message_processor.rs @@ -166,25 +166,14 @@ fn app_server_attestation_provider( AttestationProvider::new(move || { let outgoing = outgoing.clone(); let attestation_connection_ids = attestation_connection_ids.clone(); - Box::pin(request_attestation_header_value( + Box::pin(request_attestation_header_value_with_timeout( outgoing, attestation_connection_ids, + ATTESTATION_GENERATE_TIMEOUT, )) }) } -async fn request_attestation_header_value( - outgoing: Arc, - attestation_connection_ids: Arc>>, -) -> Option { - request_attestation_header_value_with_timeout( - outgoing, - attestation_connection_ids, - ATTESTATION_GENERATE_TIMEOUT, - ) - .await -} - async fn request_attestation_header_value_with_timeout( outgoing: Arc, attestation_connection_ids: Arc>>, diff --git a/codex-rs/core/src/client_tests.rs b/codex-rs/core/src/client_tests.rs index bc278b4490..4bfa5b8a5a 100644 --- a/codex-rs/core/src/client_tests.rs +++ b/codex-rs/core/src/client_tests.rs @@ -518,35 +518,6 @@ fn model_client_with_counting_attestation() -> (ModelClient, Arc) { (model_client, attestation_calls) } -#[tokio::test] -async fn responses_generate_fresh_attestation_headers_for_chatgpt_codex() { - let provider = api_provider("https://chatgpt.com/backend-api/codex/"); - let (model_client, attestation_calls) = model_client_with_counting_attestation(); - let mut first_headers = http::HeaderMap::new(); - let mut second_headers = http::HeaderMap::new(); - - model_client - .extend_attestation_header_for(&mut first_headers, &provider) - .await; - model_client - .extend_attestation_header_for(&mut second_headers, &provider) - .await; - - assert_eq!( - first_headers - .get(crate::attestation::X_OAI_ATTESTATION_HEADER) - .and_then(|value| value.to_str().ok()), - Some("v1.header-1"), - ); - assert_eq!( - second_headers - .get(crate::attestation::X_OAI_ATTESTATION_HEADER) - .and_then(|value| value.to_str().ok()), - Some("v1.header-2"), - ); - assert_eq!(attestation_calls.load(Ordering::Relaxed), 2); -} - #[tokio::test] async fn websocket_handshake_includes_attestation_for_chatgpt_codex_responses() { let provider = api_provider("https://chatgpt.com/backend-api/codex/"); @@ -567,64 +538,6 @@ async fn websocket_handshake_includes_attestation_for_chatgpt_codex_responses() assert_eq!(attestation_calls.load(Ordering::Relaxed), 1); } -#[tokio::test] -async fn compact_generate_fresh_attestation_headers_for_chatgpt_codex() { - let provider = api_provider("https://chatgpt.com/backend-api/codex/"); - let (model_client, attestation_calls) = model_client_with_counting_attestation(); - let mut first_headers = http::HeaderMap::new(); - let mut second_headers = http::HeaderMap::new(); - - model_client - .extend_attestation_header_for(&mut first_headers, &provider) - .await; - model_client - .extend_attestation_header_for(&mut second_headers, &provider) - .await; - - assert_eq!( - first_headers - .get(crate::attestation::X_OAI_ATTESTATION_HEADER) - .and_then(|value| value.to_str().ok()), - Some("v1.header-1"), - ); - assert_eq!( - second_headers - .get(crate::attestation::X_OAI_ATTESTATION_HEADER) - .and_then(|value| value.to_str().ok()), - Some("v1.header-2"), - ); - assert_eq!(attestation_calls.load(Ordering::Relaxed), 2); -} - -#[tokio::test] -async fn realtime_setup_generate_fresh_attestation_headers_for_chatgpt_codex() { - let provider = api_provider("https://chatgpt.com/backend-api/codex/"); - let (model_client, attestation_calls) = model_client_with_counting_attestation(); - let mut first_headers = http::HeaderMap::new(); - let mut second_headers = http::HeaderMap::new(); - - model_client - .extend_attestation_header_for(&mut first_headers, &provider) - .await; - model_client - .extend_attestation_header_for(&mut second_headers, &provider) - .await; - - assert_eq!( - first_headers - .get(crate::attestation::X_OAI_ATTESTATION_HEADER) - .and_then(|value| value.to_str().ok()), - Some("v1.header-1"), - ); - assert_eq!( - second_headers - .get(crate::attestation::X_OAI_ATTESTATION_HEADER) - .and_then(|value| value.to_str().ok()), - Some("v1.header-2"), - ); - assert_eq!(attestation_calls.load(Ordering::Relaxed), 2); -} - #[tokio::test] async fn non_chatgpt_codex_endpoints_omit_attestation_generation() { let provider = api_provider("https://api.openai.com/v1");