clean up legacy openai cli adapter names

This commit is contained in:
fawney19
2026-04-26 21:12:57 +08:00
parent 5b914aa78c
commit ea3dc3257e
47 changed files with 412 additions and 572 deletions

View File

@@ -585,7 +585,7 @@ async fn gateway_locally_denies_claude_messages_stream_after_execution_runtime_m
}
#[tokio::test]
async fn gateway_locally_denies_openai_compact_after_execution_runtime_miss_without_control_execute_opt_in(
async fn gateway_locally_denies_openai_responses_compact_after_execution_runtime_miss_without_control_execute_opt_in(
) {
assert_ai_route_locally_denied_after_execution_runtime_miss(
"/v1/responses/compact",
@@ -599,7 +599,7 @@ async fn gateway_locally_denies_openai_compact_after_execution_runtime_miss_with
}
#[tokio::test]
async fn gateway_locally_denies_openai_compact_stream_after_execution_runtime_miss_without_control_execute_opt_in(
async fn gateway_locally_denies_openai_responses_compact_stream_after_execution_runtime_miss_without_control_execute_opt_in(
) {
assert_ai_route_locally_denied_after_execution_runtime_miss(
"/v1/responses/compact",

View File

@@ -26,8 +26,8 @@ use aether_data_contracts::repository::provider_catalog::{
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local_finalize_response()
{
async fn gateway_executes_openai_responses_compact_openai_family_upstream_stream_via_local_finalize_response(
) {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -56,7 +56,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:compact"])),
Some(serde_json::json!(["openai:responses:compact"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -67,7 +67,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:compact"])),
Some(serde_json::json!(["openai:responses:compact"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -81,7 +81,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-compact-finalize-local-1".to_string(),
endpoint_api_format: "openai:compact".to_string(),
endpoint_api_format: "openai:responses:compact".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("compact".to_string()),
endpoint_is_active: true,
@@ -89,11 +89,11 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
key_name: "prod".to_string(),
key_auth_type: "api_key".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:compact".to_string()]),
key_api_formats: Some(vec!["openai:responses:compact".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:compact": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses:compact": 1})),
model_id: "model-openai-compact-finalize-local-1".to_string(),
global_model_id: "global-model-openai-compact-finalize-local-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -103,7 +103,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:compact".to_string()]),
api_formats: Some(vec!["openai:responses:compact".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -136,7 +136,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
StoredProviderCatalogEndpoint::new(
"endpoint-openai-compact-finalize-local-1".to_string(),
"provider-openai-compact-finalize-local-1".to_string(),
"openai:compact".to_string(),
"openai:responses:compact".to_string(),
Some("openai".to_string()),
Some("compact".to_string()),
true,
@@ -168,7 +168,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:compact"])),
Some(serde_json::json!(["openai:responses:compact"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-compact-finalize",
@@ -176,7 +176,7 @@ async fn gateway_executes_openai_compact_openai_family_upstream_stream_via_local
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:compact": 1})),
Some(serde_json::json!({"openai:responses:compact": 1})),
None,
None,
None,

View File

@@ -26,7 +26,8 @@ use aether_data_contracts::repository::provider_catalog::{
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_openai_cli_cross_format_upstream_stream_via_local_finalize_response() {
async fn gateway_executes_openai_responses_cross_format_upstream_stream_via_local_finalize_response(
) {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -56,7 +57,7 @@ async fn gateway_executes_openai_cli_cross_format_upstream_stream_via_local_fina
true,
false,
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -67,7 +68,7 @@ async fn gateway_executes_openai_cli_cross_format_upstream_stream_via_local_fina
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -483,7 +484,7 @@ async fn gateway_executes_openai_cli_cross_format_upstream_stream_via_local_fina
}
#[tokio::test]
async fn gateway_executes_openai_cli_cross_format_function_call_upstream_stream_via_local_finalize_response(
async fn gateway_executes_openai_responses_cross_format_function_call_upstream_stream_via_local_finalize_response(
) {
use base64::Engine as _;
@@ -514,7 +515,7 @@ async fn gateway_executes_openai_cli_cross_format_function_call_upstream_stream_
true,
false,
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -525,7 +526,7 @@ async fn gateway_executes_openai_cli_cross_format_function_call_upstream_stream_
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -939,7 +940,7 @@ async fn gateway_executes_openai_cli_cross_format_function_call_upstream_stream_
}
#[tokio::test]
async fn gateway_executes_openai_cli_antigravity_cross_format_upstream_stream_via_local_finalize_response(
async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_stream_via_local_finalize_response(
) {
use base64::Engine as _;
@@ -984,7 +985,7 @@ async fn gateway_executes_openai_cli_antigravity_cross_format_upstream_stream_vi
true,
false,
Some(serde_json::json!(["openai", "antigravity"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -995,7 +996,7 @@ async fn gateway_executes_openai_cli_antigravity_cross_format_upstream_stream_vi
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "antigravity"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")

View File

@@ -26,7 +26,7 @@ use aether_data_contracts::repository::provider_catalog::{
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_response() {
async fn gateway_executes_openai_responses_sync_upstream_stream_via_local_finalize_response() {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -55,7 +55,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -66,7 +66,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -80,7 +80,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-cli-finalize-local-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -88,11 +88,11 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
key_name: "prod".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-openai-cli-finalize-local-1".to_string(),
global_model_id: "global-model-openai-cli-finalize-local-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -102,7 +102,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -135,7 +135,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
StoredProviderCatalogEndpoint::new(
"endpoint-openai-cli-finalize-local-1".to_string(),
"provider-openai-cli-finalize-local-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -167,7 +167,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-cli-finalize",
@@ -175,7 +175,7 @@ async fn gateway_executes_openai_cli_sync_upstream_stream_via_local_finalize_res
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,

View File

@@ -441,7 +441,7 @@ async fn gateway_executes_openai_chat_stream_via_local_decision_gate_without_exe
}
#[tokio::test]
async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_candidate() {
async fn gateway_executes_openai_chat_stream_via_local_openai_responses_cross_format_candidate() {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeStreamRequest {
trace_id: String,
@@ -499,7 +499,7 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-chat-cli-local-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -507,11 +507,11 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
key_name: "prod".to_string(),
key_auth_type: "api_key".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-openai-chat-cli-local-1".to_string(),
global_model_id: "global-model-openai-chat-cli-local-1".to_string(),
global_model_name: "gpt-5.4".to_string(),
@@ -521,7 +521,7 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5.4".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -554,7 +554,7 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
StoredProviderCatalogEndpoint::new(
"endpoint-openai-chat-cli-local-1".to_string(),
"provider-openai-chat-cli-local-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -584,7 +584,7 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-chat-cli",
@@ -592,7 +592,7 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,
@@ -909,7 +909,7 @@ async fn gateway_executes_openai_chat_stream_via_local_openai_cli_cross_format_c
assert_eq!(extra_data["execution_strategy"], "local_cross_format");
assert_eq!(extra_data["conversion_mode"], "bidirectional");
assert_eq!(extra_data["client_contract"], "openai:chat");
assert_eq!(extra_data["provider_contract"], "openai:cli");
assert_eq!(extra_data["provider_contract"], "openai:responses");
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
assert!(

View File

@@ -23,8 +23,8 @@ use aether_data_contracts::repository::provider_catalog::{
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_local_stream_decision()
{
async fn gateway_executes_openai_responses_compact_stream_via_local_decision_gate_with_local_stream_decision(
) {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeStreamRequest {
trace_id: String,
@@ -62,7 +62,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:compact"])),
Some(serde_json::json!(["openai:responses:compact"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -73,7 +73,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:compact"])),
Some(serde_json::json!(["openai:responses:compact"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -87,7 +87,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-compact-local-1".to_string(),
endpoint_api_format: "openai:compact".to_string(),
endpoint_api_format: "openai:responses:compact".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("compact".to_string()),
endpoint_is_active: true,
@@ -95,11 +95,11 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
key_name: "prod".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:compact".to_string()]),
key_api_formats: Some(vec!["openai:responses:compact".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:compact": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses:compact": 1})),
model_id: "model-openai-compact-local-1".to_string(),
global_model_id: "global-model-openai-compact-local-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -109,7 +109,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:compact".to_string()]),
api_formats: Some(vec!["openai:responses:compact".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -142,7 +142,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
StoredProviderCatalogEndpoint::new(
"endpoint-openai-compact-local-1".to_string(),
"provider-openai-compact-local-1".to_string(),
"openai:compact".to_string(),
"openai:responses:compact".to_string(),
Some("openai".to_string()),
Some("compact".to_string()),
true,
@@ -183,7 +183,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:compact"])),
Some(serde_json::json!(["openai:responses:compact"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-compact",
@@ -191,7 +191,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:compact": 1})),
Some(serde_json::json!({"openai:responses:compact": 1})),
None,
None,
Some(serde_json::json!({"enabled": true, "node_id":"proxy-node-openai-compact-local"})),
@@ -221,7 +221,7 @@ async fn gateway_executes_openai_compact_stream_via_local_decision_gate_with_loc
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "compact",
"auth_endpoint_signature": "openai:compact",
"auth_endpoint_signature": "openai:responses:compact",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-compact-local-123",

View File

@@ -65,7 +65,7 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
true,
false,
Some(serde_json::json!(["openai", "codex"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5.4"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -76,7 +76,7 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "codex"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5.4"])),
)
.expect("auth snapshot should build")
@@ -90,7 +90,7 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-codex-cli-stream-local-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -98,11 +98,11 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
key_name: "oauth".to_string(),
key_auth_type: "oauth".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-codex-cli-stream-local-1".to_string(),
global_model_id: "global-model-codex-cli-stream-local-1".to_string(),
global_model_name: "gpt-5.4".to_string(),
@@ -112,7 +112,7 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5.4".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -145,7 +145,7 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
StoredProviderCatalogEndpoint::new(
"endpoint-codex-cli-stream-local-1".to_string(),
"provider-codex-cli-stream-local-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -180,12 +180,12 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "__placeholder__")
.expect("placeholder api key should encrypt"),
Some(encrypted_auth_config),
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,
@@ -216,7 +216,7 @@ async fn gateway_executes_codex_cli_stream_via_local_decision_gate_after_oauth_r
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-codex-cli-stream-local-123",

View File

@@ -777,7 +777,7 @@ async fn gateway_marks_claude_cli_cross_format_runtime_miss_when_format_conversi
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-claude-cli-openai-local-miss-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -785,11 +785,11 @@ async fn gateway_marks_claude_cli_cross_format_runtime_miss_when_format_conversi
key_name: "codex".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-claude-cli-openai-local-miss-1".to_string(),
global_model_id: "global-model-claude-cli-openai-local-miss-1".to_string(),
global_model_name: "gpt-5.4".to_string(),
@@ -799,7 +799,7 @@ async fn gateway_marks_claude_cli_cross_format_runtime_miss_when_format_conversi
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5.4".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -832,7 +832,7 @@ async fn gateway_marks_claude_cli_cross_format_runtime_miss_when_format_conversi
StoredProviderCatalogEndpoint::new(
"endpoint-claude-cli-openai-local-miss-1".to_string(),
"provider-claude-cli-openai-local-miss-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -862,7 +862,7 @@ async fn gateway_marks_claude_cli_cross_format_runtime_miss_when_format_conversi
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-cli-local-miss",
@@ -870,7 +870,7 @@ async fn gateway_marks_claude_cli_cross_format_runtime_miss_when_format_conversi
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,

View File

@@ -27,7 +27,7 @@ use base64::Engine as _;
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_sync_decision() {
async fn gateway_executes_openai_responses_sync_via_local_decision_gate_with_local_sync_decision() {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeSyncRequest {
trace_id: String,
@@ -62,7 +62,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -73,7 +73,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -87,7 +87,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-cli-local-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -95,11 +95,11 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
key_name: "prod".to_string(),
key_auth_type: "api_key".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-openai-cli-local-1".to_string(),
global_model_id: "global-model-openai-cli-local-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -109,7 +109,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -142,7 +142,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
StoredProviderCatalogEndpoint::new(
"endpoint-openai-cli-local-1".to_string(),
"provider-openai-cli-local-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -182,12 +182,12 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "sk-upstream-openai-cli")
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
Some(serde_json::json!({"enabled": true, "node_id":"proxy-node-openai-cli-local"})),
@@ -217,7 +217,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-local-123",
@@ -542,7 +542,7 @@ async fn gateway_executes_openai_cli_sync_via_local_decision_gate_with_local_syn
}
#[tokio::test]
async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_sync() {
async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_responses_sync() {
fn hash_api_key(value: &str) -> String {
let mut hasher = Sha256::new();
hasher.update(value.as_bytes());
@@ -559,7 +559,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -570,7 +570,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -584,7 +584,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-cli-local-limit-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -592,11 +592,11 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
key_name: "prod".to_string(),
key_auth_type: "api_key".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-openai-cli-local-limit-1".to_string(),
global_model_id: "global-model-openai-cli-local-limit-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -606,7 +606,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -639,7 +639,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
StoredProviderCatalogEndpoint::new(
"endpoint-openai-cli-local-limit-1".to_string(),
"provider-openai-cli-local-limit-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -669,7 +669,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-cli-limit",
@@ -677,7 +677,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,
@@ -730,7 +730,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-local-limit-123",
@@ -924,7 +924,7 @@ async fn gateway_waits_for_api_key_concurrency_slot_then_executes_openai_cli_syn
}
#[tokio::test]
async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_openai_cli_sync() {
async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_openai_responses_sync() {
fn hash_api_key(value: &str) -> String {
let mut hasher = Sha256::new();
hasher.update(value.as_bytes());
@@ -941,7 +941,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -952,7 +952,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -966,7 +966,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-cli-local-timeout-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -974,11 +974,11 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
key_name: "prod".to_string(),
key_auth_type: "api_key".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-openai-cli-local-timeout-1".to_string(),
global_model_id: "global-model-openai-cli-local-timeout-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -988,7 +988,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -1021,7 +1021,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
StoredProviderCatalogEndpoint::new(
"endpoint-openai-cli-local-timeout-1".to_string(),
"provider-openai-cli-local-timeout-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -1051,7 +1051,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-cli-timeout",
@@ -1059,7 +1059,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,
@@ -1112,7 +1112,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-local-timeout-123",
@@ -1272,7 +1272,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
}
#[tokio::test]
async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
async fn gateway_returns_openai_responses_error_for_local_sync_failure() {
fn hash_api_key(value: &str) -> String {
let mut hasher = Sha256::new();
hasher.update(value.as_bytes());
@@ -1289,7 +1289,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -1300,7 +1300,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -1314,7 +1314,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-openai-cli-local-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -1322,11 +1322,11 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
key_name: "prod".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-openai-cli-local-1".to_string(),
global_model_id: "global-model-openai-cli-local-1".to_string(),
global_model_name: "gpt-5".to_string(),
@@ -1336,7 +1336,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5-upstream".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -1369,7 +1369,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
StoredProviderCatalogEndpoint::new(
"endpoint-openai-cli-local-1".to_string(),
"provider-openai-cli-local-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -1405,12 +1405,12 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "sk-upstream-openai-cli")
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
Some(serde_json::json!({"enabled": true, "node_id":"proxy-node-openai-cli-local"})),
@@ -1432,7 +1432,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-local-error-123",
@@ -1564,7 +1564,7 @@ async fn gateway_returns_openai_cli_error_for_local_sync_failure() {
}
#[tokio::test]
async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_sync_failure() {
async fn gateway_returns_openai_responses_error_for_local_cross_format_gemini_sync_failure() {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeSyncRequest {
trace_id: String,
@@ -1591,7 +1591,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_sync_fai
true,
false,
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -1602,7 +1602,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_sync_fai
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -1735,7 +1735,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_sync_fai
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-gemini-local-error-123",
@@ -1940,7 +1940,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_sync_fai
}
#[tokio::test]
async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_sync_failure() {
async fn gateway_returns_openai_responses_error_for_local_cross_format_claude_sync_failure() {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeSyncRequest {
trace_id: String,
@@ -1967,7 +1967,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_sync_fai
true,
false,
Some(serde_json::json!(["openai", "claude"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -1978,7 +1978,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_sync_fai
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "claude"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -2111,7 +2111,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_sync_fai
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-claude-local-error-123",
@@ -2316,7 +2316,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_sync_fai
}
#[tokio::test]
async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_chat_sync_failure() {
async fn gateway_returns_openai_responses_error_for_local_cross_format_claude_chat_sync_failure() {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeSyncRequest {
trace_id: String,
@@ -2343,7 +2343,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_chat_syn
true,
false,
Some(serde_json::json!(["openai", "claude"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -2354,7 +2354,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_chat_syn
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "claude"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -2487,7 +2487,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_chat_syn
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-claude-chat-local-error-123",
@@ -2695,7 +2695,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_claude_chat_syn
}
#[tokio::test]
async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_chat_sync_failure() {
async fn gateway_returns_openai_responses_error_for_local_cross_format_gemini_chat_sync_failure() {
#[derive(Debug, Clone)]
struct SeenExecutionRuntimeSyncRequest {
trace_id: String,
@@ -2722,7 +2722,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_chat_syn
true,
false,
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -2733,7 +2733,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_chat_syn
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "gemini"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5"])),
)
.expect("auth snapshot should build")
@@ -2866,7 +2866,7 @@ async fn gateway_returns_openai_cli_error_for_local_cross_format_gemini_chat_syn
"route_class": "ai_public",
"route_family": "openai",
"route_kind": "cli",
"auth_endpoint_signature": "openai:cli",
"auth_endpoint_signature": "openai:responses",
"execution_runtime_candidate": true,
"auth_context": {
"user_id": "user-openai-cli-gemini-chat-local-error-123",
@@ -3108,7 +3108,7 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
true,
false,
Some(serde_json::json!(["openai", "codex"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5.4"])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -3119,7 +3119,7 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
Some(5),
Some(4_102_444_800_i64),
Some(serde_json::json!(["openai", "codex"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!(["gpt-5.4"])),
)
.expect("auth snapshot should build")
@@ -3133,7 +3133,7 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-codex-cli-local-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -3141,11 +3141,11 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
key_name: "oauth".to_string(),
key_auth_type: "oauth".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-codex-cli-local-1".to_string(),
global_model_id: "global-model-codex-cli-local-1".to_string(),
global_model_name: "gpt-5.4".to_string(),
@@ -3155,7 +3155,7 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5.4".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -3188,7 +3188,7 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
StoredProviderCatalogEndpoint::new(
"endpoint-codex-cli-local-1".to_string(),
"provider-codex-cli-local-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -3223,12 +3223,12 @@ async fn gateway_executes_codex_cli_sync_via_local_decision_gate_after_oauth_ref
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "__placeholder__")
.expect("placeholder api key should encrypt"),
Some(encrypted_auth_config),
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,

View File

@@ -2127,8 +2127,8 @@ fn ai_pipeline_finalize_standard_sync_products_are_owned_by_pipeline_crate() {
"maybe_build_local_openai_chat_stream_sync_response(",
"maybe_build_local_openai_chat_sync_response(",
"maybe_build_local_openai_chat_cross_format_stream_sync_response(",
"maybe_build_local_openai_cli_stream_sync_response(",
"maybe_build_local_openai_cli_cross_format_stream_sync_response(",
"maybe_build_local_openai_responses_stream_sync_response(",
"maybe_build_local_openai_responses_cross_format_stream_sync_response(",
"maybe_build_local_claude_cli_stream_sync_response(",
"maybe_build_local_gemini_cli_stream_sync_response(",
"maybe_build_local_claude_stream_sync_response(",
@@ -2136,7 +2136,7 @@ fn ai_pipeline_finalize_standard_sync_products_are_owned_by_pipeline_crate() {
"maybe_build_local_gemini_stream_sync_response(",
"maybe_build_local_gemini_sync_response(",
"maybe_build_local_openai_chat_cross_format_sync_response(",
"maybe_build_local_openai_cli_cross_format_sync_response(",
"maybe_build_local_openai_responses_cross_format_sync_response(",
] {
assert!(
!gateway_internal_sync.contains(forbidden),

View File

@@ -138,7 +138,7 @@ async fn gateway_admin_provider_keys_prefers_upstream_plan_type_over_auth_config
let mut key = sample_key(
"key-codex-oauth",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.auth_type = "oauth".to_string();

View File

@@ -123,13 +123,13 @@ async fn gateway_refreshes_admin_provider_quota_locally_for_codex_with_trusted_a
vec![sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api",
)],
vec![sample_key(
"key-codex-a",
"provider-codex",
"openai:cli",
"openai:responses",
"sk-codex-123",
)],
));
@@ -306,13 +306,13 @@ async fn gateway_refreshes_admin_provider_quota_for_codex_proxy_with_extended_ti
vec![sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api",
)],
vec![sample_key(
"key-codex-a",
"provider-codex",
"openai:cli",
"openai:responses",
"sk-codex-123",
)],
));
@@ -670,13 +670,13 @@ async fn gateway_reports_codex_quota_runtime_failures_locally_without_falling_ba
vec![sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api",
)],
vec![sample_key(
"key-codex-a",
"provider-codex",
"openai:cli",
"openai:responses",
"sk-codex-123",
)],
));

View File

@@ -3427,14 +3427,14 @@ async fn gateway_marks_lazy_codex_oauth_refresh_failures_as_invalid() {
let endpoint = sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
let mut key = sample_key(
"key-codex-oauth-lazy",
"provider-codex",
"openai:cli",
"openai:responses",
"stale-codex-access-token",
);
key.auth_type = "oauth".to_string();
@@ -3608,14 +3608,14 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_with_trusted_admin_p
let endpoint = sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
let mut key = sample_key(
"key-codex-oauth-refresh",
"provider-codex",
"openai:cli",
"openai:responses",
"stale-codex-access-token",
);
key.auth_type = "oauth".to_string();
@@ -3902,14 +3902,14 @@ async fn gateway_marks_manual_oauth_refresh_failures_as_invalid_in_pool_payload(
let endpoint = sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
let mut key = sample_key(
"key-codex-oauth-refresh-invalid",
"provider-codex",
"openai:cli",
"openai:responses",
"stale-codex-access-token",
);
key.auth_type = "oauth".to_string();
@@ -4107,14 +4107,14 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_via_execution_runtim
let endpoint = sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
let mut key = sample_key(
"key-codex-oauth-refresh-provider",
"provider-codex",
"openai:cli",
"openai:responses",
"stale-codex-access-token",
);
key.auth_type = "oauth".to_string();
@@ -4261,14 +4261,14 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_via_execution_runtim
let endpoint = sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
let mut key = sample_key(
"key-codex-oauth-refresh",
"provider-codex",
"openai:cli",
"openai:responses",
"stale-codex-access-token",
);
key.auth_type = "oauth".to_string();

View File

@@ -714,7 +714,7 @@ async fn gateway_marks_account_blocked_pool_key_in_list_keys_response() {
let mut key = sample_key(
"key-codex-blocked",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "blocked-codex".to_string();
@@ -1349,7 +1349,7 @@ async fn gateway_formats_codex_quota_countdown_from_reset_after_seconds() {
let mut key = sample_key(
"key-codex-oauth",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "codex quota key".to_string();
@@ -1422,7 +1422,7 @@ async fn gateway_marks_exhausted_codex_pool_key_as_blocked_when_flag_enabled() {
let mut key = sample_key(
"key-codex-exhausted",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "codex exhausted".to_string();
@@ -1504,12 +1504,12 @@ async fn gateway_lists_inherited_fixed_provider_api_formats_for_pool_keys() {
let mut key = sample_key(
"key-codex-inherited",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "codex inherited".to_string();
key.auth_type = "oauth".to_string();
key.api_formats = Some(json!(["openai:cli", "openai:compact"]));
key.api_formats = Some(json!(["openai:responses", "openai:responses:compact"]));
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
vec![provider],
@@ -1517,7 +1517,7 @@ async fn gateway_lists_inherited_fixed_provider_api_formats_for_pool_keys() {
sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
),
sample_endpoint(
@@ -1555,7 +1555,7 @@ async fn gateway_lists_inherited_fixed_provider_api_formats_for_pool_keys() {
assert_eq!(keys.len(), 1);
assert_eq!(
keys[0]["api_formats"],
json!(["openai:cli", "openai:image"])
json!(["openai:image", "openai:responses"])
);
}
@@ -1582,7 +1582,7 @@ async fn gateway_prefers_status_snapshot_codex_quota_over_stale_metadata() {
let mut key = sample_key(
"key-codex-snapshot-fresh",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "codex snapshot fresh".to_string();
@@ -1874,7 +1874,7 @@ async fn gateway_codex_quota_resets_to_full_after_countdown_elapsed() {
let mut key = sample_key(
"key-codex-expired",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "codex expired quota key".to_string();
@@ -1942,7 +1942,7 @@ async fn gateway_pool_prefers_upstream_plan_type_over_auth_config() {
let mut key = sample_key(
"key-codex-precedence",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.auth_type = "oauth".to_string();
@@ -2017,7 +2017,7 @@ async fn gateway_pool_plan_free_selector_prefers_upstream_plan_type() {
let mut key = sample_key(
"key-codex-selector",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.auth_type = "oauth".to_string();

View File

@@ -359,7 +359,7 @@ async fn gateway_handles_admin_provider_query_models_respecting_key_api_formats(
.lock()
.expect("mutex should lock") += 1;
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
assert_eq!(plan.provider_api_format, "openai:cli");
assert_eq!(plan.provider_api_format, "openai:responses");
Json(json!({
"request_id": "req-provider-query-cli",
"status_code": 200,
@@ -410,7 +410,7 @@ async fn gateway_handles_admin_provider_query_models_respecting_key_api_formats(
StoredProviderCatalogEndpoint::new(
"endpoint-openai-cli".to_string(),
"provider-openai".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("cli".to_string()),
Some("secondary".to_string()),
true,
@@ -431,7 +431,7 @@ async fn gateway_handles_admin_provider_query_models_respecting_key_api_formats(
vec![sample_key(
"key-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"sk-test-cli",
)],
));
@@ -648,7 +648,7 @@ async fn gateway_handles_admin_provider_query_models_for_fixed_provider_without_
vec![sample_key(
"key-codex-oauth",
"provider-codex",
"openai:cli",
"openai:responses",
"sk-test-codex",
)],
));
@@ -1506,7 +1506,7 @@ async fn gateway_handles_non_kiro_multi_model_failover_locally() {
}
#[tokio::test]
async fn gateway_handles_openai_cli_test_model_locally() {
async fn gateway_handles_openai_responses_test_model_locally() {
let prompt = "Tell me whether the CLI request preserved this prompt.";
let execution_runtime = Router::new().route(
"/v1/execute/sync",
@@ -1514,7 +1514,7 @@ async fn gateway_handles_openai_cli_test_model_locally() {
assert_eq!(plan.provider_id, "provider-openai");
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
assert_eq!(plan.key_id, "key-openai-cli");
assert_eq!(plan.provider_api_format, "openai:cli");
assert_eq!(plan.provider_api_format, "openai:responses");
assert_eq!(plan.url, "https://tiger.bookapi.cc/codex/responses");
assert!(!plan.stream);
assert_eq!(
@@ -1617,13 +1617,13 @@ async fn gateway_handles_openai_cli_test_model_locally() {
vec![sample_endpoint(
"endpoint-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"https://tiger.bookapi.cc/codex",
)],
vec![sample_key(
"key-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"sk-test-cli",
)],
));
@@ -1646,7 +1646,7 @@ async fn gateway_handles_openai_cli_test_model_locally() {
.json(&json!({
"provider_id": "provider-openai",
"model": "gpt-5.4-mini",
"api_format": "openai:cli",
"api_format": "openai:responses",
"message": prompt,
"request_headers": {
"x-stainless-runtime": "node"
@@ -1765,7 +1765,7 @@ async fn gateway_prefers_supported_non_kiro_endpoint_when_api_format_is_omitted(
sample_endpoint(
"endpoint-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"https://api.openai.example",
),
sample_endpoint(
@@ -1779,7 +1779,7 @@ async fn gateway_prefers_supported_non_kiro_endpoint_when_api_format_is_omitted(
sample_key(
"key-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"sk-test-cli",
),
sample_key(
@@ -2028,7 +2028,7 @@ async fn gateway_uses_compatible_cli_endpoint_when_api_format_is_omitted() {
"/v1/execute/sync",
any(move |Json(plan): Json<ExecutionPlan>| async move {
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
assert_eq!(plan.provider_api_format, "openai:cli");
assert_eq!(plan.provider_api_format, "openai:responses");
assert_eq!(plan.key_id, "key-openai-cli");
Json(json!({
"request_id": plan.request_id,
@@ -2070,14 +2070,14 @@ async fn gateway_uses_compatible_cli_endpoint_when_api_format_is_omitted() {
sample_endpoint(
"endpoint-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"https://api.openai.example",
),
],
vec![sample_key(
"key-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"sk-test-cli",
)],
));
@@ -2123,7 +2123,7 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
"/v1/execute/sync",
any(move |Json(plan): Json<ExecutionPlan>| async move {
assert_eq!(plan.endpoint_id, "endpoint-openai-cli-runnable");
assert_eq!(plan.provider_api_format, "openai:cli");
assert_eq!(plan.provider_api_format, "openai:responses");
assert_eq!(plan.key_id, "key-openai-shared");
Json(json!({
"request_id": plan.request_id,
@@ -2163,7 +2163,7 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
let cli_endpoint = sample_endpoint(
"endpoint-openai-cli-runnable",
"provider-openai",
"openai:cli",
"openai:responses",
"https://api.openai.example",
);
let mut shared_key = sample_key(
@@ -2172,7 +2172,7 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
"openai:chat",
"sk-test-shared",
);
shared_key.api_formats = Some(json!(["openai:chat", "openai:cli"]));
shared_key.api_formats = Some(json!(["openai:chat", "openai:responses"]));
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
vec![provider],
vec![unsupported_chat_endpoint, cli_endpoint],
@@ -2215,14 +2215,14 @@ async fn gateway_uses_runnable_cli_endpoint_after_chat_preference_when_api_forma
}
#[tokio::test]
async fn gateway_handles_openai_cli_test_model_failover_locally() {
async fn gateway_handles_openai_responses_test_model_failover_locally() {
let execution_runtime = Router::new().route(
"/v1/execute/sync",
any(move |Json(plan): Json<ExecutionPlan>| async move {
assert_eq!(plan.provider_id, "provider-openai");
assert_eq!(plan.endpoint_id, "endpoint-openai-cli");
assert_eq!(plan.key_id, "key-openai-cli");
assert_eq!(plan.provider_api_format, "openai:cli");
assert_eq!(plan.provider_api_format, "openai:responses");
assert_eq!(plan.model_name.as_deref(), Some("gpt-5.4-mini"));
Json(json!({
"request_id": plan.request_id,
@@ -2257,13 +2257,13 @@ async fn gateway_handles_openai_cli_test_model_failover_locally() {
vec![sample_endpoint(
"endpoint-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"https://api.openai.example",
)],
vec![sample_key(
"key-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"sk-test-cli",
)],
));
@@ -2288,7 +2288,7 @@ async fn gateway_handles_openai_cli_test_model_failover_locally() {
.json(&json!({
"provider_id": "provider-openai",
"failover_models": ["gpt-5.4-mini"],
"api_format": "openai:cli"
"api_format": "openai:responses"
}))
.send()
.await

View File

@@ -255,7 +255,7 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
sample_endpoint(
"endpoint-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"https://api.openai.example",
),
],
@@ -270,11 +270,11 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
sample_key(
"key-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"sk-test-cli",
)
.with_transport_fields(
Some(json!(["openai:cli"])),
Some(json!(["openai:responses"])),
encrypt_python_fernet_plaintext(DEVELOPMENT_ENCRYPTION_KEY, "sk-test-cli-2")
.expect("api key ciphertext should build"),
None,
@@ -286,7 +286,10 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
None,
)
.expect("key transport should build")
.with_health_fields(Some(json!({"openai:cli": {"health_score": 0.75}})), None),
.with_health_fields(
Some(json!({"openai:responses": {"health_score": 0.75}})),
None,
),
],
));
let global_model_repository = Arc::new(
@@ -342,7 +345,10 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
assert_eq!(payload["total_models"], 5);
assert_eq!(payload["active_models"], 3);
assert_eq!(payload["global_model_ids"], json!(["gpt-5", "gpt-5-mini"]));
assert_eq!(payload["api_formats"], json!(["openai:chat", "openai:cli"]));
assert_eq!(
payload["api_formats"],
json!(["openai:chat", "openai:responses"])
);
assert_eq!(payload["ops_configured"], true);
assert_eq!(payload["ops_architecture_id"], "anyrouter");
assert_eq!(payload["created_at"], "2024-03-21T05:46:40Z");
@@ -358,7 +364,7 @@ async fn gateway_handles_admin_provider_summary_locally_with_trusted_admin_princ
"active_keys": 1
},
{
"api_format": "openai:cli",
"api_format": "openai:responses",
"health_score": 0.75,
"is_active": true,
"total_keys": 1,
@@ -1025,7 +1031,7 @@ async fn gateway_updates_fixed_provider_and_reconciles_template_managed_endpoint
let mut cli_endpoint = sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
cli_endpoint.max_retries = Some(2);
@@ -1033,11 +1039,11 @@ async fn gateway_updates_fixed_provider_and_reconciles_template_managed_endpoint
let mut key = sample_key(
"key-codex-oauth",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.auth_type = "oauth".to_string();
key.api_formats = Some(json!(["openai:cli"]));
key.api_formats = Some(json!(["openai:responses"]));
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
vec![provider],
@@ -1133,12 +1139,12 @@ async fn gateway_lists_effective_api_formats_for_fixed_oauth_provider_keys() {
let mut key = sample_key(
"key-codex-legacy",
"provider-codex",
"openai:cli",
"openai:responses",
"oauth-placeholder",
);
key.name = "codex legacy".to_string();
key.auth_type = "oauth".to_string();
key.api_formats = Some(json!(["openai:cli", "openai:compact"]));
key.api_formats = Some(json!(["openai:responses", "openai:responses:compact"]));
let provider_catalog_repository = Arc::new(InMemoryProviderCatalogReadRepository::seed(
vec![provider],
@@ -1146,7 +1152,7 @@ async fn gateway_lists_effective_api_formats_for_fixed_oauth_provider_keys() {
sample_endpoint(
"endpoint-codex-cli",
"provider-codex",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
),
sample_endpoint(
@@ -1186,7 +1192,7 @@ async fn gateway_lists_effective_api_formats_for_fixed_oauth_provider_keys() {
assert_eq!(keys.len(), 1);
assert_eq!(
keys[0]["api_formats"],
json!(["openai:cli", "openai:image"])
json!(["openai:image", "openai:responses"])
);
gateway_handle.abort();
@@ -1219,7 +1225,7 @@ async fn gateway_handles_admin_provider_health_monitor_locally_with_trusted_admi
sample_endpoint(
"endpoint-openai-cli",
"provider-openai",
"openai:cli",
"openai:responses",
"https://api.openai.example",
),
],
@@ -1311,7 +1317,7 @@ async fn gateway_handles_admin_provider_health_monitor_locally_with_trusted_admi
.as_str()
.is_some_and(|value| value.ends_with(".000Z")));
assert_eq!(endpoints[1]["endpoint_id"], "endpoint-openai-cli");
assert_eq!(endpoints[1]["api_format"], "openai:cli");
assert_eq!(endpoints[1]["api_format"], "openai:responses");
assert_eq!(endpoints[1]["total_attempts"], 1);
assert_eq!(endpoints[1]["success_count"], 0);
assert_eq!(endpoints[1]["failed_count"], 0);

View File

@@ -446,7 +446,7 @@ async fn gateway_handles_admin_system_config_export_locally_with_trusted_admin_p
sample_endpoint(
"endpoint-cli",
&provider_id,
"openai:cli",
"openai:responses",
"https://api.openai.example",
),
],

View File

@@ -190,7 +190,7 @@ fn sample_oauth_system_import_payload(access_token: &str, refresh_token: &str) -
"website": "https://example.com",
"is_active": true,
"endpoints": [{
"api_format": "openai:cli",
"api_format": "openai:responses",
"base_url": "https://chatgpt.com",
"is_active": true
}],
@@ -202,7 +202,7 @@ fn sample_oauth_system_import_payload(access_token: &str, refresh_token: &str) -
"{{\"provider_type\":\"codex\",\"refresh_token\":\"{}\",\"email\":\"alice@example.com\",\"account_id\":\"acct-codex-123\",\"plan_type\":\"plus\"}}",
refresh_token
),
"api_formats": ["openai:cli"],
"api_formats": ["openai:responses"],
"is_active": true
}],
"models": []
@@ -1170,13 +1170,13 @@ async fn gateway_overwrites_oauth_provider_key_credentials_from_admin_system_imp
let endpoint = sample_endpoint(
"endpoint-codex-existing",
"provider-codex-existing",
"openai:cli",
"openai:responses",
"https://chatgpt.com/backend-api/codex",
);
let mut existing_key = sample_key(
"key-codex-existing",
"provider-codex-existing",
"openai:cli",
"openai:responses",
"oauth-access-token-old",
);
existing_key.name = "oauth-primary".to_string();

View File

@@ -71,7 +71,7 @@ fn sample_cli_auth_snapshot(
true,
false,
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!([allowed_model])),
api_key_id.to_string(),
Some("default".to_string()),
@@ -82,7 +82,7 @@ fn sample_cli_auth_snapshot(
Some(5),
Some(4_102_444_800),
Some(serde_json::json!(["openai"])),
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
Some(serde_json::json!([allowed_model])),
)
.expect("auth snapshot should build")
@@ -126,7 +126,7 @@ fn sample_codex_endpoint(endpoint_id: &str, provider_id: &str) -> StoredProvider
StoredProviderCatalogEndpoint::new(
endpoint_id.to_string(),
provider_id.to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -184,11 +184,11 @@ fn sample_codex_key(key_id: &str, provider_id: &str, node_id: &str) -> StoredPro
)
.expect("key should build")
.with_transport_fields(
Some(json!(["openai:cli"])),
Some(json!(["openai:responses"])),
"plain-upstream-key".to_string(),
None,
None,
Some(json!({"openai:cli": 1})),
Some(json!({"openai:responses": 1})),
None,
None,
Some(json!({
@@ -762,7 +762,7 @@ async fn gateway_aggregates_sync_sse_from_remote_tunnel_owner_before_returning_t
.with_data_state_for_tests(data_state)
.with_tunnel_identity_for_tests("gateway-a", Some("http://gateway-a:8080"));
state.scheduler_affinity_cache.insert(
"scheduler_affinity:api-key-affinity-cli-1:openai:cli:gpt-5.4".to_string(),
"scheduler_affinity:api-key-affinity-cli-1:openai:responses:gpt-5.4".to_string(),
crate::cache::SchedulerAffinityTarget {
provider_id: "provider-cli-owner".to_string(),
endpoint_id: "endpoint-cli-owner".to_string(),
@@ -1002,7 +1002,7 @@ async fn gateway_streamifies_sync_json_from_remote_tunnel_owner_before_returning
.with_data_state_for_tests(data_state)
.with_tunnel_identity_for_tests("gateway-a", Some("http://gateway-a:8080"));
state.scheduler_affinity_cache.insert(
"scheduler_affinity:api-key-affinity-cli-1:openai:cli:gpt-5.4".to_string(),
"scheduler_affinity:api-key-affinity-cli-1:openai:responses:gpt-5.4".to_string(),
crate::cache::SchedulerAffinityTarget {
provider_id: "provider-cli-owner".to_string(),
endpoint_id: "endpoint-cli-owner".to_string(),

View File

@@ -1394,7 +1394,7 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-claude-cli-usage-local-miss-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -1402,11 +1402,11 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
key_name: "codex".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-claude-cli-usage-local-miss-1".to_string(),
global_model_id: "global-model-claude-cli-usage-local-miss-1".to_string(),
global_model_name: "gpt-5.4".to_string(),
@@ -1416,7 +1416,7 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5.4".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -1449,7 +1449,7 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
StoredProviderCatalogEndpoint::new(
"endpoint-claude-cli-usage-local-miss-1".to_string(),
"provider-claude-cli-usage-local-miss-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -1479,7 +1479,7 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-cli-usage-local-miss",
@@ -1487,7 +1487,7 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,
@@ -1703,7 +1703,7 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
provider_priority: 10,
provider_is_active: true,
endpoint_id: "endpoint-claude-cli-usage-local-miss-large-1".to_string(),
endpoint_api_format: "openai:cli".to_string(),
endpoint_api_format: "openai:responses".to_string(),
endpoint_api_family: Some("openai".to_string()),
endpoint_kind: Some("cli".to_string()),
endpoint_is_active: true,
@@ -1711,11 +1711,11 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
key_name: "codex".to_string(),
key_auth_type: "bearer".to_string(),
key_is_active: true,
key_api_formats: Some(vec!["openai:cli".to_string()]),
key_api_formats: Some(vec!["openai:responses".to_string()]),
key_allowed_models: None,
key_capabilities: None,
key_internal_priority: 5,
key_global_priority_by_format: Some(serde_json::json!({"openai:cli": 1})),
key_global_priority_by_format: Some(serde_json::json!({"openai:responses": 1})),
model_id: "model-claude-cli-usage-local-miss-large-1".to_string(),
global_model_id: "global-model-claude-cli-usage-local-miss-large-1".to_string(),
global_model_name: "gpt-5.4".to_string(),
@@ -1725,7 +1725,7 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
model_provider_model_mappings: Some(vec![StoredProviderModelMapping {
name: "gpt-5.4".to_string(),
priority: 1,
api_formats: Some(vec!["openai:cli".to_string()]),
api_formats: Some(vec!["openai:responses".to_string()]),
}]),
model_supports_streaming: Some(true),
model_is_active: true,
@@ -1758,7 +1758,7 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
StoredProviderCatalogEndpoint::new(
"endpoint-claude-cli-usage-local-miss-large-1".to_string(),
"provider-claude-cli-usage-local-miss-large-1".to_string(),
"openai:cli".to_string(),
"openai:responses".to_string(),
Some("openai".to_string()),
Some("cli".to_string()),
true,
@@ -1788,7 +1788,7 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
)
.expect("key should build")
.with_transport_fields(
Some(serde_json::json!(["openai:cli"])),
Some(serde_json::json!(["openai:responses"])),
encrypt_python_fernet_plaintext(
DEVELOPMENT_ENCRYPTION_KEY,
"sk-upstream-openai-cli-usage-local-miss-large",
@@ -1796,7 +1796,7 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
.expect("api key should encrypt"),
None,
None,
Some(serde_json::json!({"openai:cli": 1})),
Some(serde_json::json!({"openai:responses": 1})),
None,
None,
None,