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(channels): tidy formatting and module ordering
Steven Enamakel96bc6662b27c
diff --git a/crates/openhuman-core/src/agent/host_agents.rs b/crates/openhuman-core/src/agent/host_agents.rsindex 75a3dc9ded..9ce2819396 100644--- a/crates/openhuman-core/src/agent/host_agents.rs+++ b/crates/openhuman-core/src/agent/host_agents.rs@@ -114,10 +114,7 @@ impl HostAgent {let dispatch = crate::core::runtime::DispatchCtx::new(Arc::clone(&self.context));session.adopt_legacy_history_if_needed(|| async {- source- .load(&dispatch)- .await- .map_err(anyhow::Error::msg)+ source.load(&dispatch).await.map_err(anyhow::Error::msg)}).await.map_err(|_| {diff --git a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rsindex ce9c900bb6..a69c4537fe 100644--- a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs@@ -188,13 +188,14 @@ async fn run_imported_history_prefix_regression() {#[tokio::test]async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {- use tinyagents_session::transcript::{TranscriptMeta, TranscriptMessage};+ use tinyagents_session::transcript::{TranscriptMessage, TranscriptMeta};let root = tempfile::tempdir().expect("workspace");let locator = crate::agent::session_store::splice_fixture::memory_locator();- let model: Arc<dyn ChatModel<()>> = Arc::new(- tinyagents_harness::testkit::ScriptedModel::replies(vec!["unused"]),- );+ let model: Arc<dyn ChatModel<()>> =+ Arc::new(tinyagents_harness::testkit::ScriptedModel::replies(vec![+ "unused",+ ]));let mut host = SessionHostBuilder::new().with_session_history_locator(Arc::clone(&locator)).chat_model(model)@@ -243,7 +244,10 @@ async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {Err(anyhow::anyhow!("legacy store unavailable"))}).await;- assert!(missing.is_err(), "failed legacy reads stop before a turn starts");+ assert!(+ missing.is_err(),+ "failed legacy reads stop before a turn starts"+ );assert!(!locator.session_exists(&session),"a failed import must not create an empty durable transcript"@@ -265,9 +269,10 @@ async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {// A separate host bound to a session with committed durable rows never// consults the legacy source, even when that source is unavailable.let second_root = tempfile::tempdir().expect("second workspace");- let second_model: Arc<dyn ChatModel<()>> = Arc::new(- tinyagents_harness::testkit::ScriptedModel::replies(vec!["unused"]),- );+ let second_model: Arc<dyn ChatModel<()>> =+ Arc::new(tinyagents_harness::testkit::ScriptedModel::replies(vec![+ "unused",+ ]));let mut resumed = SessionHostBuilder::new().with_session_history_locator(locator.clone()).chat_model(second_model)diff --git a/crates/openhuman-core/src/agent/session_host/session_api.rs b/crates/openhuman-core/src/agent/session_host/session_api.rsindex ef7e5e549b..a9c2d9a202 100644--- a/crates/openhuman-core/src/agent/session_host/session_api.rs+++ b/crates/openhuman-core/src/agent/session_host/session_api.rs@@ -47,9 +47,7 @@ impl OpenHumanSessionHost {/// adjacent session-host tests and callers that need to seed that same/// recorded session store.#[cfg(test)]- pub(crate) fn bound_session_ref(- &self,- ) -> Option<&tinyagents_session::transcript::SessionRef> {+ pub(crate) fn bound_session_ref(&self) -> Option<&tinyagents_session::transcript::SessionRef> {self.session.as_ref()}diff --git a/crates/openhuman-core/src/channels/failure_copy.rs b/crates/openhuman-core/src/channels/failure_copy.rsindex 95f53a7227..96f244668b 100644--- a/crates/openhuman-core/src/channels/failure_copy.rs+++ b/crates/openhuman-core/src/channels/failure_copy.rs@@ -6,8 +6,7 @@ const GENERIC_FAILURE_EN: &str = "Something went wrong. Please try again.";/// Internal sentinel used only between the channel host and its runner. It/// deliberately carries no storage/provider details into user-facing copy.-pub(crate) const LEGACY_HISTORY_UNAVAILABLE: &str =- "openhuman-channel-history-unavailable";+pub(crate) const LEGACY_HISTORY_UNAVAILABLE: &str = "openhuman-channel-history-unavailable";/// Render a non-inference channel failure without exposing implementation/// details or classifying it as a provider failure.diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rsindex 7a1ed6af4c..3e777de654 100644--- a/crates/openhuman-core/src/channels/mod.rs+++ b/crates/openhuman-core/src/channels/mod.rs@@ -22,10 +22,10 @@ pub(crate) use commands::{configured_providers, has_listener_configuration};#[cfg(feature = "channels")]pub(crate) mod context;#[cfg(feature = "channels")]-pub(crate) mod failure_copy;-#[cfg(feature = "channels")]pub mod controllers;#[cfg(feature = "channels")]+pub(crate) mod failure_copy;+#[cfg(feature = "channels")]pub mod host;#[cfg(feature = "channels")]pub mod proactive;diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 9ac1fb6223..98a4519da0 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -1,8 +1,8 @@//! `channel_relay_inbound`: record a relayed message and run its turn.use std::collections::HashMap;-use std::sync::Arc;use std::path::PathBuf;+use std::sync::Arc;use serde_json::{json, Value};@@ -36,7 +36,12 @@ impl LegacyHistoryImport {message_id: String,limit: usize,) -> Self {- Self { workspace_dir, thread_id, message_id, limit }+ Self {+ workspace_dir,+ thread_id,+ message_id,+ limit,+ }}pub(crate) async fn load(@@ -215,8 +220,7 @@ pub(crate) async fn run_relay_turn(%error,"[channels::relay] could not build the turn");- let reply =- crate::channels::failure_copy::generic_failure(Some(&config));+ let reply = crate::channels::failure_copy::generic_failure(Some(&config));let _ = tinychannels_runtime::Channel::send(channel.as_ref(),&crate::channels::SendMessage::new(&reply, ¶ms.chat_id),diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rsindex eb95e35497..c93bd4a10d 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs@@ -296,9 +296,6 @@ async fn relay_preflight_failure_uses_trusted_channel_locale_without_running_age.await;assert_eq!(agent_runs.load(std::sync::atomic::Ordering::SeqCst), 0);- assert_eq!(- replies,- vec!["Algo salió mal. Inténtalo de nuevo."]- );+ assert_eq!(replies, vec!["Algo salió mal. Inténtalo de nuevo."]);assert!(!replies[0].contains("COMPONENT_DISABLED"));}diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rsindex 91b0cb1310..33721d133c 100644--- a/crates/openhuman-core/src/channels/routes.rs+++ b/crates/openhuman-core/src/channels/routes.rs@@ -257,8 +257,7 @@ wherelet copy = crate::channels::failure_copy::generic_failure(ctx.config.as_deref());let _ = channel.send_with_outbound_intent(- &SendMessage::new(©, &msg.reply_target)- .in_thread(msg.thread_ts.clone()),+ &SendMessage::new(©, &msg.reply_target).in_thread(msg.thread_ts.clone()),).await;}diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex 8863ed337f..45102700fc 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -396,6 +396,50 @@ async fn clear_history_command_uses_reset_callback_and_persists_route_override()assert!(sent[0].content.contains("Model switched to `gpt-5-mini`"));}+#[tokio::test]+async fn failed_history_reset_does_not_apply_requested_route() {+ let ctx = runtime_context(PathBuf::from("/tmp"));+ let key = "telegram_alice_room";+ let before = ChannelRouteSelection {+ provider: "openai".into(),+ model: "reasoning-v1".into(),+ };+ set_route_selection(&ctx, key, before.clone());+ let channel_impl = Arc::new(RecordingChannel::default());+ let channel: Arc<dyn Channel> = channel_impl.clone();+ let msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,+ id: "reset-fails".into(),+ sender: "alice".into(),+ reply_target: "room".into(),+ content: "/model gpt-5-mini".into(),+ channel: "telegram".into(),+ timestamp: 0,+ thread_ts: None,+ sender_name: None,+ };++ let handled = handle_runtime_command_with_reset(+ &ctx,+ &msg,+ Some(&channel),+ key,+ None,+ None,+ &msg,+ || async { Err("durable reset failed".to_owned()) },+ )+ .await;++ assert!(handled);+ assert_eq!(get_route_selection(&ctx, key), before);+ let sent = channel_impl.sent.lock().unwrap();+ assert_eq!(sent.len(), 1);+ assert_eq!(sent[0].content, "Something went wrong. Please try again.");+ assert!(!sent[0].content.contains("durable reset failed"));+}+#[tokio::test]async fn handle_runtime_command_telegram_status_replies_without_agent() {let ctx = runtime_context(PathBuf::from("/tmp"));