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(session_host): only reclassify driver errors as dispatch refusals
Steven Enamakel0861738b783a
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex 3848dc73cf..383b663e96 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -161,15 +161,17 @@ fn runtime_turn_error(std::sync::Mutex<crate::agent::tinyagents::host::run_context::SessionTurnSidecar>,>,) -> anyhow::Error {- let refusal = sidecar- .lock()- .unwrap_or_else(std::sync::PoisonError::into_inner)- .dispatch_refusal- .take();- match refusal {- Some(refusal) => anyhow::Error::new(refusal),- None => anyhow::anyhow!(error.to_string()),+ if matches!(error, tinyagents_runtime::RuntimeError::Driver(_)) {+ let refusal = sidecar+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .dispatch_refusal+ .take();+ if let Some(refusal) = refusal {+ return anyhow::Error::new(refusal);+ }}+ anyhow::anyhow!(error.to_string())}/// Applies the pending one-turn overrides to this turn's resume mode.diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn_tests.rsindex af9ae08ea4..943a8ca61a 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn_tests.rs@@ -41,3 +41,22 @@ fn runtime_turn_error_uses_generic_message_when_no_refusal_was_recorded() {.is_none());assert!(error.to_string().contains("unrelated driver failure"));}++#[test]+fn a_later_runtime_cancellation_is_not_reclassified_from_a_stale_sidecar() {+ let context = OpenHumanRunContext::new();+ context.session_sidecar.lock().unwrap().dispatch_refusal =+ Some(crate::agent::tinyagents::budget::DispatchRefusal::new(+ crate::agent::tinyagents::budget::DispatchRefusalReason::CallLimit,+ ));++ let error = runtime_turn_error(+ tinyagents_runtime::RuntimeError::Cancelled,+ &context.session_sidecar,+ );++ assert!(error+ .downcast_ref::<crate::agent::tinyagents::budget::DispatchRefusal>()+ .is_none());+ assert_eq!(error.to_string(), "session turn cancelled");+}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 45aa70c8a7..ca5549bce9 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@@ -444,6 +444,7 @@ fn child_inherits_the_same_physical_dispatch_admission() {parent.dispatch_admission.as_ref().unwrap(),child.dispatch_admission.as_ref().unwrap()));+ assert!(Arc::ptr_eq(&parent.session_sidecar, &child.session_sidecar));}#[test]@@ -459,6 +460,10 @@ fn detached_child_inherits_the_parent_dispatch_admission() {parent.dispatch_admission.as_ref().unwrap(),parent.detached_child().dispatch_admission.as_ref().unwrap()));+ assert!(!Arc::ptr_eq(+ &parent.session_sidecar,+ &parent.detached_child().session_sidecar+ ));}#[test]