The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
style(inference): reorder imports and reformat demotion arms
Steven Enamakel19648a01fdd0
diff --git a/crates/openhuman-core/src/inference/failure_copy/table.rs b/crates/openhuman-core/src/inference/failure_copy/table.rsindex 034e3c773c..e90186985a 100644--- a/crates/openhuman-core/src/inference/failure_copy/table.rs+++ b/crates/openhuman-core/src/inference/failure_copy/table.rs@@ -4,7 +4,7 @@//! TinyInference's defaults through `FailureCopyProvider`.use tinyinference_llm::failure::copy::{- FailureCopy, FailureCopyClass, FailureCopyProvider, failure_copy_with,+ failure_copy_with, FailureCopy, FailureCopyClass, FailureCopyProvider,};/// A failure class the chat surface renders copy for. Several classifier armsdiff --git a/crates/openhuman-core/src/inference/provider/http_error.rs b/crates/openhuman-core/src/inference/provider/http_error.rsindex 6e5b49fd26..47ba36e9d8 100644--- a/crates/openhuman-core/src/inference/provider/http_error.rs+++ b/crates/openhuman-core/src/inference/provider/http_error.rs@@ -14,8 +14,8 @@ use tinyinference_llm::failure::http::{classify_and_report_http_failure, ErrorReporter, ProviderHttpFailure, ProviderHttpFailureFacts,};use tinyinference_llm::failure::{- demote_decision, DemotionKind, local_provider_no_model_loaded_user_message,- ollama_cloud_internal_500_user_message, should_report_provider_http_status,+ demote_decision, local_provider_no_model_loaded_user_message,+ ollama_cloud_internal_500_user_message, should_report_provider_http_status, DemotionKind,};/// Whether a non-2xx provider status is worth a per-attempt Sentry report.@@ -164,17 +164,31 @@ impl ErrorReporter for HostErrorReporter<'_> {match decision.expect("matched demotion") {DemotionKind::BudgetExhausted => demote("budget", "budget-exhausted 400", false),DemotionKind::NoModelLoaded => demote(- "provider_user_state", "local_provider_no_model_loaded", false),+ "provider_user_state",+ "local_provider_no_model_loaded",+ false,+ ),DemotionKind::CustomUpstreamBadRequest => demote(- "provider_user_state", "custom_openai_upstream_bad_request", false),+ "provider_user_state",+ "custom_openai_upstream_bad_request",+ false,+ ),DemotionKind::AccessPolicyDenied => demote(- "provider_access_policy", "provider access-policy 403", false),+ "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),+ "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"),}} else if self.backend_error_code_owned {@@ -184,14 +198,24 @@ impl ErrorReporter for HostErrorReporter<'_> {DemotionKind::ApiKeyRejected => {log_byo_provider_auth_failure(operation, provider, model, status_code)}- DemotionKind::OAuthSessionExpired => demote(- "provider_user_state", "openai_oauth_session_expired", false),+ DemotionKind::OAuthSessionExpired => {+ demote("provider_user_state", "openai_oauth_session_expired", false)+ }DemotionKind::InsufficientCredits => demote(- "insufficient_credits", "provider insufficient-credits 402", false),+ "insufficient_credits",+ "provider insufficient-credits 402",+ false,+ ),DemotionKind::OllamaCloudInternalError => demote(- "ollama_cloud_internal_500", "Ollama Cloud hosted-inference 500", false),+ "ollama_cloud_internal_500",+ "Ollama Cloud hosted-inference 500",+ false,+ ),DemotionKind::ModerationRejected => demote(- "external_moderation_rejection", "external content-moderation rejection", false),+ "external_moderation_rejection",+ "external content-moderation rejection",+ false,+ ),_ => unreachable!("earlier decisions were handled above"),}} else if should_report_provider_http_status(status) {diff --git a/crates/openhuman-core/src/inference/provider/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/http_error_tests.rsindex cb634e58a2..31352cbfeb 100644--- a/crates/openhuman-core/src/inference/provider/http_error_tests.rs+++ b/crates/openhuman-core/src/inference/provider/http_error_tests.rs@@ -399,7 +399,7 @@ fn provider_http_policy_uses_registered_error_ownership_metadata() {#[test]fn demotion_decision_keeps_quota_ahead_of_backend_owned_error_code() {- use tinyinference_llm::failure::{DemotionKind, demote_decision};+ use tinyinference_llm::failure::{demote_decision, DemotionKind};let facts = tinyinference_llm::failure::http::classify_http_failure("fixture-byo-provider",StatusCode::INTERNAL_SERVER_ERROR.as_u16(),@@ -413,7 +413,7 @@ fn demotion_decision_keeps_quota_ahead_of_backend_owned_error_code() {#[test]fn managed_unknown_model_remains_user_configuration_state() {- use tinyinference_llm::failure::{DemotionKind, demote_decision};+ use tinyinference_llm::failure::{demote_decision, DemotionKind};let facts = tinyinference_llm::failure::http::classify_http_failure("openhuman",StatusCode::BAD_REQUEST.as_u16(),diff --git a/crates/openhuman-core/src/triage/evaluator/arm.rs b/crates/openhuman-core/src/triage/evaluator/arm.rsindex 3b3cb36bb4..c12fa4f482 100644--- a/crates/openhuman-core/src/triage/evaluator/arm.rs+++ b/crates/openhuman-core/src/triage/evaluator/arm.rs@@ -244,16 +244,12 @@ pub(crate) fn classify_error(message: String) -> ArmError {if is_prompt_guard_rejection(&message) {return ArmError::SafetyFlagged(err);}- let failure = tinyinference_llm::failure::classify_provider_failure_with(- None,- None,- &message,- |value| {+ let failure =+ tinyinference_llm::failure::classify_provider_failure_with(None, None, &message, |value| {crate::core::observability::is_session_expired_message(value)|| tinyinference_llm::failure::is_context_window_exceeded_message(value)|| tinyinference_llm::failure::body_indicates_quota_exhausted(value)- },- );+ });// Keep the harness's detailed failover reason mapping while using the// provider-neutral classifier to distinguish retryable and exhausted// rate limits and preserve terminal account/context failures.