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
chore: files changed crates/openhuman-core/src/agent/session_host/turn_backstop_tests.rs,crates/open
Steven Enamakel7cd10eecc427
diff --git a/crates/openhuman-core/src/agent/session_host/turn_backstop_tests.rs b/crates/openhuman-core/src/agent/session_host/turn_backstop_tests.rsindex ec76bd6a6a..1e544e70a6 100644--- a/crates/openhuman-core/src/agent/session_host/turn_backstop_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/turn_backstop_tests.rs@@ -19,16 +19,16 @@ fn parse_backstop_defaults_and_disables() {/// 900s, and keeps the env override and the `0` opt-out.#[test]fn web_backstop_defaults_to_an_hour_and_keeps_the_override() {- let hour = Some(Duration::from_secs(DEFAULT_WEB_TURN_BACKSTOP_SECS));+ let hour = Duration::from_secs(DEFAULT_WEB_TURN_BACKSTOP_SECS);assert_eq!(DEFAULT_WEB_TURN_BACKSTOP_SECS, 3_600);- assert_eq!(parse_web_backstop(None), hour);- assert_eq!(parse_web_backstop(Some("garbage")), hour);+ assert_eq!(parse_web_backstop(None), Some(hour));+ assert_eq!(parse_web_backstop(Some("garbage")), Some(hour));assert_eq!(parse_web_backstop(Some(" 120 ")),Some(Duration::from_secs(120)));assert_eq!(parse_web_backstop(Some("0")), None);- let deadline = TurnDeadline::starting_now(hour.unwrap());+ let deadline = TurnDeadline::starting_now(hour);assert_eq!(deadline.wind_down_after(), Duration::from_secs(3_480));assert_eq!(deadline.hard_stop_after(), Duration::from_secs(3_540));}diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rsindex 059d35b1e0..65169d5ca8 100644--- a/crates/openhuman-core/src/channels/routes.rs+++ b/crates/openhuman-core/src/channels/routes.rs@@ -260,22 +260,20 @@ where},);}- if clear_history {- if reset_history().await.is_err() {- tracing::warn!("channel durable history reset failed");- if let Some(channel) = target_channel {- let copy = crate::web_chat::classify_inference_error(- "OpenHuman session persistence failed while resetting this conversation",- );- let _ = channel- .send_with_outbound_intent(- &SendMessage::new(copy.message, &msg.reply_target)- .in_thread(msg.thread_ts.clone()),- )- .await;- }- return true;+ if clear_history && reset_history().await.is_err() {+ tracing::warn!("channel durable history reset failed");+ if let Some(channel) = target_channel {+ let copy = crate::web_chat::classify_inference_error(+ "OpenHuman session persistence failed while resetting this conversation",+ );+ let _ = channel+ .send_with_outbound_intent(+ &SendMessage::new(copy.message, &msg.reply_target)+ .in_thread(msg.thread_ts.clone()),+ )+ .await;}+ return true;}let Some(reply) = reply else {return false;diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rsindex bf6d113625..25d1a7725e 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs@@ -108,6 +108,7 @@ async fn typing_task_runs_under_the_handed_context_not_the_active_one() {let cancellation = tokio_util::sync::CancellationToken::new();// The caller's own scope is Ravi's; the typing task was handed Asha's.let waiter = CoreContext::scope(ravi, async {+ tokio::task::yield_now().await;spawn_typing_task(&asha, channel, "recipient".into(), cancellation.clone())}).await;diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback.rs b/crates/openhuman-core/src/channels/runtime/startup/callback.rsindex 8978ce7c21..85fd04510d 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback.rs@@ -20,6 +20,9 @@ const MAX_CALLBACK_BYTES: usize = 128 * 1024;const MAX_TRANSCRIPTION_BYTES: usize = 12 * 1024 * 1024;const MAX_CONTROLLER_BYTES: usize = 1024 * 1024;+type ProgressiveChannelRegistry =+ Arc<OnceLock<Arc<HashMap<String, Weak<dyn ProgressiveChannelTransport>>>>>;+#[async_trait::async_trait]pub(super) trait ProgressiveChannelTransport: Send + Sync {fn configured_name(&self) -> &str;@@ -51,8 +54,7 @@ pub(super) struct ChannelHostCallbacks {tenant: crate::core::runtime::Tenant,cancellation: tokio_util::sync::CancellationToken,context: Arc<OnceLock<Weak<ChannelRuntimeContext>>>,- progressive_channels:- Arc<OnceLock<Arc<HashMap<String, Weak<dyn ProgressiveChannelTransport>>>>>,+ progressive_channels: ProgressiveChannelRegistry,output_observer: Option<Arc<dyn ProgressiveOutputObserver>>,dispatch: mpsc::Sender<RuntimeChannelMessage>,}@@ -62,9 +64,7 @@ impl ChannelHostCallbacks {ctx: &crate::core::runtime::DispatchCtx,config: Arc<Config>,context: Arc<OnceLock<Weak<ChannelRuntimeContext>>>,- progressive_channels: Arc<- OnceLock<Arc<HashMap<String, Weak<dyn ProgressiveChannelTransport>>>>,- >,+ progressive_channels: ProgressiveChannelRegistry,output_observer: Option<Arc<dyn ProgressiveOutputObserver>>,dispatch: mpsc::Sender<RuntimeChannelMessage>,) -> Self {diff --git a/crates/openhuman-core/src/cron/scheduler/origin_context.rs b/crates/openhuman-core/src/cron/scheduler/origin_context.rsindex fede67fcc5..65d67770cc 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_context.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_context.rs@@ -168,7 +168,7 @@ pub(super) fn validated_channel_session(.or_else(|| config.agent.channel_agents.get(provider)).map(|agent| agent.trim()).filter(|agent| !agent.is_empty())- .unwrap_or_else(|| "")+ .unwrap_or("")};let selected_agent = if configured_agent.is_empty() {crate::web_chat::pick_target_agent_id(config)diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rsindex 1718acc5b3..8d1fac101d 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_tests.rs@@ -93,7 +93,7 @@ fn chat_origin(thread: &str) -> crate::agent::turn_origin::AgentTurnOrigin {fn chat_thread(origin: crate::agent::turn_origin::AgentTurnOrigin) -> String {match origin {- crate::agent::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. } => thread_id.into(),+ crate::agent::turn_origin::AgentTurnOrigin::WebChat { thread_id, .. } => thread_id,crate::agent::turn_origin::AgentTurnOrigin::DirectChat => "direct".into(),other => panic!("unexpected origin {other:?}"),}diff --git a/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rsindex e7b33bbaa9..52db6cbac6 100644--- a/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs@@ -1,6 +1,8 @@use super::*;use crate::core::runtime::DispatchCtx;+type ComponentControllerHandler = fn(DispatchCtx, Map<String, Value>) -> ControllerFuture;+#[test]fn all_schemas_have_namespace() {for s in all_controller_schemas() {@@ -179,7 +181,7 @@ async fn every_tokenjuice_method_answers_component_disabled_when_juice_is_off()let mut set = crate::core::runtime::ComponentSet::all();set.juice = false;let ctx = crate::core::runtime::context::CoreContext::for_test_with_components(set);- let handlers: [fn(DispatchCtx, Map<String, Value>) -> ControllerFuture; 8] = [+ let handlers: [ComponentControllerHandler; 8] = [handle_detect,handle_compress,handle_cache_stats,diff --git a/crates/openhuman-core/src/sandbox/native_jail_tests.rs b/crates/openhuman-core/src/sandbox/native_jail_tests.rsindex 0a11ed1e8a..43ba95590d 100644--- a/crates/openhuman-core/src/sandbox/native_jail_tests.rs+++ b/crates/openhuman-core/src/sandbox/native_jail_tests.rs@@ -264,7 +264,7 @@ fn openhumans_own_credential_files_are_denied_when_present() {let denied = credential_denials(crate::security::credentials::credential_files(&config),root.path(),- &[scratch.clone()],+ std::slice::from_ref(&scratch),).unwrap();diff --git a/crates/openhuman-core/src/sandbox/schemas_tests.rs b/crates/openhuman-core/src/sandbox/schemas_tests.rsindex 4e710396cf..386d197823 100644--- a/crates/openhuman-core/src/sandbox/schemas_tests.rs+++ b/crates/openhuman-core/src/sandbox/schemas_tests.rs@@ -3,6 +3,8 @@ use crate::core::runtime::context::CoreContext;use crate::core::runtime::DispatchCtx;use crate::core::runtime::DomainSet;+type ComponentControllerHandler = fn(DispatchCtx, Map<String, Value>) -> ControllerFuture;+/// Scope a `Config` onto the embedder-config seam that `load_config_with_timeout()`/// prefers, so a handler reads it instead of doing live disk I/O against/// `~/.openhuman` — which is slow and racy across parallel unit tests (#6081).@@ -226,7 +228,7 @@ async fn every_sandbox_method_answers_component_disabled_when_sandbox_is_off() {let mut set = crate::core::runtime::ComponentSet::all();set.sandbox = false;let ctx = crate::core::runtime::context::CoreContext::for_test_with_components(set);- let handlers: [fn(DispatchCtx, Map<String, Value>) -> ControllerFuture; 4] = [+ let handlers: [ComponentControllerHandler; 4] = [handle_status,handle_resolve_policy,handle_cleanup_orphans,