diff --git a/apps/aether-gateway/src/ai_serving/planner/standard/codex/tests.rs b/apps/aether-gateway/src/ai_serving/planner/standard/codex/tests.rs index 860da8b16..52b3ef76f 100644 --- a/apps/aether-gateway/src/ai_serving/planner/standard/codex/tests.rs +++ b/apps/aether-gateway/src/ai_serving/planner/standard/codex/tests.rs @@ -504,8 +504,8 @@ fn projects_uuid_prompt_cache_identity_into_missing_session_headers() { ); assert_eq!(headers.get("x-client-request-id"), None); assert_eq!( - headers.get("user-agent"), - Some(&"codex_cli_rs/0.153.3".to_string()) + headers.get("user-agent").map(String::as_str), + Some(aether_ai_formats::CODEX_CLIENT_USER_AGENT) ); assert_eq!(headers.get("originator"), Some(&"codex_cli_rs".to_string())); assert!(!headers.contains_key("version")); @@ -614,8 +614,8 @@ fn injects_only_codex_client_headers_for_images_requests() { Some(&"acc-123".to_string()) ); assert_eq!( - headers.get("user-agent"), - Some(&"codex_cli_rs/0.153.3".to_string()) + headers.get("user-agent").map(String::as_str), + Some(aether_ai_formats::CODEX_CLIENT_USER_AGENT) ); assert_eq!(headers.get("originator"), Some(&"codex_cli_rs".to_string())); assert!(!headers.contains_key("version")); @@ -698,8 +698,8 @@ fn preserves_client_context_headers_and_enforces_codex_provider_identity() { Some(&"kept-by-rule-request".to_string()) ); assert_eq!( - headers.get("user-agent"), - Some(&"codex_cli_rs/0.153.3".to_string()) + headers.get("user-agent").map(String::as_str), + Some(aether_ai_formats::CODEX_CLIENT_USER_AGENT) ); assert_eq!(headers.get("originator"), Some(&"codex_cli_rs".to_string())); assert_eq!( @@ -762,8 +762,8 @@ fn compact_projects_uuid_prompt_cache_identity_into_session_headers() { ); assert_eq!(headers.get("x-client-request-id"), None); assert_eq!( - headers.get("user-agent"), - Some(&"codex_cli_rs/0.153.3".to_string()) + headers.get("user-agent").map(String::as_str), + Some(aether_ai_formats::CODEX_CLIENT_USER_AGENT) ); assert_eq!(headers.get("originator"), Some(&"codex_cli_rs".to_string())); assert!(!headers.contains_key("version")); diff --git a/apps/aether-gateway/src/tests/ai_execute/stream/image.rs b/apps/aether-gateway/src/tests/ai_execute/stream/image.rs index b090f56f0..1b76e7cff 100644 --- a/apps/aether-gateway/src/tests/ai_execute/stream/image.rs +++ b/apps/aether-gateway/src/tests/ai_execute/stream/image.rs @@ -421,7 +421,7 @@ async fn gateway_executes_codex_image_stream_via_local_decision_gate_after_oauth ); assert_eq!( seen_execution_runtime_request.headers["user-agent"], - "codex_cli_rs/0.153.3" + aether_ai_formats::CODEX_CLIENT_USER_AGENT ); assert_eq!( seen_execution_runtime_request.headers["originator"], diff --git a/apps/aether-gateway/src/tests/ai_execute/sync/image.rs b/apps/aether-gateway/src/tests/ai_execute/sync/image.rs index 43409318a..921e33eea 100644 --- a/apps/aether-gateway/src/tests/ai_execute/sync/image.rs +++ b/apps/aether-gateway/src/tests/ai_execute/sync/image.rs @@ -1119,7 +1119,7 @@ async fn gateway_executes_codex_image_sync_via_local_decision_gate_after_oauth_r ); assert_eq!( seen_execution_runtime_request.headers["user-agent"], - "codex_cli_rs/0.153.3" + aether_ai_formats::CODEX_CLIENT_USER_AGENT ); assert_eq!( seen_execution_runtime_request.headers["originator"], diff --git a/apps/aether-gateway/src/tests/control/admin/provider_query.rs b/apps/aether-gateway/src/tests/control/admin/provider_query.rs index 2535c9cdc..82af4621c 100644 --- a/apps/aether-gateway/src/tests/control/admin/provider_query.rs +++ b/apps/aether-gateway/src/tests/control/admin/provider_query.rs @@ -558,7 +558,10 @@ async fn gateway_recovers_codex_slug_only_models_from_a_stale_legacy_cache_impl( .expect("mutex should lock") += 1; assert_eq!( plan.url, - "https://chatgpt.com/backend-api/codex/models?client_version=0.153.3" + format!( + "https://chatgpt.com/backend-api/codex/models?client_version={}", + aether_ai_formats::CODEX_CLIENT_VERSION + ) ); assert_eq!( plan.headers.get("user-agent").map(String::as_str), @@ -759,7 +762,10 @@ async fn gateway_handles_admin_provider_query_models_falls_back_to_codex_preset_ .expect("mutex should lock") += 1; assert_eq!( plan.url, - "https://chatgpt.com/backend-api/codex/models?client_version=0.153.3" + format!( + "https://chatgpt.com/backend-api/codex/models?client_version={}", + aether_ai_formats::CODEX_CLIENT_VERSION + ) ); Json(json!({ "request_id": "req-provider-query-codex-invalidated", diff --git a/crates/aether-ai/formats/src/formats/openai/responses/codex.rs b/crates/aether-ai/formats/src/formats/openai/responses/codex.rs index 5aa99bd1a..919b7f659 100644 --- a/crates/aether-ai/formats/src/formats/openai/responses/codex.rs +++ b/crates/aether-ai/formats/src/formats/openai/responses/codex.rs @@ -36,8 +36,8 @@ const CODEX_OPENAI_RESPONSES_COMPACT_BODY_FIELDS: &[&str] = &[ "prompt_cache_key", "text", ]; -pub const CODEX_CLIENT_VERSION: &str = "0.153.3"; -pub const CODEX_CLIENT_USER_AGENT: &str = "codex_cli_rs/0.153.3"; +pub const CODEX_CLIENT_VERSION: &str = "0.153.4"; +pub const CODEX_CLIENT_USER_AGENT: &str = "codex_cli_rs/0.153.4"; pub const CODEX_CLIENT_ORIGINATOR: &str = "codex_cli_rs"; pub const CODEX_OPENAI_IMAGE_INTERNAL_MODEL: &str = "gpt-5.4-mini"; pub const CODEX_OPENAI_IMAGE_DEFAULT_MODEL: &str = "gpt-image-2"; @@ -2194,11 +2194,19 @@ mod tests { parse_codex_auth_identity, project_codex_catalog_model_card, resolve_codex_responses_model_capabilities, validate_codex_openai_responses_compact_request_contract, CODEX_CLIENT_ORIGINATOR, - CODEX_CLIENT_USER_AGENT, CODEX_OPENAI_IMAGE_INTERNAL_MODEL, + CODEX_CLIENT_USER_AGENT, CODEX_CLIENT_VERSION, CODEX_OPENAI_IMAGE_INTERNAL_MODEL, CODEX_OPENAI_RESPONSES_UNSUPPORTED_BODY_FIELDS, CODEX_RESPONSES_LITE_HEADER, }; use serde_json::{json, Value}; + #[test] + fn codex_client_user_agent_matches_originator_and_version() { + assert_eq!( + CODEX_CLIENT_USER_AGENT, + format!("{CODEX_CLIENT_ORIGINATOR}/{CODEX_CLIENT_VERSION}") + ); + } + #[test] fn model_card_drives_unknown_codex_model_body_and_header_contracts() { let card = json!({ diff --git a/crates/aether-model-fetch/src/logic.rs b/crates/aether-model-fetch/src/logic.rs index aec75836a..9b8523921 100644 --- a/crates/aether-model-fetch/src/logic.rs +++ b/crates/aether-model-fetch/src/logic.rs @@ -1345,7 +1345,10 @@ mod tests { "https://chatgpt.com/backend-api/codex" ), Some(( - "https://chatgpt.com/backend-api/codex/models?client_version=0.153.3".to_string(), + format!( + "https://chatgpt.com/backend-api/codex/models?client_version={}", + aether_ai_formats::CODEX_CLIENT_VERSION + ), "openai:responses".to_string() )) ); diff --git a/crates/aether-model-fetch/src/transport.rs b/crates/aether-model-fetch/src/transport.rs index 8752cf93a..dc1e29b88 100644 --- a/crates/aether-model-fetch/src/transport.rs +++ b/crates/aether-model-fetch/src/transport.rs @@ -991,7 +991,10 @@ mod tests { assert_eq!( plan.url, - "https://chatgpt.com/backend-api/codex/models?client_version=0.153.3" + format!( + "https://chatgpt.com/backend-api/codex/models?client_version={}", + aether_ai_formats::CODEX_CLIENT_VERSION + ) ); assert_eq!( plan.headers.get("authorization").map(String::as_str),