Clarify API key concurrency skip reasons

This commit is contained in:
fawney19
2026-05-27 17:00:09 +08:00
parent d77a572dc7
commit 42e723ff7c
9 changed files with 96 additions and 53 deletions
@@ -1249,12 +1249,12 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
.headers()
.get(LOCAL_EXECUTION_RUNTIME_MISS_REASON_HEADER)
.and_then(|value| value.to_str().ok()),
Some("api_key_concurrency_limit_reached")
Some("auth_api_key_concurrency_limit_reached")
);
let payload: serde_json::Value = response.json().await.expect("body should parse");
assert_eq!(
payload["error"]["message"],
serde_json::Value::String("当前 API Key 并发请求数已达上限,请稍后重试".to_string())
serde_json::Value::String("当前调用方 API Key 并发请求数已达上限,请稍后重试".to_string())
);
let stored_candidates = request_candidate_repository
@@ -1265,7 +1265,7 @@ async fn gateway_returns_concurrency_limited_after_wait_budget_expires_for_opena
assert_eq!(stored_candidates[0].status, RequestCandidateStatus::Skipped);
assert_eq!(
stored_candidates[0].skip_reason.as_deref(),
Some("api_key_concurrency_limit_reached")
Some("auth_api_key_concurrency_limit_reached")
);
assert_eq!(
*execution_runtime_hits.lock().expect("mutex should lock"),
@@ -371,7 +371,7 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
"candidate/mod.rs should not own the core selectable-candidate collector anymore"
);
assert!(
!candidate_mod.contains("auth_api_key_concurrency_limit_reached"),
!candidate_mod.contains("auth_api_key_concurrency_limit_reached("),
"candidate/mod.rs should not own the core auth api key concurrency helper anymore"
);
assert!(
@@ -463,7 +463,7 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
"read_provider_key_rpm_states(",
"candidate_is_selectable_with_runtime_state",
"collect_selectable_candidates_from_keys",
"auth_api_key_concurrency_limit_reached",
"auth_api_key_concurrency_limit_reached(",
"build_provider_concurrent_limit_map(",
"reorder_candidates_by_scheduler_health",
] {
@@ -487,7 +487,7 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
"candidate/runtime.rs should keep affinity out of runtime eligibility checks"
);
assert!(
runtime.contains("auth_api_key_concurrency_limit_reached"),
runtime.contains("auth_api_key_concurrency_limit_reached("),
"candidate/runtime.rs should depend on core auth api key concurrency helper"
);
assert!(