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
refactor(session_host): use AgentError::kind for error sanitization
Steven Enamakele565ae02a851
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rsindex e89c1e2c04..7a68319780 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs@@ -62,21 +62,11 @@ impl OpenHumanSessionHost {pub(in crate::agent::session_host) fn sanitize_event_error_message(err: &anyhow::Error,) -> String {- let kind = match err.downcast_ref::<AgentError>() {- Some(AgentError::ProviderError { .. }) => Some("provider_error"),- Some(AgentError::ContextLimitExceeded { .. }) => Some("context_limit_exceeded"),- Some(AgentError::ToolExecutionError { .. }) => Some("tool_execution_error"),- Some(AgentError::CostBudgetExceeded { .. }) => Some("cost_budget_exceeded"),- Some(AgentError::MaxIterationsExceeded { .. }) => Some("max_iterations_exceeded"),- Some(AgentError::EmptyProviderResponse { .. }) => Some("empty_provider_response"),- Some(AgentError::CompactionFailed { .. }) => Some("compaction_failed"),- Some(AgentError::PermissionDenied { .. }) => Some("permission_denied"),- Some(AgentError::RegistryValidationFailed { .. }) => Some("registry_validation_failed"),- Some(AgentError::Other(_)) | None => None,- };-- if let Some(kind) = kind {- return kind.to_string();+ if let Some(error) = err.downcast_ref::<AgentError>() {+ let kind = error.kind();+ if kind != "other" {+ return kind.to_string();+ }}let scrubbed = tinyinference_core::sanitize::sanitize_api_error(&err.to_string())diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rsindex 821af67226..b3f13299c2 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs@@ -196,6 +196,7 @@ fn failed_outer_run_promotes_completed_nested_usage_once() {..Default::default()},});+ let nested_run_id = outer.subagent_usage_records()[0].run_id.clone();// This is the failure/cancellation finalizer path. Calling it once leaves// the root with the completed nested work even though the outer run has no@@ -203,6 +204,7 @@ fn failed_outer_run_promotes_completed_nested_usage_once() {outer.promote_completed_descendant_usage();assert_eq!(root.subagent_usage_entries().len(), 1);assert_eq!(root.subagent_usage_entries()[0].task_id, "nested");+ assert_eq!(root.subagent_usage_records()[0].run_id, nested_run_id);}#[test]