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(hosted_error): make error conversion and module public for cross-crate testing
Steven Enamakelc93f8e1002c3
diff --git a/crates/openhuman-core/src/agent/tinyagents/hosted_error.rs b/crates/openhuman-core/src/agent/tinyagents/hosted_error.rsindex 1a49df5b45..4cf6f53888 100644--- a/crates/openhuman-core/src/agent/tinyagents/hosted_error.rs+++ b/crates/openhuman-core/src/agent/tinyagents/hosted_error.rs@@ -26,7 +26,7 @@ pub(super) fn turn_timeout_bound(bound: TimeoutBound) -> TurnTimeoutBound {////// Identical to `TinyAgentsError::from(error)` except that a timeout names the/// bound that fired. It stays a terminal `Timeout`, as before.-pub(super) fn run_error_from_hosted(error: HostedError) -> TinyAgentsError {+pub(crate) fn run_error_from_hosted(error: HostedError) -> TinyAgentsError {let bound = match (error.kind, error.timeout_bound) {(HostedErrorKind::Timeout, Some(bound)) => Some(turn_timeout_bound(bound)),_ => None,diff --git a/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs b/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rsindex 7fd6813198..7290608dbc 100644--- a/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs@@ -1,5 +1,4 @@use super::*;-use crate::web_chat::web_errors::is_turn_timeout_error;fn hosted(kind: HostedErrorKind, bound: Option<TimeoutBound>) -> HostedError {HostedError {@@ -19,24 +18,24 @@ fn a_per_call_timeout_names_the_per_model_call_bound() {assert!(matches!(err, TinyAgentsError::Timeout(_)));let text = err.to_string();assert_eq!(- crate::web_chat::timeout_bound_tag(&text),- "per_model_call",- "{text}"+ TurnTimeoutBound::from_message(&text),+ Some(TurnTimeoutBound::PerModelCall));- assert!(is_turn_timeout_error(&text), "user-facing class unchanged");}#[test]fn a_run_budget_timeout_names_the_run_bound() {let text = run_error_from_hosted(hosted(HostedErrorKind::Timeout, Some(TimeoutBound::Run))).to_string();- assert_eq!(crate::web_chat::timeout_bound_tag(&text), "run_remaining");- assert!(is_turn_timeout_error(&text));+ assert_eq!(+ TurnTimeoutBound::from_message(&text),+ Some(TurnTimeoutBound::RunRemaining)+ );}#[test]fn a_non_timeout_failure_is_converted_as_before() {let err = run_error_from_hosted(hosted(HostedErrorKind::Provider, None));assert!(matches!(err, TinyAgentsError::Model(_)));- assert_eq!(crate::web_chat::timeout_bound_tag(&err.to_string()), "none");+ assert_eq!(TurnTimeoutBound::from_message(&err.to_string()), None);}diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex 359f84d20a..0f90481cd2 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -25,7 +25,7 @@ mod embeddings;mod harness_assembly;mod harness_context_ladder;mod harness_tool_registration;-mod hosted_error;+pub(crate) mod hosted_error;pub mod host;pub(crate) mod journal;pub(crate) mod middleware;diff --git a/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rsindex 03417b785d..2f29e8662e 100644--- a/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs@@ -628,3 +628,30 @@ fn timeout_bound_tag_separates_the_two_harness_ceilings() {"a non-timeout error must not carry a timeout bound");}++/// The hosted path sanitizes the harness's timeout text, so the bound reaches+/// the Sentry tag through the typed `HostedError::timeout_bound` field. The+/// user-facing class must stay `turn_timeout` for both bounds.+#[test]+fn hosted_timeout_bound_reaches_the_sentry_tag_and_keeps_the_user_class() {+ use tinyagents_harness::runtime::{HostedError, HostedErrorKind, TimeoutBound};++ for (bound, tag) in [+ (TimeoutBound::PerModelCall, "per_model_call"),+ (TimeoutBound::Run, "run_remaining"),+ ] {+ let hosted = HostedError {+ kind: HostedErrorKind::Timeout,+ message: "hosted agent invocation timed out".to_string(),+ timeout_bound: Some(bound),+ run: None,+ };+ let err = crate::agent::tinyagents::hosted_error::run_error_from_hosted(hosted);+ let flattened = format!("run_chat_task failed error=tinyagents harness run failed: {err}");+ assert_eq!(super::super::ops::timeout_bound_tag(&flattened), tag);+ assert_eq!(+ super::super::web_errors::classify_inference_error(&flattened).error_type,+ "turn_timeout"+ );+ }+}