Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(channels): propagate reply_to_id when building outbound messages

Steven Enamakel224c1aedb238
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 98d428150a..acccae5616 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -184,6 +184,7 @@ where
let mut message = SendMessage::new(content, reply_recipient.clone());
message.thread_ts = reply_thread.clone();
message.topic_id = reply_topic.clone();
+ message.reply_to_id = msg.reply_to_id.clone();
message
};
let history_len =
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 44a698f5ac..b657559055 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -132,9 +132,8 @@ async fn handle_linked_runtime_command(
let prepared = crate::modules::channel_controller::prepare_inbound(
&crate::channels::context::module_client(ctx).await,
PrepareChannelInboundRequest {
- source: ChannelInboundSource::Legacy {
- message: msg.clone(),
- envelope: Some(tinychannels_bus::ChannelInboundEnvelope {
+ source: ChannelInboundSource::Envelope {
+ envelope: tinychannels_bus::ChannelInboundEnvelope {
channel: tinychannels_bus::ChannelRef {
id: msg.channel.clone(),
account_id: Some(account_id),
@@ -161,7 +160,8 @@ async fn handle_linked_runtime_command(
markdown_dialect: None,
}],
..Default::default()
- }),
+ },
+ timestamp: msg.timestamp,
},
namespace: "main".into(),
session_policy: Default::default(),
diff --git a/crates/openhuman-core/src/channels/routes_tests_telegram.rs b/crates/openhuman-core/src/channels/routes_tests_telegram.rs
index 1f7356f6e2..f601d244a4 100644
--- a/crates/openhuman-core/src/channels/routes_tests_telegram.rs
+++ b/crates/openhuman-core/src/channels/routes_tests_telegram.rs
@@ -11,7 +11,6 @@ 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(),
@@ -48,7 +47,6 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
let status_msg = ChannelMessage {
reply_to_id: None,
- topic_id: None,
id: "3".into(),
sender: "alice".into(),
reply_target: "chat-remote".into(),
@@ -65,7 +63,6 @@ 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(),
@@ -118,21 +115,23 @@ async fn handle_runtime_command_telegram_new_uses_module_storage() {
let msg = ChannelMessage {
reply_to_id: None,
topic_id: Some("42".into()),
- id: "100".into(),
+ id: "200".into(),
+ reply_to_id: Some("100".into()),
sender: "alice".into(),
// The module prepares the chat and topic as distinct canonical fields.
reply_target: "-200".into(),
content: "/new".into(),
channel: "telegram".into(),
timestamp: 0,
- thread_ts: Some("100".into()),
+ thread_ts: None,
sender_name: None,
};
assert!(
handle_linked_runtime_command(&mut ctx, &msg, Some(&channel), &linked, Some("-200")).await
);
let topic_only_msg = ChannelMessage {
- id: "101".into(),
+ id: "201".into(),
+ reply_to_id: None,
thread_ts: None,
..msg.clone()
};
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index 07ee75062b..bcbd893abe 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -141,7 +141,7 @@ async fn process_channel_message_sends_typing_before_the_provider_reply() {
let mut runtime_ctx = ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
- module_objects: Arc::new(HashMap::new()),
+ module_objects: linked.module_objects(),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(SlowModel {
delay: Duration::from_millis(20),
diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
index 5b8f057b9e..ed539045e3 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
@@ -79,7 +79,7 @@ async fn process_channel_message_executes_native_tool_calls() {
#[tokio::test]
async fn process_channel_message_handles_models_command_without_llm_call() {
let _bus_guard = super::common::use_real_agent_handler().await;
- let _linked = linked_telegram_runtime().await;
+ let linked = linked_telegram_runtime().await;
crate::core::bus::init().await.expect("bus init");
let _builtins =
crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global_builtins();
@@ -107,7 +107,7 @@ async fn process_channel_message_handles_models_command_without_llm_call() {
let mut runtime_ctx = ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
- module_objects: Arc::new(HashMap::new()),
+ module_objects: linked.module_objects(),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::clone(&default_provider),
)),
@@ -123,7 +123,7 @@ async fn process_channel_message_handles_models_command_without_llm_call() {
inference_url: None,
reliability: Arc::new(crate::config::ReliabilityConfig::default()),
provider_runtime_options: provider::ProviderRuntimeOptions::default(),
- workspace_dir: Arc::new(_linked.config().workspace_dir.clone()),
+ workspace_dir: Arc::new(linked.config().workspace_dir.clone()),
message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,
multimodal: crate::config::MultimodalConfig::default(),
multimodal_files: crate::config::MultimodalFileConfig::default(),
@@ -132,7 +132,7 @@ async fn process_channel_message_handles_models_command_without_llm_call() {
};
let _core = crate::channels::runtime::test_support::bind_test_core_context(
&mut runtime_ctx,
- _linked.config(),
+ linked.config(),
);
let runtime_ctx = Arc::new(runtime_ctx);