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(backend): handle empty input in classify function
Steven Enamakel88eedff21c23
diff --git a/crates/openhuman-core/src/backend/classify.rs b/crates/openhuman-core/src/backend/classify.rsdeleted file mode 100644index 5654cb5590..0000000000--- a/crates/openhuman-core/src/backend/classify.rs+++ /dev/null@@ -1,25 +0,0 @@-//! Backend / provider error-body classification shared across domains.-//!-//! Budget exhaustion is reported by the hosted backend and by managed inference-//! providers as a deterministic user state, not a defect; every domain that-//! sees such a body (inference HTTP errors, agent loop guards, the scheduler,-//! web chat, telemetry) classifies it through this one predicate.--/// Return whether a provider message represents deterministic exhausted-budget-/// user state rather than a product defect.-pub fn is_budget_exhausted_message(message: &str) -> bool {- const PHRASES: &[&str] = &[- "insufficient budget",- "budget exceeded",- "add credits",- "insufficient balance",- "no remaining credits",- "credit balance is too low",- ];- let lower = message.to_ascii_lowercase();- PHRASES.iter().any(|phrase| lower.contains(phrase))-}--#[cfg(test)]-#[path = "classify_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/backend/classify_tests.rs b/crates/openhuman-core/src/backend/classify_tests.rsdeleted file mode 100644index 7c4c81ba9e..0000000000--- a/crates/openhuman-core/src/backend/classify_tests.rs+++ /dev/null@@ -1,26 +0,0 @@-use super::*;--#[test]-fn detects_known_budget_exhaustion_phrases_case_insensitively() {- for message in [- "INSUFFICIENT BUDGET",- "budget EXCEEDED — ADD credits",- "Insufficient BALANCE",- "You have no remaining credits to use the LLM apis.",- "Your CREDIT BALANCE IS TOO LOW to access the Anthropic API",- ] {- assert!(is_budget_exhausted_message(message), "{message:?}");- }-}--#[test]-fn ignores_non_budget_messages() {- for message in [- "Bad request: missing field",- "You have 100 remaining credits this month",- "Your credit balance is $50.00",- "",- ] {- assert!(!is_budget_exhausted_message(message), "{message:?}");- }-}diff --git a/crates/openhuman-core/src/backend/mod.rs b/crates/openhuman-core/src/backend/mod.rsindex d9d75b7740..e3c7cc2a28 100644--- a/crates/openhuman-core/src/backend/mod.rs+++ b/crates/openhuman-core/src/backend/mod.rs@@ -15,15 +15,12 @@//! [`flatten_authed_error`], the chokepoint that turns them into the//! `SESSION_EXPIRED:` / `API_KEY_REJECTED:` / `BACKEND_UNAVAILABLE:`//! sentinels `core::observability` classifies.-//! - [`classify`] — backend budget-exhaustion body classification shared by-//! inference, the agent loop, the scheduler and web chat.//!//! A core with no transport installed runs agents, memory, tools and RPC as//! normal; every backend-touching call answers//! [`BackendApiError::BackendUnavailable`] / `BACKEND_UNAVAILABLE:`, and the//! URL helpers here return [`BackendTransportError::Unavailable`].-pub mod classify;pub mod client;pub mod transport;