Add provider key cycle stats reset handling

This commit is contained in:
fawney19
2026-05-07 03:23:20 +08:00
parent 6c0ac2e8da
commit 10e679bb2f
35 changed files with 1443 additions and 273 deletions

View File

@@ -731,6 +731,10 @@ fn local_candidate_failure_should_record_pool_error(
classification: LocalFailoverClassification,
status_code: u16,
) -> bool {
if status_code == 400 {
return false;
}
local_candidate_failure_should_invalidate_affinity(classification, status_code)
}
@@ -1441,6 +1445,10 @@ mod tests {
LocalFailoverClassification::StopErrorPattern,
400,
));
assert!(!local_candidate_failure_should_record_pool_error(
LocalFailoverClassification::RetryUpstreamFailure,
400,
));
assert!(local_candidate_failure_should_record_pool_error(
LocalFailoverClassification::RetryUpstreamFailure,
429,

View File

@@ -144,6 +144,9 @@ fn local_candidate_failure_should_project_health(
if status_code < 400 {
return false;
}
if status_code == 400 {
return false;
}
match classification {
LocalFailoverClassification::RetrySuccessPattern
@@ -216,6 +219,18 @@ mod tests {
.is_none());
}
#[test]
fn failure_projection_ignores_client_bad_request() {
assert!(project_local_failure_health(
None,
"openai:chat",
LocalFailoverClassification::RetryUpstreamFailure,
400,
1_760_000_000,
)
.is_none());
}
#[test]
fn success_projection_resets_only_target_format() {
let projected = project_local_success_health(