Skip to content

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

test(channels): update tests for envelope-based message construction

Steven Enamakel953d7fee3625
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index 27d49c0ef1..8cc619d7c2 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -4,7 +4,7 @@ use super::super::runtime::{
process_channel_message, run_message_dispatch_loop, RuntimeChannelMessage,
};
use super::super::Channel;
-use super::common::{use_real_agent_handler, RecordingChannel, SlowModel};
+use super::common::{channel_envelope, use_real_agent_handler, RecordingChannel, SlowModel};
use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
use crate::core::events::DomainEvent;
use crate::inference::provider;
@@ -150,7 +150,7 @@ 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(channel_envelope(
+ tx.send(RuntimeChannelMessage::with_inbound_envelope(channel_envelope(
"test-channel",
"alice",
"alice",
@@ -162,7 +162,7 @@ async fn message_dispatch_processes_messages_in_parallel() {
)))
.await
.unwrap();
- tx.send(RuntimeChannelMessage::from(channel_envelope(
+ tx.send(RuntimeChannelMessage::with_inbound_envelope(channel_envelope(
"test-channel",
"bob",
"bob",
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 63cc598355..fc58048eae 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
@@ -5,7 +5,7 @@ use super::super::context::{
use super::super::runtime::process_channel_message;
use super::super::Channel;
use super::common::{
- IterativeToolModel, MockPriceTool, ModelCaptureModel, RecordingChannel,
+ channel_envelope, IterativeToolModel, MockPriceTool, ModelCaptureModel, RecordingChannel,
TelegramRecordingChannel, ToolCallingModel,
};
use crate::inference::provider;
diff --git a/crates/openhuman-core/src/channels/tests/telegram_integration.rs b/crates/openhuman-core/src/channels/tests/telegram_integration.rs
index 677293ff65..937e90c309 100644
--- a/crates/openhuman-core/src/channels/tests/telegram_integration.rs
+++ b/crates/openhuman-core/src/channels/tests/telegram_integration.rs
@@ -10,7 +10,7 @@ use super::super::context::{
};
use super::super::runtime::process_channel_message;
use super::super::{Channel, SendMessage};
-use super::common::SlowModel;
+use super::common::{channel_envelope, SlowModel};
use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
@@ -289,17 +289,13 @@ fn telegram_channel_history_key_ignores_thread_ts() {
None
);
- let msg_with_thread = traits::ChannelMessage {
- id: "tg_100_2".to_string(),
- thread_ts: Some("42".to_string()),
- ..base_msg.clone()
- };
+ let mut msg_with_thread = base_msg.clone();
+ msg_with_thread.message_id = "tg_100_2".to_string();
+ msg_with_thread.conversation.thread_id = Some("42".to_string());
- let msg_with_different_thread = traits::ChannelMessage {
- id: "tg_100_3".to_string(),
- thread_ts: Some("99".to_string()),
- ..base_msg.clone()
- };
+ let mut msg_with_different_thread = base_msg.clone();
+ msg_with_different_thread.message_id = "tg_100_3".to_string();
+ msg_with_different_thread.conversation.thread_id = Some("99".to_string());
let key_base = conversation_history_key(&base_msg);
let key_thread = conversation_history_key(&msg_with_thread);
@@ -449,11 +445,9 @@ fn non_telegram_channel_history_key_includes_thread_ts() {
None
);
- let msg_in_thread = traits::ChannelMessage {
- id: "slack_C01_2".to_string(),
- thread_ts: Some("1234567890.000001".to_string()),
- ..base_msg.clone()
- };
+ let mut msg_in_thread = base_msg.clone();
+ msg_in_thread.message_id = "slack_C01_2".to_string();
+ msg_in_thread.conversation.thread_id = Some("1234567890.000001".to_string());
let key_base = conversation_history_key(&base_msg);
let key_thread = conversation_history_key(&msg_in_thread);