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
fix(observability): classify HTTP errors by status code range
Steven Enamakel24d47143a1a9
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rsindex a087cf6d64..03a9cb35b9 100644--- a/crates/openhuman-core/src/core/observability.rs+++ b/crates/openhuman-core/src/core/observability.rs@@ -655,7 +655,7 @@ pub fn expected_error_kind(message: &str) -> Option<ExpectedErrorKind> {// emit; this catches the re-raise. Delegates to the single-source// provider matcher so the phrasing can't drift. Runs last so a more// specific matcher always wins.- if crate::inference::provider::is_context_window_exceeded_message(message) {+ if tinyinference_llm::failure::is_context_window_exceeded_message(message) {return Some(ExpectedErrorKind::ContextWindowExceeded);}if is_memory_store_breaker_open(&lower) {@@ -1641,7 +1641,7 @@ fn is_provider_user_state_message(lower: &str) -> bool {// in `expected_error_kind`, before this matcher runs, so this arm only ever// sees direct-provider TPM rejections. Shared matcher so the wording can't// drift.- if crate::inference::provider::is_provider_rate_cap_exceeded_message(lower) {+ if tinyinference_llm::failure::is_provider_rate_cap_exceeded_message(lower) {return true;}@@ -3199,7 +3199,7 @@ pub fn is_insufficient_credits_message(text: &str) -> bool {let body = lower.split_once("): ").map_or(lower.as_str(), |(_, body)| body);- crate::inference::provider::body_indicates_insufficient_credits(body)+ tinyinference_llm::failure::body_indicates_insufficient_credits(body)}/// Defense-in-depth `before_send` filter for **insufficient-credits 402**@@ -3246,7 +3246,7 @@ pub fn is_insufficient_credits_event(event: &sentry::protocol::Event<'_>) -> boo/// the emit-site guard and this `before_send` net can't drift. Shared with the/// event-level filter [`is_quota_exhausted_event`].pub fn is_quota_exhausted_message(text: &str) -> bool {- crate::inference::provider::body_indicates_quota_exhausted(text)+ tinyinference_llm::failure::body_indicates_quota_exhausted(text)}/// Defense-in-depth `before_send` filter for provider **monthly-quotadiff --git a/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs b/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rsindex d8febbb49a..de8218275b 100644--- a/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs+++ b/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs@@ -473,7 +473,7 @@ fn expected_kind_demotes_every_backend_owned_error_code() {// bypass `expected_error_kind` would have re-demoted it to the// suppressed `ContextWindowExceeded` bucket.assert!(- crate::inference::provider::is_context_window_exceeded_message(context),+ tinyinference_llm::failure::is_context_window_exceeded_message(context),"test body must actually trigger the matcher the bypass guards against");}diff --git a/crates/openhuman-core/src/inference/provider/error_classify.rs b/crates/openhuman-core/src/inference/provider/error_classify.rsindex 88eff917b3..a514ba42a6 100644--- a/crates/openhuman-core/src/inference/provider/error_classify.rs+++ b/crates/openhuman-core/src/inference/provider/error_classify.rs@@ -11,9 +11,9 @@ fn classify(err: &anyhow::Error) -> ProviderFailureClass {// Product/account-state failures are terminal even when an upstream proxy// wrapped them in a nominally retryable status (for example a 500 carrying// MONTHLY_REQUEST_COUNT). These rules intentionally stay host-side.- if super::is_context_window_exceeded_message(&message)+ if tinyinference_llm::failure::is_context_window_exceeded_message(&message)|| crate::core::observability::is_session_expired_message(&message)- || crate::inference::provider::body_indicates_quota_exhausted(&message)+ || tinyinference_llm::failure::body_indicates_quota_exhausted(&message){return ProviderFailureClass::NonRetryable;}diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error.rs b/crates/openhuman-core/src/inference/provider/ops/http_error.rsindex c457998de8..adbe9e1746 100644--- a/crates/openhuman-core/src/inference/provider/ops/http_error.rs+++ b/crates/openhuman-core/src/inference/provider/ops/http_error.rs@@ -29,6 +29,7 @@ mod quota_and_credits;// (mirrors the pre-split `include!`-shared scope).use crate::inference::provider::openhuman_backend_model;use tinyinference_core::sanitize::sanitize_api_error;+use tinyinference_llm::failure::{body_indicates_quota_exhausted, is_context_window_exceeded_message};pub use auth_failure::{is_backend_auth_failure, is_byo_provider_auth_failure_http,@@ -36,10 +37,6 @@ pub use auth_failure::{log_openai_oauth_session_expired, publish_backend_session_expired,};pub use context_window::log_context_window_exceeded;-pub use tinyinference_llm::failure::{- body_indicates_insufficient_credits, body_indicates_quota_exhausted,- is_context_window_exceeded_message, is_provider_rate_cap_exceeded_message,-};pub use dispatch::{api_error, should_report_provider_http_failure};pub use local_provider::{is_local_provider_no_model_loaded, is_ollama_cloud_internal_500,diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rsindex fb37344949..62c54f7700 100644--- a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs@@ -107,7 +107,7 @@ fn quota_and_credits_matchers_do_not_overlap_on_c9a() {StatusCode::INTERNAL_SERVER_ERROR,C9A_BODY));- assert!(body_indicates_quota_exhausted(C9A_BODY));+ assert!(tinyinference_llm::failure::body_indicates_quota_exhausted(C9A_BODY));}/// Verbatim TAURI-RUST-8FQ Responses-API body. The matcher keys on thisdiff --git a/crates/openhuman-core/src/inference/provider/ops/mod.rs b/crates/openhuman-core/src/inference/provider/ops/mod.rsindex fbedc6ec4f..e148e88d81 100644--- a/crates/openhuman-core/src/inference/provider/ops/mod.rs+++ b/crates/openhuman-core/src/inference/provider/ops/mod.rs@@ -13,15 +13,15 @@ mod provider_factory;// ── public surface (preserves the original `pub use ops::*` contract) ──pub use http_error::{- api_error, body_indicates_insufficient_credits, body_indicates_quota_exhausted,+ api_error,is_backend_auth_failure, is_backend_error_code_owned, is_budget_exhausted_http_400,- is_byo_provider_auth_failure_http, is_context_window_exceeded_message,+ is_byo_provider_auth_failure_http,is_custom_openai_upstream_bad_request_http_400, is_local_provider_no_model_loaded,is_ollama_cloud_internal_500, is_ollama_cloud_internal_500_message,is_openai_oauth_session_expired_http, is_provider_access_policy_denied_http_403,is_provider_config_rejection_http, is_provider_insufficient_credits_402,is_provider_moderation_rejection_http_400,- is_provider_rate_cap_exceeded_message, local_provider_no_model_loaded_user_message,+ local_provider_no_model_loaded_user_message,log_backend_error_code_owned, log_budget_exhausted_http_400, log_byo_provider_auth_failure,log_context_window_exceeded, log_custom_openai_upstream_bad_request_http_400,log_local_provider_no_model_loaded, log_ollama_cloud_internal_500,diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rsindex 1ca0e3e5fe..e5bcd9d92a 100644--- a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs@@ -287,7 +287,7 @@ async fn api_error_monthly_quota_returns_message_via_demoted_branch() {);// The body must classify as quota-exhausted so the demote branch — not the// 500 status gate — handles it.- assert!(body_indicates_quota_exhausted(body));+ assert!(tinyinference_llm::failure::body_indicates_quota_exhausted(body));assert!(should_report_provider_http_failure(StatusCode::INTERNAL_SERVER_ERROR));