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(channels): add reply_to_id and topic_id to channel messages
Steven Enamakele75578c42ae9
diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rsindex 611d789c6b..bd092c6e57 100644--- a/crates/openhuman-core/src/channels/bus/delivery.rs+++ b/crates/openhuman-core/src/channels/bus/delivery.rs@@ -139,9 +139,9 @@ impl ManagedTransport {let ChannelBackendRequest::ProgressiveTransport(request) = request else {return Err(tinybus::Error::failed("callback capability unavailable"));};- Ok(ChannelBackendResult::ProgressiveTransport(- Box::new(self.execute(*request).await),- ))+ Ok(ChannelBackendResult::ProgressiveTransport(Box::new(+ self.execute(*request).await,+ )))}}diff --git a/crates/openhuman-core/src/channels/capabilities_tests.rs b/crates/openhuman-core/src/channels/capabilities_tests.rsindex c6828ffb09..abce403da2 100644--- a/crates/openhuman-core/src/channels/capabilities_tests.rs+++ b/crates/openhuman-core/src/channels/capabilities_tests.rs@@ -18,6 +18,9 @@ fn chat_providers_support_approvals_and_remote_control() {#[test]fn unknown_and_oneway_providers_have_no_capabilities() {for provider in ["email", "webhook", "cli", "brand-new"] {- assert_eq!(capabilities_for(provider), HostChannelCapabilities::default());+ assert_eq!(+ capabilities_for(provider),+ HostChannelCapabilities::default()+ );}}diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rsindex acb0e96443..e7e91a7346 100644--- a/crates/openhuman-core/src/channels/context_tests.rs+++ b/crates/openhuman-core/src/channels/context_tests.rs@@ -57,6 +57,8 @@ fn runtime_context() -> ChannelRuntimeContext {fn channel_message(channel: &str) -> traits::ChannelMessage {traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,channel: channel.into(),sender: "alice".into(),content: "hello".into(),diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rsindex 9a4c681ea3..b140482891 100644--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@ -1,4 +1,5 @@//! Host-owned approval routing and turn events over the channel module.+use crate::channels::capabilities::capabilities_for;use crate::channels::{Channel, ChannelSendExt, SendMessage};use crate::core::events::DomainEvent;use async_trait::async_trait;@@ -7,7 +8,6 @@ use std::path::PathBuf;use std::sync::{Arc, Mutex};use tinybus::module::ModuleClient;use tinybus::EventHandler;-use crate::channels::capabilities::capabilities_for;use tinychannels_bus::ChannelMessage;#[derive(Clone)]@@ -92,6 +92,8 @@ impl EventHandler<DomainEvent> for ChannelApprovalSurfaceSubscriber {session_policy: Default::default(),source: tinychannels_bus::module_inbound::ChannelInboundSource::Legacy {message: ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: message_id.clone(),channel: channel.clone(),sender: sender.clone(),diff --git a/crates/openhuman-core/src/channels/providers/relay/params.rs b/crates/openhuman-core/src/channels/providers/relay/params.rsindex f4d1112ddc..1bc603e76f 100644--- a/crates/openhuman-core/src/channels/providers/relay/params.rs+++ b/crates/openhuman-core/src/channels/providers/relay/params.rs@@ -138,6 +138,8 @@ impl RelayInboundParams {/// The message as the channel dispatch pipeline takes it.pub(crate) fn to_channel_message(&self) -> ChannelMessage {ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: self.message_id.clone(),sender: self.sender_id.clone(),reply_target: self.chat_id.clone(),diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex 5e8fe22c99..d1c642f116 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -101,6 +101,8 @@ async fn module_route_help_response(let request = ChannelControlRequest::Route {workspace_dir: workspace_dir.to_string_lossy().into_owned(),message: Box::new(ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "help-fixture".into(),sender: "operator".into(),reply_target: "chat".into(),@@ -224,6 +226,8 @@ async fn cached_models_and_help_responses_render_expected_text() {#[test]fn model_command_messages_use_thread_aware_history_keys() {let msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "1".into(),sender: "alice".into(),reply_target: "room".into(),@@ -310,6 +314,8 @@ async fn handle_runtime_command_unknown_provider_sends_helpful_error() {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: "1".into(),sender: "alice".into(),reply_target: "room".into(),@@ -348,6 +354,8 @@ async fn handle_runtime_command_set_model_clears_sender_history_and_persists_roulet 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: "1".into(),sender: "alice".into(),reply_target: "room".into(),@@ -392,6 +400,8 @@ async fn handle_runtime_command_telegram_status_replies_without_agent() {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: "1".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -425,6 +435,8 @@ async fn handle_runtime_command_telegram_status_replies_without_agent() {async fn handle_runtime_command_without_target_channel_still_consumes_command() {let ctx = runtime_context(PathBuf::from("/tmp"));let msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "1".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -446,6 +458,8 @@ async fn handle_runtime_command_telegram_help_replies_with_remote_command_list()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: "1".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -483,6 +497,8 @@ async fn handle_runtime_command_telegram_sessions_reports_empty_store() {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: "1".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -525,6 +541,8 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {);let new_msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "1".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -578,6 +596,8 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {.await;let status_msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "3".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -598,6 +618,8 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {);let sessions_msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "4".into(),sender: "alice".into(),reply_target: "chat-remote".into(),@@ -652,6 +674,8 @@ async fn handle_runtime_command_telegram_new_reports_unavailable_storage() {);let msg = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "1".into(),sender: "alice".into(),reply_target: "chat-remote".into(),diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rsindex 0eacd8df78..b654af7706 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs@@ -70,6 +70,8 @@ fn context(channel: Arc<Telegram>, config: Config) -> Arc<ChannelRuntimeContext>fn message(text: &str) -> traits::ChannelMessage {traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "m1".into(),sender: "alice".into(),sender_name: None,diff --git a/crates/openhuman-core/src/channels/runtime/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch_tests.rsindex 7753814c83..1bd505306b 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch_tests.rs@@ -80,6 +80,8 @@ fn ack_reaction_is_deterministic_and_total_on_edge_inputs() {fn cm(channel: &str, reply_target: &str) -> traits::ChannelMessage {traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,channel: channel.into(),sender: "alice".into(),content: "hi".into(),diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rsindex acba794bd0..79edbb13ea 100644--- a/crates/openhuman-core/src/channels/runtime/test_support.rs+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs@@ -438,6 +438,8 @@ pub async fn run_dispatch_harness(options: DispatchHarnessOptions) -> DispatchHalet expected_event_channel = options.channel_name.clone();let message = ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "m1".to_string(),sender: "alice".to_string(),reply_target: "reply".to_string(),diff --git a/crates/openhuman-core/src/channels/tests/discord_integration.rs b/crates/openhuman-core/src/channels/tests/discord_integration.rsindex ce700773c3..20a0eb9809 100644--- a/crates/openhuman-core/src/channels/tests/discord_integration.rs+++ b/crates/openhuman-core/src/channels/tests/discord_integration.rs@@ -150,6 +150,8 @@ async fn discord_inbound_dispatches_through_full_pipeline() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "discord_msg_1".to_string(),sender: "user-123".to_string(),reply_target: "channel-456".to_string(),@@ -201,6 +203,8 @@ async fn discord_threaded_message_does_not_emit_reaction_ack() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "discord_msg_2".to_string(),sender: "user-123".to_string(),reply_target: "channel-456".to_string(),@@ -250,6 +254,8 @@ async fn discord_thread_ts_splits_conversation_history_end_to_end() {let ctx = make_discord_ctx(channel, provider);let first = traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "discord_msg_a".to_string(),sender: "user-123".to_string(),reply_target: "channel-456".to_string(),diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rsindex 2813b4343a..87e8e826cb 100644--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs@@ -151,6 +151,8 @@ async fn message_dispatch_processes_messages_in_parallel() {let (parallel_channel, parallel_ctx) = build_runtime();let (tx, rx) = tokio::sync::mpsc::channel::<RuntimeChannelMessage>(4);tx.send(RuntimeChannelMessage::from(traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "1".to_string(),sender: "alice".to_string(),reply_target: "alice".to_string(),@@ -163,6 +165,8 @@ async fn message_dispatch_processes_messages_in_parallel() {.await.unwrap();tx.send(RuntimeChannelMessage::from(traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "2".to_string(),sender: "bob".to_string(),reply_target: "bob".to_string(),@@ -224,6 +228,8 @@ async fn process_channel_message_cancels_scoped_typing_task() {process_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "typing-msg".to_string(),sender: "alice".to_string(),reply_target: "chat-typing".to_string(),@@ -314,6 +320,8 @@ async fn dispatch_routes_through_agent_run_turn_bus_handler() {process_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "bus-stub-msg".to_string(),sender: "alice".to_string(),reply_target: "alice".to_string(),@@ -449,6 +457,8 @@ async fn run_resolved_route_message(message_id: &str, noise_after: usize) {process_channel_message(resolved_route_ctx().await,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: message_id.to_string(),sender: "alice".to_string(),reply_target: "alice".to_string(),@@ -571,6 +581,8 @@ async fn process_channel_message_hardens_multimodal_files_against_smuggled_markeprocess_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "smuggle-attempt".to_string(),sender: "remote_attacker".to_string(),reply_target: "remote_attacker".to_string(),@@ -654,6 +666,8 @@ async fn process_channel_message_hardens_against_relative_path_markers() {process_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "smuggle-attempt-relative".to_string(),sender: "remote_attacker".to_string(),reply_target: "remote_attacker".to_string(),diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rsindex 979ee7063f..08096e3de9 100644--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs@@ -54,6 +54,8 @@ async fn process_channel_message_executes_native_tool_calls() {process_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "msg-2".to_string(),sender: "bob".to_string(),reply_target: "chat-84".to_string(),@@ -125,6 +127,8 @@ async fn process_channel_message_handles_models_command_without_llm_call() {});let cmd_msg = traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "msg-cmd-1".to_string(),sender: "alice".to_string(),reply_target: "chat-1".to_string(),@@ -180,6 +184,8 @@ async fn process_channel_message_uses_route_override_provider_and_model() {);let routed_msg = traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "msg-routed-1".to_string(),sender: "alice".to_string(),reply_target: "chat-1".to_string(),@@ -281,6 +287,8 @@ async fn process_channel_message_respects_configured_max_tool_iterations_above_dprocess_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "msg-iter-success".to_string(),sender: "alice".to_string(),reply_target: "chat-iter-success".to_string(),@@ -341,6 +349,8 @@ async fn process_channel_message_reports_configured_max_tool_iterations_limit()process_channel_message(runtime_ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "msg-iter-fail".to_string(),sender: "bob".to_string(),reply_target: "chat-iter-fail".to_string(),diff --git a/crates/openhuman-core/src/channels/tests/telegram_integration.rs b/crates/openhuman-core/src/channels/tests/telegram_integration.rsindex 684dd48639..ce530b5dbc 100644--- a/crates/openhuman-core/src/channels/tests/telegram_integration.rs+++ b/crates/openhuman-core/src/channels/tests/telegram_integration.rs@@ -121,6 +121,8 @@ async fn inbound_thread_ts_is_forwarded_to_channel_send() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "tg_100_99".to_string(),sender: "alice".to_string(),reply_target: "100".to_string(),@@ -159,6 +161,8 @@ async fn no_thread_ts_on_inbound_message_results_in_none_on_send() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "tg_100_55".to_string(),sender: "alice".to_string(),reply_target: "100".to_string(),@@ -197,6 +201,8 @@ async fn reaction_marker_in_llm_response_is_passed_to_channel_send() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "tg_100_42".to_string(),sender: "alice".to_string(),reply_target: "100".to_string(),@@ -249,6 +255,8 @@ async fn typing_indicator_starts_and_stops_once_per_message() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "typing-test".to_string(),sender: "alice".to_string(),reply_target: "chat-123".to_string(),@@ -279,6 +287,8 @@ async fn typing_indicator_starts_and_stops_once_per_message() {#[test]fn telegram_channel_history_key_ignores_thread_ts() {let base_msg = traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "tg_100_1".to_string(),sender: "alice".to_string(),reply_target: "100".to_string(),@@ -373,6 +383,8 @@ async fn telegram_threaded_inbound_emits_ack_reaction_then_reply() {process_channel_message(ctx,traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "tg_200_77".to_string(),sender: "alice".to_string(),reply_target: "200".to_string(),@@ -439,6 +451,8 @@ async fn telegram_threaded_inbound_emits_ack_reaction_then_reply() {#[test]fn non_telegram_channel_history_key_includes_thread_ts() {let base_msg = traits::ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: "slack_C01_1".to_string(),sender: "alice".to_string(),reply_target: "C01".to_string(),diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rsindex c71dbd3d6e..b09deafa4b 100644--- a/crates/openhuman-core/src/threads/store/bus.rs+++ b/crates/openhuman-core/src/threads/store/bus.rs@@ -376,6 +376,8 @@ async fn persist_channel_turn(session_policy: Default::default(),source: tinychannels_bus::module_inbound::ChannelInboundSource::Legacy {message: ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: descriptor.message_id.into(),sender: descriptor.sender.into(),reply_target: descriptor.reply_target.into(),@@ -477,6 +479,8 @@ fn persisted_channel_thread_id(thread_ts: Option<&str>,) -> String {let key = conversation_history_key(&ChannelMessage {+ reply_to_id: None,+ topic_id: None,id: String::new(),sender: sender.to_string(),reply_target: reply_target.to_string(),@@ -499,7 +503,8 @@ fn channel_thread_title(// Providers whose thread_ts is only a reply target (Telegram topics)// share one conversation, so the title leaves it out too.Some(thread_ts)- if !crate::channels::capabilities::capabilities_for(channel).history_key_ignores_thread =>+ if !crate::channels::capabilities::capabilities_for(channel)+ .history_key_ignores_thread =>{format!("{channel} · {sender} · {reply_target} · thread {thread_ts}")}diff --git a/crates/openhuman-core/src/threads/store/bus_tests.rs b/crates/openhuman-core/src/threads/store/bus_tests.rsindex 49f3542930..4d0cd6852d 100644--- a/crates/openhuman-core/src/threads/store/bus_tests.rs+++ b/crates/openhuman-core/src/threads/store/bus_tests.rs@@ -21,6 +21,8 @@ async fn persists_inbound_and_processed_turns_into_workspace_thread() {let subscriber = ConversationPersistenceSubscriber::new(temp.path().to_path_buf());let mut inbound_envelope =tinychannels_runtime::channel::inbound_envelope_from_legacy_message(&ChannelMessage {+ reply_to_id: None,+ topic_id: None,channel: "slack".into(),id: "m1".into(),sender: "alice".into(),