mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
clean up legacy openai cli adapter names
This commit is contained in:
@@ -24,15 +24,10 @@ pub(crate) use crate::ai_pipeline::{
|
||||
GEMINI_VIDEO_CREATE_SYNC_FINALIZE_REPORT_KIND, GEMINI_VIDEO_CREATE_SYNC_PLAN_KIND,
|
||||
OPENAI_CHAT_STREAM_PLAN_KIND, OPENAI_CHAT_STREAM_SUCCESS_REPORT_KIND,
|
||||
OPENAI_CHAT_SYNC_ERROR_REPORT_KIND, OPENAI_CHAT_SYNC_FINALIZE_REPORT_KIND,
|
||||
OPENAI_CHAT_SYNC_PLAN_KIND, OPENAI_CHAT_SYNC_SUCCESS_REPORT_KIND, OPENAI_CLI_STREAM_PLAN_KIND,
|
||||
OPENAI_CLI_STREAM_SUCCESS_REPORT_KIND, OPENAI_CLI_SYNC_ERROR_REPORT_KIND,
|
||||
OPENAI_CLI_SYNC_FINALIZE_REPORT_KIND, OPENAI_CLI_SYNC_PLAN_KIND,
|
||||
OPENAI_CLI_SYNC_SUCCESS_REPORT_KIND, OPENAI_COMPACT_STREAM_PLAN_KIND,
|
||||
OPENAI_COMPACT_SYNC_ERROR_REPORT_KIND, OPENAI_COMPACT_SYNC_FINALIZE_REPORT_KIND,
|
||||
OPENAI_COMPACT_SYNC_PLAN_KIND, OPENAI_IMAGE_STREAM_PLAN_KIND,
|
||||
OPENAI_IMAGE_STREAM_SUCCESS_REPORT_KIND, OPENAI_IMAGE_SYNC_FINALIZE_REPORT_KIND,
|
||||
OPENAI_IMAGE_SYNC_PLAN_KIND, OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_SUCCESS_REPORT_KIND,
|
||||
OPENAI_CHAT_SYNC_PLAN_KIND, OPENAI_CHAT_SYNC_SUCCESS_REPORT_KIND,
|
||||
OPENAI_IMAGE_STREAM_PLAN_KIND, OPENAI_IMAGE_STREAM_SUCCESS_REPORT_KIND,
|
||||
OPENAI_IMAGE_SYNC_FINALIZE_REPORT_KIND, OPENAI_IMAGE_SYNC_PLAN_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND, OPENAI_RESPONSES_COMPACT_STREAM_SUCCESS_REPORT_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_SYNC_ERROR_REPORT_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_SYNC_FINALIZE_REPORT_KIND, OPENAI_RESPONSES_COMPACT_SYNC_PLAN_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_SYNC_SUCCESS_REPORT_KIND, OPENAI_RESPONSES_STREAM_PLAN_KIND,
|
||||
|
||||
@@ -26,7 +26,7 @@ mod tests {
|
||||
#[test]
|
||||
fn request_conversion_registry_supports_bidirectional_standard_matrix() {
|
||||
assert_eq!(
|
||||
request_conversion_kind("openai:chat", "openai:cli"),
|
||||
request_conversion_kind("openai:chat", "openai:responses"),
|
||||
Some(RequestConversionKind::ToOpenAiResponses)
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -34,7 +34,7 @@ mod tests {
|
||||
Some(RequestConversionKind::ToClaudeStandard)
|
||||
);
|
||||
assert_eq!(
|
||||
request_conversion_kind("openai:cli", "openai:chat"),
|
||||
request_conversion_kind("openai:responses", "openai:chat"),
|
||||
Some(RequestConversionKind::ToOpenAIChat)
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -42,15 +42,15 @@ mod tests {
|
||||
Some(RequestConversionKind::ToClaudeStandard)
|
||||
);
|
||||
assert_eq!(
|
||||
request_conversion_kind("openai:compact", "gemini:cli"),
|
||||
request_conversion_kind("openai:responses:compact", "gemini:cli"),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
request_conversion_kind("gemini:cli", "openai:compact"),
|
||||
request_conversion_kind("gemini:cli", "openai:responses:compact"),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
request_conversion_kind("openai:chat", "openai:compact"),
|
||||
request_conversion_kind("openai:chat", "openai:responses:compact"),
|
||||
None
|
||||
);
|
||||
assert_eq!(request_conversion_kind("claude:chat", "claude:chat"), None);
|
||||
@@ -71,19 +71,19 @@ mod tests {
|
||||
Some(SyncChatResponseConversionKind::ToOpenAIChat)
|
||||
);
|
||||
assert_eq!(
|
||||
sync_cli_response_conversion_kind("openai:cli", "gemini:cli"),
|
||||
sync_cli_response_conversion_kind("openai:responses", "gemini:cli"),
|
||||
Some(SyncCliResponseConversionKind::ToGeminiCli)
|
||||
);
|
||||
assert_eq!(
|
||||
sync_cli_response_conversion_kind("claude:chat", "openai:cli"),
|
||||
sync_cli_response_conversion_kind("claude:chat", "openai:responses"),
|
||||
Some(SyncCliResponseConversionKind::ToOpenAiResponses)
|
||||
);
|
||||
assert_eq!(
|
||||
sync_cli_response_conversion_kind("claude:cli", "openai:compact"),
|
||||
sync_cli_response_conversion_kind("claude:cli", "openai:responses:compact"),
|
||||
Some(SyncCliResponseConversionKind::ToOpenAiResponses)
|
||||
);
|
||||
assert_eq!(
|
||||
sync_cli_response_conversion_kind("openai:compact", "claude:cli"),
|
||||
sync_cli_response_conversion_kind("openai:responses:compact", "claude:cli"),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -101,16 +101,14 @@ mod tests {
|
||||
"claude:chat",
|
||||
"gemini:chat",
|
||||
"openai:responses",
|
||||
"openai:cli",
|
||||
"claude:cli",
|
||||
"gemini:cli",
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
request_candidate_api_formats("openai:cli", false),
|
||||
request_candidate_api_formats("openai:responses", false),
|
||||
vec![
|
||||
"openai:responses",
|
||||
"openai:cli",
|
||||
"claude:cli",
|
||||
"gemini:cli",
|
||||
"openai:chat",
|
||||
@@ -119,10 +117,9 @@ mod tests {
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
request_candidate_api_formats("openai:responses", false),
|
||||
request_candidate_api_formats("openai:cli", false),
|
||||
vec![
|
||||
"openai:responses",
|
||||
"openai:cli",
|
||||
"claude:cli",
|
||||
"gemini:cli",
|
||||
"openai:chat",
|
||||
@@ -135,7 +132,6 @@ mod tests {
|
||||
vec![
|
||||
"claude:cli",
|
||||
"openai:responses",
|
||||
"openai:cli",
|
||||
"gemini:cli",
|
||||
"claude:chat",
|
||||
"openai:chat",
|
||||
@@ -144,14 +140,14 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
request_candidate_api_formats("openai:compact", false),
|
||||
vec!["openai:responses:compact", "openai:compact"]
|
||||
vec!["openai:responses:compact"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn request_candidate_registry_prefers_same_kind_before_same_family_fallbacks() {
|
||||
assert_eq!(
|
||||
request_candidate_api_format_preference("claude:cli", "openai:cli"),
|
||||
request_candidate_api_format_preference("claude:cli", "openai:responses"),
|
||||
Some((1, 0))
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
@@ -110,7 +110,11 @@ fn maybe_bridge_openai_image_sync_json_to_stream(
|
||||
}
|
||||
|
||||
fn normalize_api_format(value: &str) -> String {
|
||||
value.trim().to_ascii_lowercase()
|
||||
match value.trim().to_ascii_lowercase().as_str() {
|
||||
"openai:cli" => "openai:responses".to_string(),
|
||||
"openai:compact" => "openai:responses:compact".to_string(),
|
||||
other => other.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_standard_api_format(value: &str) -> bool {
|
||||
@@ -118,8 +122,6 @@ fn is_standard_api_format(value: &str) -> bool {
|
||||
value,
|
||||
"openai:chat"
|
||||
| "openai:responses"
|
||||
| "openai:cli"
|
||||
| "openai:compact"
|
||||
| "openai:responses:compact"
|
||||
| "claude:chat"
|
||||
| "claude:cli"
|
||||
@@ -206,9 +208,7 @@ fn convert_provider_sync_response_to_openai_responses(
|
||||
report_context: &Value,
|
||||
) -> Option<Value> {
|
||||
match provider_api_format {
|
||||
"openai:responses" | "openai:cli" | "openai:compact" | "openai:responses:compact" => {
|
||||
Some(provider_body_json.clone())
|
||||
}
|
||||
"openai:responses" | "openai:responses:compact" => Some(provider_body_json.clone()),
|
||||
"openai:chat" => convert_openai_chat_response_to_openai_responses(
|
||||
provider_body_json,
|
||||
report_context,
|
||||
@@ -257,7 +257,7 @@ fn emit_client_stream_from_canonical_frames(
|
||||
let mut emitter = OpenAIChatClientEmitter::default();
|
||||
emit_with_openai_chat_emitter(&mut emitter, canonical_frames)
|
||||
}
|
||||
"openai:responses" | "openai:cli" | "openai:compact" | "openai:responses:compact" => {
|
||||
"openai:responses" | "openai:responses:compact" => {
|
||||
let mut emitter = OpenAIResponsesClientEmitter::default();
|
||||
emit_with_openai_responses_emitter(&mut emitter, canonical_frames)
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ fn gemini_to_openai_responses_stream_rewriter_converts_function_call_to_complete
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gemini_to_openai_compact_stream_rewriter_converts_function_call_to_completed_event() {
|
||||
fn gemini_to_openai_responses_compact_stream_rewriter_converts_function_call_to_completed_event() {
|
||||
let report_context = json!({
|
||||
"provider_api_format": "gemini:cli",
|
||||
"client_api_format": "openai:responses:compact",
|
||||
|
||||
@@ -1078,10 +1078,10 @@ fn converts_gemini_cli_inline_data_to_openai_responses_output_image() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_finalize_handles_openai_compact_cross_format_sync_response() {
|
||||
fn local_finalize_handles_openai_responses_compact_cross_format_sync_response() {
|
||||
let payload = GatewaySyncReportRequest {
|
||||
trace_id: "trace-compact-sync-123".to_string(),
|
||||
report_kind: "openai_compact_sync_finalize".to_string(),
|
||||
report_kind: "openai_responses_compact_sync_finalize".to_string(),
|
||||
report_context: Some(json!({
|
||||
"client_api_format": "openai:responses:compact",
|
||||
"provider_api_format": "gemini:cli",
|
||||
@@ -1126,7 +1126,7 @@ fn local_finalize_handles_openai_compact_cross_format_sync_response() {
|
||||
let report = outcome
|
||||
.background_report
|
||||
.expect("compact cross-format should downgrade to success report");
|
||||
assert_eq!(report.report_kind, "openai_responses_sync_success");
|
||||
assert_eq!(report.report_kind, "openai_responses_compact_sync_success");
|
||||
assert_eq!(
|
||||
report.client_body_json.expect("client body should exist")["object"],
|
||||
"response"
|
||||
@@ -1134,10 +1134,10 @@ fn local_finalize_handles_openai_compact_cross_format_sync_response() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_finalize_handles_openai_compact_cross_format_function_call_response() {
|
||||
fn local_finalize_handles_openai_responses_compact_cross_format_function_call_response() {
|
||||
let payload = GatewaySyncReportRequest {
|
||||
trace_id: "trace-compact-tool-123".to_string(),
|
||||
report_kind: "openai_compact_sync_finalize".to_string(),
|
||||
report_kind: "openai_responses_compact_sync_finalize".to_string(),
|
||||
report_context: Some(json!({
|
||||
"client_api_format": "openai:responses:compact",
|
||||
"provider_api_format": "gemini:cli",
|
||||
@@ -1346,7 +1346,7 @@ fn local_finalize_handles_openai_responses_cross_format_stream_response_from_gem
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_finalize_handles_openai_compact_openai_family_stream_response_even_when_conversion_flagged(
|
||||
fn local_finalize_handles_openai_responses_compact_openai_family_stream_response_even_when_conversion_flagged(
|
||||
) {
|
||||
let body = concat!(
|
||||
"event: response.completed\n",
|
||||
@@ -1354,7 +1354,7 @@ fn local_finalize_handles_openai_compact_openai_family_stream_response_even_when
|
||||
);
|
||||
let payload = GatewaySyncReportRequest {
|
||||
trace_id: "trace-openai-compact-family-stream-123".to_string(),
|
||||
report_kind: "openai_compact_sync_finalize".to_string(),
|
||||
report_kind: "openai_responses_compact_sync_finalize".to_string(),
|
||||
report_context: Some(json!({
|
||||
"client_api_format": "openai:responses:compact",
|
||||
"provider_api_format": "openai:responses",
|
||||
@@ -1382,7 +1382,7 @@ fn local_finalize_handles_openai_compact_openai_family_stream_response_even_when
|
||||
let report = outcome
|
||||
.background_report
|
||||
.expect("same-family stream finalize should downgrade to success report");
|
||||
assert_eq!(report.report_kind, "openai_responses_sync_success");
|
||||
assert_eq!(report.report_kind, "openai_responses_compact_sync_success");
|
||||
let provider_body = report.body_json.expect("provider body should exist");
|
||||
assert_eq!(provider_body["object"], "response");
|
||||
assert_eq!(provider_body["status"], "completed");
|
||||
|
||||
@@ -9,8 +9,7 @@ pub(crate) use crate::ai_pipeline::contracts::{
|
||||
GEMINI_FILES_DELETE_PLAN_KIND, GEMINI_FILES_DOWNLOAD_PLAN_KIND, GEMINI_FILES_GET_PLAN_KIND,
|
||||
GEMINI_FILES_LIST_PLAN_KIND, GEMINI_FILES_UPLOAD_PLAN_KIND, GEMINI_VIDEO_CANCEL_SYNC_PLAN_KIND,
|
||||
GEMINI_VIDEO_CREATE_SYNC_PLAN_KIND, OPENAI_CHAT_STREAM_PLAN_KIND, OPENAI_CHAT_SYNC_PLAN_KIND,
|
||||
OPENAI_CLI_STREAM_PLAN_KIND, OPENAI_CLI_SYNC_PLAN_KIND, OPENAI_COMPACT_STREAM_PLAN_KIND,
|
||||
OPENAI_COMPACT_SYNC_PLAN_KIND, OPENAI_IMAGE_STREAM_PLAN_KIND, OPENAI_IMAGE_SYNC_PLAN_KIND,
|
||||
OPENAI_IMAGE_STREAM_PLAN_KIND, OPENAI_IMAGE_SYNC_PLAN_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND, OPENAI_RESPONSES_COMPACT_SYNC_PLAN_KIND,
|
||||
OPENAI_RESPONSES_STREAM_PLAN_KIND, OPENAI_RESPONSES_SYNC_PLAN_KIND,
|
||||
OPENAI_VIDEO_CANCEL_SYNC_PLAN_KIND, OPENAI_VIDEO_CONTENT_PLAN_KIND,
|
||||
|
||||
@@ -6,8 +6,7 @@ use crate::ai_pipeline::planner::common::{
|
||||
GEMINI_CLI_SYNC_PLAN_KIND, GEMINI_FILES_DELETE_PLAN_KIND, GEMINI_FILES_DOWNLOAD_PLAN_KIND,
|
||||
GEMINI_FILES_GET_PLAN_KIND, GEMINI_FILES_LIST_PLAN_KIND, GEMINI_VIDEO_CANCEL_SYNC_PLAN_KIND,
|
||||
GEMINI_VIDEO_CREATE_SYNC_PLAN_KIND, OPENAI_CHAT_STREAM_PLAN_KIND, OPENAI_CHAT_SYNC_PLAN_KIND,
|
||||
OPENAI_CLI_STREAM_PLAN_KIND, OPENAI_CLI_SYNC_PLAN_KIND, OPENAI_COMPACT_STREAM_PLAN_KIND,
|
||||
OPENAI_COMPACT_SYNC_PLAN_KIND, OPENAI_IMAGE_STREAM_PLAN_KIND, OPENAI_IMAGE_SYNC_PLAN_KIND,
|
||||
OPENAI_IMAGE_STREAM_PLAN_KIND, OPENAI_IMAGE_SYNC_PLAN_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND, OPENAI_RESPONSES_COMPACT_SYNC_PLAN_KIND,
|
||||
OPENAI_RESPONSES_STREAM_PLAN_KIND, OPENAI_RESPONSES_SYNC_PLAN_KIND,
|
||||
OPENAI_VIDEO_CANCEL_SYNC_PLAN_KIND, OPENAI_VIDEO_CONTENT_PLAN_KIND,
|
||||
@@ -98,11 +97,11 @@ fn build_sync_plan_payload_from_decision(
|
||||
OPENAI_CHAT_SYNC_PLAN_KIND => {
|
||||
build_openai_chat_sync_plan_from_decision(parts, body_json, payload)?
|
||||
}
|
||||
OPENAI_RESPONSES_SYNC_PLAN_KIND | OPENAI_CLI_SYNC_PLAN_KIND => {
|
||||
OPENAI_RESPONSES_SYNC_PLAN_KIND => {
|
||||
build_openai_responses_sync_plan_from_decision(parts, body_json, payload, false)?
|
||||
}
|
||||
OPENAI_IMAGE_SYNC_PLAN_KIND => build_passthrough_sync_plan_from_decision(parts, payload)?,
|
||||
OPENAI_RESPONSES_COMPACT_SYNC_PLAN_KIND | OPENAI_COMPACT_SYNC_PLAN_KIND => {
|
||||
OPENAI_RESPONSES_COMPACT_SYNC_PLAN_KIND => {
|
||||
build_openai_responses_sync_plan_from_decision(parts, body_json, payload, true)?
|
||||
}
|
||||
CLAUDE_CHAT_SYNC_PLAN_KIND | CLAUDE_CLI_SYNC_PLAN_KIND => {
|
||||
@@ -139,13 +138,13 @@ fn build_stream_plan_payload_from_decision(
|
||||
OPENAI_CHAT_STREAM_PLAN_KIND => {
|
||||
build_openai_chat_stream_plan_from_decision(parts, body_json, payload)?
|
||||
}
|
||||
OPENAI_RESPONSES_STREAM_PLAN_KIND | OPENAI_CLI_STREAM_PLAN_KIND => {
|
||||
OPENAI_RESPONSES_STREAM_PLAN_KIND => {
|
||||
build_openai_responses_stream_plan_from_decision(parts, body_json, payload, false)?
|
||||
}
|
||||
OPENAI_IMAGE_STREAM_PLAN_KIND => {
|
||||
build_standard_stream_plan_from_decision(parts, body_json, payload, false)?
|
||||
}
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND | OPENAI_COMPACT_STREAM_PLAN_KIND => {
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND => {
|
||||
build_openai_responses_stream_plan_from_decision(parts, body_json, payload, true)?
|
||||
}
|
||||
CLAUDE_CHAT_STREAM_PLAN_KIND | CLAUDE_CLI_STREAM_PLAN_KIND => {
|
||||
|
||||
@@ -82,7 +82,7 @@ fn builds_openai_chat_cross_format_request_body_from_openai_responses_source() {
|
||||
let provider_request_body = build_cross_format_openai_responses_request_body(
|
||||
&body_json,
|
||||
"gpt-5-upstream",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"openai:chat",
|
||||
false,
|
||||
"openai",
|
||||
@@ -118,7 +118,7 @@ fn local_openai_responses_wrapper_preserves_body_order_after_edits() {
|
||||
"gpt-5.4",
|
||||
true,
|
||||
"codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
None,
|
||||
Some("key-123"),
|
||||
)
|
||||
@@ -143,7 +143,7 @@ fn local_openai_responses_wrapper_preserves_body_order_after_edits() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_openai_compact_wrapper_strips_store_for_same_format_requests() {
|
||||
fn local_openai_responses_compact_wrapper_strips_store_for_same_format_requests() {
|
||||
let body_json = json!({
|
||||
"model": "gpt-5.4",
|
||||
"input": [],
|
||||
@@ -155,7 +155,7 @@ fn local_openai_compact_wrapper_strips_store_for_same_format_requests() {
|
||||
"gpt-5.4",
|
||||
false,
|
||||
"openai",
|
||||
"openai:compact",
|
||||
"openai:responses:compact",
|
||||
None,
|
||||
None,
|
||||
)
|
||||
@@ -175,7 +175,7 @@ fn local_openai_responses_upstream_url_preserves_codex_base_path() {
|
||||
|
||||
let upstream_url = build_local_openai_responses_upstream_url(
|
||||
&parts,
|
||||
&sample_transport("https://tiger.bookapi.cc/codex", "openai:cli"),
|
||||
&sample_transport("https://tiger.bookapi.cc/codex", "openai:responses"),
|
||||
false,
|
||||
)
|
||||
.expect("openai responses upstream url should build");
|
||||
@@ -198,7 +198,7 @@ fn strips_metadata_for_codex_openai_responses_requests() {
|
||||
&body_json,
|
||||
"gpt-5-upstream",
|
||||
"claude:cli",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
true,
|
||||
"codex",
|
||||
None,
|
||||
@@ -230,7 +230,7 @@ fn applies_codex_defaults_unless_body_rules_handle_the_field() {
|
||||
&body_json,
|
||||
"gpt-5-upstream",
|
||||
"claude:cli",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
true,
|
||||
"codex",
|
||||
Some(&body_rules),
|
||||
@@ -257,7 +257,7 @@ fn injects_codex_prompt_cache_key_for_openai_responses_cross_format_requests() {
|
||||
&body_json,
|
||||
"gpt-5-upstream",
|
||||
"claude:cli",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
true,
|
||||
"codex",
|
||||
None,
|
||||
@@ -285,7 +285,7 @@ fn injects_codex_prompt_cache_key_for_openai_chat_cross_format_requests() {
|
||||
&body_json,
|
||||
"gpt-5-upstream",
|
||||
"codex",
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
false,
|
||||
None,
|
||||
Some("key-123"),
|
||||
|
||||
@@ -96,12 +96,7 @@ pub(crate) use aether_ai_pipeline::api::{
|
||||
KIRO_ENVELOPE_NAME, KIRO_MAX_THINKING_BUFFER, OPENAI_CHAT_STREAM_PLAN_KIND,
|
||||
OPENAI_CHAT_STREAM_SUCCESS_REPORT_KIND, OPENAI_CHAT_SYNC_ERROR_REPORT_KIND,
|
||||
OPENAI_CHAT_SYNC_FINALIZE_REPORT_KIND, OPENAI_CHAT_SYNC_PLAN_KIND,
|
||||
OPENAI_CHAT_SYNC_SUCCESS_REPORT_KIND, OPENAI_CLI_STREAM_PLAN_KIND,
|
||||
OPENAI_CLI_STREAM_SUCCESS_REPORT_KIND, OPENAI_CLI_SYNC_ERROR_REPORT_KIND,
|
||||
OPENAI_CLI_SYNC_FINALIZE_REPORT_KIND, OPENAI_CLI_SYNC_PLAN_KIND,
|
||||
OPENAI_CLI_SYNC_SUCCESS_REPORT_KIND, OPENAI_COMPACT_STREAM_PLAN_KIND,
|
||||
OPENAI_COMPACT_SYNC_ERROR_REPORT_KIND, OPENAI_COMPACT_SYNC_FINALIZE_REPORT_KIND,
|
||||
OPENAI_COMPACT_SYNC_PLAN_KIND, OPENAI_IMAGE_STREAM_PLAN_KIND,
|
||||
OPENAI_CHAT_SYNC_SUCCESS_REPORT_KIND, OPENAI_IMAGE_STREAM_PLAN_KIND,
|
||||
OPENAI_IMAGE_STREAM_SUCCESS_REPORT_KIND, OPENAI_IMAGE_SYNC_FINALIZE_REPORT_KIND,
|
||||
OPENAI_IMAGE_SYNC_PLAN_KIND, OPENAI_IMAGE_SYNC_SUCCESS_REPORT_KIND,
|
||||
OPENAI_RESPONSES_COMPACT_STREAM_PLAN_KIND, OPENAI_RESPONSES_COMPACT_STREAM_SUCCESS_REPORT_KIND,
|
||||
|
||||
@@ -367,7 +367,7 @@ fn classifies_admin_refresh_provider_quota_as_admin_proxy_route() {
|
||||
#[test]
|
||||
fn classifies_admin_default_body_rules_as_admin_proxy_route() {
|
||||
let headers = headers(&[]);
|
||||
let uri: Uri = "/api/admin/endpoints/defaults/openai:cli/body-rules?provider_type=codex"
|
||||
let uri: Uri = "/api/admin/endpoints/defaults/openai:responses/body-rules?provider_type=codex"
|
||||
.parse()
|
||||
.expect("uri should parse");
|
||||
let decision =
|
||||
|
||||
@@ -516,7 +516,7 @@ async fn data_state_reads_decrypted_provider_transport_snapshot() {
|
||||
.expect("endpoint transport should build");
|
||||
let key = sample_provider_catalog_key()
|
||||
.with_transport_fields(
|
||||
Some(serde_json::json!(["openai:chat", "openai:cli"])),
|
||||
Some(serde_json::json!(["openai:chat", "openai:responses"])),
|
||||
encrypted_api_key,
|
||||
Some(encrypted_auth_config),
|
||||
Some(serde_json::json!({"openai:chat": 0.8})),
|
||||
@@ -547,7 +547,10 @@ async fn data_state_reads_decrypted_provider_transport_snapshot() {
|
||||
assert_eq!(snapshot.endpoint.base_url, "https://api.openai.com");
|
||||
assert_eq!(
|
||||
snapshot.key.api_formats,
|
||||
Some(vec!["openai:chat".to_string(), "openai:cli".to_string()])
|
||||
Some(vec![
|
||||
"openai:chat".to_string(),
|
||||
"openai:responses".to_string()
|
||||
])
|
||||
);
|
||||
assert_eq!(snapshot.key.decrypted_api_key, "sk-live-openai");
|
||||
assert_eq!(
|
||||
|
||||
@@ -108,8 +108,6 @@ pub(crate) fn should_fallback_to_control_sync(
|
||||
| "openai_chat_sync"
|
||||
| "openai_responses_sync"
|
||||
| "openai_responses_compact_sync"
|
||||
| "openai_cli_sync"
|
||||
| "openai_compact_sync"
|
||||
| "claude_chat_sync"
|
||||
| "gemini_chat_sync"
|
||||
| "claude_cli_sync"
|
||||
@@ -155,8 +153,6 @@ pub(crate) fn resolve_core_sync_error_finalize_report_kind(
|
||||
"openai_chat_sync" => "openai_chat_sync_finalize",
|
||||
"openai_responses_sync" => "openai_responses_sync_finalize",
|
||||
"openai_responses_compact_sync" => "openai_responses_compact_sync_finalize",
|
||||
"openai_cli_sync" => "openai_cli_sync_finalize",
|
||||
"openai_compact_sync" => "openai_compact_sync_finalize",
|
||||
"claude_chat_sync" => "claude_chat_sync_finalize",
|
||||
"gemini_chat_sync" => "gemini_chat_sync_finalize",
|
||||
"claude_cli_sync" => "claude_cli_sync_finalize",
|
||||
@@ -283,8 +279,6 @@ pub(crate) fn should_fallback_to_control_stream(
|
||||
| "gemini_chat_stream"
|
||||
| "openai_responses_stream"
|
||||
| "openai_responses_compact_stream"
|
||||
| "openai_cli_stream"
|
||||
| "openai_compact_stream"
|
||||
| "claude_cli_stream"
|
||||
| "gemini_cli_stream"
|
||||
) && status_code >= 400
|
||||
@@ -304,8 +298,6 @@ pub(crate) fn resolve_core_stream_error_finalize_report_kind(
|
||||
"gemini_chat_stream" => "gemini_chat_sync_finalize",
|
||||
"openai_responses_stream" => "openai_responses_sync_finalize",
|
||||
"openai_responses_compact_stream" => "openai_responses_compact_sync_finalize",
|
||||
"openai_cli_stream" => "openai_cli_sync_finalize",
|
||||
"openai_compact_stream" => "openai_compact_sync_finalize",
|
||||
"claude_cli_stream" => "claude_cli_sync_finalize",
|
||||
"gemini_cli_stream" => "gemini_cli_sync_finalize",
|
||||
_ => return None,
|
||||
@@ -322,8 +314,6 @@ pub(crate) fn resolve_core_stream_direct_finalize_report_kind(plan_kind: &str) -
|
||||
"gemini_chat_stream" => "gemini_chat_sync_finalize",
|
||||
"openai_responses_stream" => "openai_responses_sync_finalize",
|
||||
"openai_responses_compact_stream" => "openai_responses_compact_sync_finalize",
|
||||
"openai_cli_stream" => "openai_cli_sync_finalize",
|
||||
"openai_compact_stream" => "openai_compact_sync_finalize",
|
||||
"claude_cli_stream" => "claude_cli_sync_finalize",
|
||||
"gemini_cli_stream" => "gemini_cli_sync_finalize",
|
||||
_ => return None,
|
||||
|
||||
@@ -117,7 +117,7 @@ fn resolve_core_error_background_report_kind_maps_all_core_finalize_kinds() {
|
||||
),
|
||||
(
|
||||
"openai_compact_sync_finalize",
|
||||
Some("openai_responses_sync_error"),
|
||||
Some("openai_responses_compact_sync_error"),
|
||||
),
|
||||
("claude_cli_sync_finalize", Some("claude_cli_sync_error")),
|
||||
("gemini_cli_sync_finalize", Some("gemini_cli_sync_error")),
|
||||
@@ -164,7 +164,7 @@ fn resolve_core_success_background_report_kind_maps_all_core_finalize_kinds() {
|
||||
),
|
||||
(
|
||||
"openai_compact_sync_finalize",
|
||||
Some("openai_responses_sync_success"),
|
||||
Some("openai_responses_compact_sync_success"),
|
||||
),
|
||||
("claude_cli_sync_finalize", Some("claude_cli_sync_success")),
|
||||
("gemini_cli_sync_finalize", Some("gemini_cli_sync_success")),
|
||||
|
||||
@@ -336,7 +336,7 @@ mod tests {
|
||||
#[test]
|
||||
fn fixed_oauth_key_with_legacy_explicit_formats_still_inherits_provider_formats() {
|
||||
let mut key = sample_key("oauth");
|
||||
key.api_formats = Some(json!(["openai:compact"]));
|
||||
key.api_formats = Some(json!(["openai:responses:compact"]));
|
||||
let endpoints = vec![
|
||||
sample_endpoint("openai:responses", true),
|
||||
sample_endpoint("openai:image", true),
|
||||
|
||||
@@ -1165,22 +1165,22 @@ async fn skips_codex_candidate_when_account_quota_is_exhausted_and_pool_flag_ena
|
||||
first.provider_name = "codex".to_string();
|
||||
first.provider_type = "codex".to_string();
|
||||
first.endpoint_id = "endpoint-codex".to_string();
|
||||
first.endpoint_api_format = "openai:cli".to_string();
|
||||
first.endpoint_api_format = "openai:responses".to_string();
|
||||
first.key_id = "key-codex".to_string();
|
||||
first.key_name = "codex-exhausted".to_string();
|
||||
first.key_auth_type = "oauth".to_string();
|
||||
first.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
first.key_global_priority_by_format = Some(serde_json::json!({"openai:cli": 1}));
|
||||
first.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
first.key_global_priority_by_format = Some(serde_json::json!({"openai:responses": 1}));
|
||||
|
||||
let mut second = sample_row();
|
||||
second.provider_id = "provider-openai".to_string();
|
||||
second.provider_name = "openai".to_string();
|
||||
second.endpoint_id = "endpoint-openai".to_string();
|
||||
second.endpoint_api_format = "openai:cli".to_string();
|
||||
second.endpoint_api_format = "openai:responses".to_string();
|
||||
second.key_id = "key-openai".to_string();
|
||||
second.key_name = "fallback".to_string();
|
||||
second.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
second.key_global_priority_by_format = Some(serde_json::json!({"openai:cli": 2}));
|
||||
second.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
second.key_global_priority_by_format = Some(serde_json::json!({"openai:responses": 2}));
|
||||
|
||||
let candidates = Arc::new(InMemoryMinimalCandidateSelectionReadRepository::seed(vec![
|
||||
first, second,
|
||||
@@ -1225,7 +1225,7 @@ async fn skips_codex_candidate_when_account_quota_is_exhausted_and_pool_flag_ena
|
||||
let (selected, skipped) = collect_selectable_candidates_with_skip_reasons(
|
||||
state.data.as_ref(),
|
||||
&state,
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"gpt-4.1",
|
||||
false,
|
||||
None,
|
||||
@@ -1248,22 +1248,22 @@ async fn skips_oauth_invalid_candidate_before_local_auth_resolution() {
|
||||
first.provider_name = "codex".to_string();
|
||||
first.provider_type = "codex".to_string();
|
||||
first.endpoint_id = "endpoint-codex".to_string();
|
||||
first.endpoint_api_format = "openai:cli".to_string();
|
||||
first.endpoint_api_format = "openai:responses".to_string();
|
||||
first.key_id = "key-codex".to_string();
|
||||
first.key_name = "codex-invalid".to_string();
|
||||
first.key_auth_type = "oauth".to_string();
|
||||
first.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
first.key_global_priority_by_format = Some(serde_json::json!({"openai:cli": 1}));
|
||||
first.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
first.key_global_priority_by_format = Some(serde_json::json!({"openai:responses": 1}));
|
||||
|
||||
let mut second = sample_row();
|
||||
second.provider_id = "provider-openai".to_string();
|
||||
second.provider_name = "openai".to_string();
|
||||
second.endpoint_id = "endpoint-openai".to_string();
|
||||
second.endpoint_api_format = "openai:cli".to_string();
|
||||
second.endpoint_api_format = "openai:responses".to_string();
|
||||
second.key_id = "key-openai".to_string();
|
||||
second.key_name = "fallback".to_string();
|
||||
second.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
second.key_global_priority_by_format = Some(serde_json::json!({"openai:cli": 2}));
|
||||
second.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
second.key_global_priority_by_format = Some(serde_json::json!({"openai:responses": 2}));
|
||||
|
||||
let candidates = Arc::new(InMemoryMinimalCandidateSelectionReadRepository::seed(vec![
|
||||
first, second,
|
||||
@@ -1303,7 +1303,7 @@ async fn skips_oauth_invalid_candidate_before_local_auth_resolution() {
|
||||
let (selected, skipped) = collect_selectable_candidates_with_skip_reasons(
|
||||
state.data.as_ref(),
|
||||
&state,
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"gpt-4.1",
|
||||
false,
|
||||
None,
|
||||
@@ -1326,11 +1326,11 @@ async fn keeps_request_failed_oauth_candidate_selectable() {
|
||||
row.provider_name = "codex".to_string();
|
||||
row.provider_type = "codex".to_string();
|
||||
row.endpoint_id = "endpoint-codex".to_string();
|
||||
row.endpoint_api_format = "openai:cli".to_string();
|
||||
row.endpoint_api_format = "openai:responses".to_string();
|
||||
row.key_id = "key-codex".to_string();
|
||||
row.key_name = "codex-check-failed".to_string();
|
||||
row.key_auth_type = "oauth".to_string();
|
||||
row.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
row.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
|
||||
let candidates = Arc::new(InMemoryMinimalCandidateSelectionReadRepository::seed(vec![
|
||||
row,
|
||||
@@ -1364,7 +1364,7 @@ async fn keeps_request_failed_oauth_candidate_selectable() {
|
||||
let (selected, skipped) = collect_selectable_candidates_with_skip_reasons(
|
||||
state.data.as_ref(),
|
||||
&state,
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"gpt-4.1",
|
||||
false,
|
||||
None,
|
||||
@@ -1621,22 +1621,22 @@ async fn keeps_codex_candidate_selectable_when_exhausted_account_flag_is_disable
|
||||
first.provider_name = "codex".to_string();
|
||||
first.provider_type = "codex".to_string();
|
||||
first.endpoint_id = "endpoint-codex".to_string();
|
||||
first.endpoint_api_format = "openai:cli".to_string();
|
||||
first.endpoint_api_format = "openai:responses".to_string();
|
||||
first.key_id = "key-codex".to_string();
|
||||
first.key_name = "codex-exhausted".to_string();
|
||||
first.key_auth_type = "oauth".to_string();
|
||||
first.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
first.key_global_priority_by_format = Some(serde_json::json!({"openai:cli": 1}));
|
||||
first.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
first.key_global_priority_by_format = Some(serde_json::json!({"openai:responses": 1}));
|
||||
|
||||
let mut second = sample_row();
|
||||
second.provider_id = "provider-openai".to_string();
|
||||
second.provider_name = "openai".to_string();
|
||||
second.endpoint_id = "endpoint-openai".to_string();
|
||||
second.endpoint_api_format = "openai:cli".to_string();
|
||||
second.endpoint_api_format = "openai:responses".to_string();
|
||||
second.key_id = "key-openai".to_string();
|
||||
second.key_name = "fallback".to_string();
|
||||
second.key_api_formats = Some(vec!["openai:cli".to_string()]);
|
||||
second.key_global_priority_by_format = Some(serde_json::json!({"openai:cli": 2}));
|
||||
second.key_api_formats = Some(vec!["openai:responses".to_string()]);
|
||||
second.key_global_priority_by_format = Some(serde_json::json!({"openai:responses": 2}));
|
||||
|
||||
let candidates = Arc::new(InMemoryMinimalCandidateSelectionReadRepository::seed(vec![
|
||||
first, second,
|
||||
@@ -1679,7 +1679,7 @@ async fn keeps_codex_candidate_selectable_when_exhausted_account_flag_is_disable
|
||||
let (selected, skipped) = collect_selectable_candidates_with_skip_reasons(
|
||||
state.data.as_ref(),
|
||||
&state,
|
||||
"openai:cli",
|
||||
"openai:responses",
|
||||
"gpt-4.1",
|
||||
false,
|
||||
None,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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!(
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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",
|
||||
)],
|
||||
));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user