Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style: apply rustfmt formatting to http error demotion code

Steven Enamakel65e8169bf9d8
diff --git a/crates/openhuman-core/src/inference/provider/http_error.rs b/crates/openhuman-core/src/inference/provider/http_error.rs
index 8c7d2189dd..3600d7b825 100644
--- a/crates/openhuman-core/src/inference/provider/http_error.rs
+++ b/crates/openhuman-core/src/inference/provider/http_error.rs
@@ -144,13 +144,15 @@ fn select_demotion(
backend_error_code_owned: bool,
) -> HostDemotion {
let decision = demote_decision(facts, provider_is_managed);
- if let Some(kind @ (DemotionKind::BudgetExhausted
- | DemotionKind::NoModelLoaded
- | DemotionKind::CustomUpstreamBadRequest
- | DemotionKind::AccessPolicyDenied
- | DemotionKind::ConfigurationRejected
- | DemotionKind::ContextWindowExceeded
- | DemotionKind::QuotaExhausted)) = decision
+ if let Some(
+ kind @ (DemotionKind::BudgetExhausted
+ | DemotionKind::NoModelLoaded
+ | DemotionKind::CustomUpstreamBadRequest
+ | DemotionKind::AccessPolicyDenied
+ | DemotionKind::ConfigurationRejected
+ | DemotionKind::ContextWindowExceeded
+ | DemotionKind::QuotaExhausted),
+ ) = decision
{
HostDemotion::Provider(kind)
} else if backend_error_code_owned {
@@ -196,34 +198,36 @@ impl ErrorReporter for HostErrorReporter<'_> {
) {
match decision {
HostDemotion::Provider(kind) => match kind {
- DemotionKind::BudgetExhausted => demote("budget", "budget-exhausted 400", false),
- DemotionKind::NoModelLoaded => demote(
- "provider_user_state",
- "local_provider_no_model_loaded",
- false,
- ),
- DemotionKind::CustomUpstreamBadRequest => demote(
- "provider_user_state",
- "custom_openai_upstream_bad_request",
- false,
- ),
- DemotionKind::AccessPolicyDenied => demote(
- "provider_access_policy",
- "provider access-policy 403",
- false,
- ),
- DemotionKind::ConfigurationRejected => demote(
- "provider_config_rejection",
- "provider config-rejection",
- false,
- ),
- DemotionKind::ContextWindowExceeded => {
- demote("context_window_exceeded", "context-window exceeded", true)
- }
- DemotionKind::QuotaExhausted => {
- demote("quota_exhausted", "provider monthly-quota exhausted", false)
- }
- _ => unreachable!("only precedence-preserving decisions enter this arm"),
+ DemotionKind::BudgetExhausted => {
+ demote("budget", "budget-exhausted 400", false)
+ }
+ DemotionKind::NoModelLoaded => demote(
+ "provider_user_state",
+ "local_provider_no_model_loaded",
+ false,
+ ),
+ DemotionKind::CustomUpstreamBadRequest => demote(
+ "provider_user_state",
+ "custom_openai_upstream_bad_request",
+ false,
+ ),
+ DemotionKind::AccessPolicyDenied => demote(
+ "provider_access_policy",
+ "provider access-policy 403",
+ false,
+ ),
+ DemotionKind::ConfigurationRejected => demote(
+ "provider_config_rejection",
+ "provider config-rejection",
+ false,
+ ),
+ DemotionKind::ContextWindowExceeded => {
+ demote("context_window_exceeded", "context-window exceeded", true)
+ }
+ DemotionKind::QuotaExhausted => {
+ demote("quota_exhausted", "provider monthly-quota exhausted", false)
+ }
+ _ => unreachable!("only precedence-preserving decisions enter this arm"),
},
_ => unreachable!("precedence arm only selects provider demotions"),
}
diff --git a/crates/openhuman-core/src/inference/provider/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
index 06c70c4062..7d786cee86 100644
--- a/crates/openhuman-core/src/inference/provider/http_error_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
@@ -425,11 +425,11 @@ fn quota_demotion_precedes_backend_owned_error_code_guard() {
extensions,
);
crate::core::runtime::CoreContext::sync_scope(context, || {
- let facts = tinyinference_llm::failure::http::classify_http_failure(
- PROVIDER,
- StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
- BODY,
- );
+ let facts = tinyinference_llm::failure::http::classify_http_failure(
+ PROVIDER,
+ StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
+ BODY,
+ );
assert!(is_backend_error_code_owned(PROVIDER, BODY));
assert_eq!(
select_demotion(&facts, true, is_backend_error_code_owned(PROVIDER, BODY)),
diff --git a/crates/openhuman-core/src/triage/evaluator_fallback_chain_tests.rs b/crates/openhuman-core/src/triage/evaluator_fallback_chain_tests.rs
index e701539d76..61e3310330 100644
--- a/crates/openhuman-core/src/triage/evaluator_fallback_chain_tests.rs
+++ b/crates/openhuman-core/src/triage/evaluator_fallback_chain_tests.rs
@@ -102,9 +102,7 @@ fn classify_string_keeps_context_and_quota_failures_terminal_even_with_500_statu
#[test]
fn classify_string_keeps_non_retryable_rate_limit_distinct() {
- let err = classify_error(
- "HTTP 429: monthly quota exhausted; Retry-After: 2".to_string(),
- );
+ let err = classify_error("HTTP 429: monthly quota exhausted; Retry-After: 2".to_string());
assert!(
matches!(err, ArmError::Fatal(_)),
"billing rate limit remains terminal despite Retry-After"