Skip to content

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

test(channels): add host_pipeline tests

Steven Enamakel4d479187534a
diff --git a/crates/openhuman-core/src/channels/tests/host_pipeline.rs b/crates/openhuman-core/src/channels/tests/host_pipeline.rs
new file mode 100644
index 0000000000..638f47d6a0
--- /dev/null
+++ b/crates/openhuman-core/src/channels/tests/host_pipeline.rs
@@ -0,0 +1,264 @@
+use super::common::{use_real_agent_handler, HistoryCaptureModel};
+use super::super::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
+use super::super::runtime::test_support::{run_dispatch_harness, DispatchHarnessOptions};
+use super::super::runtime::process_channel_message;
+use crate::channels::runtime::ChannelHandle;
+use crate::inference::provider;
+use std::collections::HashMap;
+use std::sync::{Arc, Mutex};
+use tinychannels_bus as traits;
+
+#[tokio::test]
+async fn host_pipeline_preserves_inbound_thread_target_on_reply() {
+ let threaded = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".into(),
+ thread_ts: Some("topic-99".into()),
+ response_text: Some("thread reply".into()),
+ ..Default::default()
+ })
+ .await;
+ assert_eq!(threaded.sends.len(), 1);
+ assert_eq!(threaded.sends[0].recipient, "reply");
+ assert_eq!(threaded.sends[0].thread_ts.as_deref(), Some("topic-99"));
+
+ let unthreaded = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".into(),
+ thread_ts: None,
+ response_text: Some("plain reply".into()),
+ ..Default::default()
+ })
+ .await;
+ assert_eq!(unthreaded.sends.len(), 1);
+ assert_eq!(unthreaded.sends[0].thread_ts, None);
+}
+
+#[tokio::test]
+async fn host_pipeline_sends_reaction_marker_with_inbound_thread_target() {
+ let observation = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".into(),
+ thread_ts: Some("message-42".into()),
+ supports_reactions: true,
+ response_text: Some("[REACTION:πŸ‘]".into()),
+ ..Default::default()
+ })
+ .await;
+
+ assert_eq!(observation.sends.len(), 1, "one reaction is sent");
+ assert_eq!(observation.sends[0].content, "[REACTION:πŸ‘]");
+ assert_eq!(
+ observation.sends[0].thread_ts.as_deref(),
+ Some("message-42")
+ );
+}
+
+#[tokio::test]
+async fn discord_host_pipeline_dispatches_reply_without_telegram_reaction() {
+ let observation = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "discord".into(),
+ thread_ts: Some("thread-42".into()),
+ response_text: Some("hi from discord".into()),
+ ..Default::default()
+ })
+ .await;
+
+ assert_eq!(observation.sends.len(), 1);
+ assert_eq!(observation.sends[0].recipient, "reply");
+ assert!(observation.sends[0].content.contains("hi from discord"));
+ assert_eq!(observation.sends[0].thread_ts.as_deref(), Some("thread-42"));
+}
+
+#[tokio::test]
+async fn dispatch_publishes_tinychannels_inbound_envelope() {
+ let observation = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".to_string(),
+ thread_ts: Some("topic-99".to_string()),
+ ..Default::default()
+ })
+ .await;
+
+ let envelope = observation
+ .received_event_envelope
+ .expect("dispatch should publish inbound envelope");
+ assert_eq!(envelope.channel.id, "telegram");
+ assert_eq!(envelope.message_id, "m1");
+ assert_eq!(envelope.conversation.id, "reply");
+ assert_eq!(envelope.conversation.thread_id, None);
+ assert_eq!(envelope.conversation.topic_id.as_deref(), Some("topic-99"));
+ assert_eq!(envelope.sender.id, "alice");
+}
+
+#[tokio::test]
+async fn dispatch_preserves_supplied_tinychannels_inbound_envelope() {
+ let supplied = tinychannels::ChannelInboundEnvelope {
+ channel: tinychannels::channel::ChannelRef {
+ id: "slack".into(),
+ account_id: Some("bot-a".into()),
+ },
+ message_id: "m1".into(),
+ conversation: tinychannels::channel::ConversationRef {
+ kind: tinychannels::channel::ConversationKind::Channel,
+ id: "reply".into(),
+ scope_id: Some("T123".into()),
+ parent_id: None,
+ thread_id: Some("thread-1".into()),
+ topic_id: None,
+ },
+ sender: tinychannels::channel::SenderRef {
+ id: "alice".into(),
+ name: Some("Alice".into()),
+ is_bot: false,
+ ..Default::default()
+ },
+ text: "hello".into(),
+ ..Default::default()
+ };
+
+ let observation = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "slack".to_string(),
+ thread_ts: Some("thread-1".to_string()),
+ inbound_envelope: Some(supplied),
+ ..Default::default()
+ })
+ .await;
+
+ let envelope = observation
+ .received_event_envelope
+ .expect("dispatch should publish supplied inbound envelope");
+ assert_eq!(envelope.conversation.id, "reply");
+ assert_eq!(envelope.channel.account_id.as_deref(), Some("bot-a"));
+ assert_eq!(envelope.conversation.scope_id.as_deref(), Some("T123"));
+ assert_eq!(envelope.conversation.thread_id.as_deref(), Some("thread-1"));
+ assert_eq!(envelope.sender.name.as_deref(), Some("Alice"));
+}
+
+#[tokio::test]
+async fn host_dispatch_preserves_thread_reply_and_reaction_targets() {
+ let threaded = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".into(),
+ thread_ts: Some("topic-99".into()),
+ response_text: Some("thread reply".into()),
+ ..Default::default()
+ })
+ .await;
+ assert_eq!(threaded.sends.len(), 1);
+ assert_eq!(threaded.sends[0].recipient, "reply");
+ assert_eq!(threaded.sends[0].thread_ts.as_deref(), Some("topic-99"));
+
+ let unthreaded = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".into(),
+ thread_ts: None,
+ response_text: Some("plain reply".into()),
+ ..Default::default()
+ })
+ .await;
+ assert_eq!(unthreaded.sends.len(), 1);
+ assert_eq!(unthreaded.sends[0].thread_ts, None);
+
+ let reaction = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "telegram".into(),
+ thread_ts: Some("message-42".into()),
+ supports_reactions: true,
+ response_text: Some("[REACTION:πŸ‘]".into()),
+ ..Default::default()
+ })
+ .await;
+ assert_eq!(reaction.sends.len(), 1, "one reaction is sent");
+ assert_eq!(reaction.sends[0].content, "[REACTION:πŸ‘]");
+ assert_eq!(reaction.sends[0].thread_ts.as_deref(), Some("message-42"));
+}
+
+#[tokio::test]
+async fn discord_host_pipeline_dispatches_reply_with_thread_context() {
+ let observation = run_dispatch_harness(DispatchHarnessOptions {
+ channel_name: "discord".into(),
+ thread_ts: Some("thread-42".into()),
+ response_text: Some("hi from discord".into()),
+ ..Default::default()
+ })
+ .await;
+
+ assert_eq!(observation.sends.len(), 1);
+ assert_eq!(observation.sends[0].recipient, "reply");
+ assert!(observation.sends[0].content.contains("hi from discord"));
+ assert_eq!(observation.sends[0].thread_ts.as_deref(), Some("thread-42"));
+}
+
+#[tokio::test]
+async fn discord_host_pipeline_keeps_thread_histories_separate() {
+ let _bus_guard = use_real_agent_handler().await;
+ let workspace = tempfile::tempdir().expect("temporary Discord workspace");
+ let channel_state = Arc::new(crate::channels::runtime::TestChannel::new("discord"));
+ let channel = Arc::new(ChannelHandle::Test(Arc::clone(&channel_state)));
+ let model_state = Arc::new(HistoryCaptureModel::default());
+ let model: Arc<dyn tinyinference_llm::model::ChatModel<()>> = Arc::clone(&model_state);
+ let runtime_ctx = Arc::new(ChannelRuntimeContext {
+ relay_thread: None,
+ channels_by_name: Arc::new(HashMap::from([("discord".into(), channel)])),
+ module_objects: Arc::new(HashMap::new()),
+ turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
+ Arc::clone(&model),
+ )),
+ default_provider: Arc::new("test-provider".into()),
+ tools_registry: Arc::new(vec![]),
+ system_prompt: crate::channels::ChannelSystemPrompt::fixed("test system"),
+ model: Arc::new("test-model".into()),
+ temperature: 0.0,
+ max_tool_iterations: 3,
+ turn_model_source_cache: Arc::new(Mutex::new(HashMap::from([(
+ "test-provider".into(),
+ crate::agent::tinyagents::TurnModelSource::from_model(model),
+ )]))),
+ route_overrides: Arc::new(Mutex::new(HashMap::new())),
+ api_url: None,
+ inference_url: None,
+ reliability: Arc::new(crate::config::ReliabilityConfig::default()),
+ provider_runtime_options: provider::ProviderRuntimeOptions::default(),
+ workspace_dir: Arc::new(workspace.path().to_path_buf()),
+ message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,
+ multimodal: crate::config::MultimodalConfig::default(),
+ multimodal_files: crate::config::MultimodalFileConfig::default(),
+ config: None,
+ core: None,
+ });
+
+ let first = traits::ChannelMessage {
+ reply_to_id: None,
+ topic_id: None,
+ id: "discord-a".into(),
+ sender: "user-123".into(),
+ reply_target: "channel-456".into(),
+ content: "first thread message".into(),
+ channel: "discord".into(),
+ timestamp: 1,
+ thread_ts: Some("thread-A".into()),
+ sender_name: None,
+ };
+ let second = traits::ChannelMessage {
+ id: "discord-b".into(),
+ content: "second thread message".into(),
+ thread_ts: Some("thread-B".into()),
+ ..first.clone()
+ };
+ assert_ne!(
+ super::super::context::conversation_history_key(&first),
+ super::super::context::conversation_history_key(&second)
+ );
+
+ process_channel_message(Arc::clone(&runtime_ctx), first).await;
+ process_channel_message(runtime_ctx, second).await;
+
+ let calls = model_state.calls.lock().unwrap();
+ assert_eq!(calls.len(), 2);
+ assert!(calls[0]
+ .iter()
+ .any(|(_, text)| text == "first thread message"));
+ assert!(calls[1]
+ .iter()
+ .any(|(_, text)| text == "second thread message"));
+ assert!(!calls[1]
+ .iter()
+ .any(|(_, text)| text == "first thread message"));
+ drop(calls);
+ assert_eq!(channel_state.sent_messages.lock().await.len(), 2);
+}
+
diff --git a/crates/openhuman-core/src/channels/tests/mod.rs b/crates/openhuman-core/src/channels/tests/mod.rs
index fadd5ca672..893fe2ffd5 100644
--- a/crates/openhuman-core/src/channels/tests/mod.rs
+++ b/crates/openhuman-core/src/channels/tests/mod.rs
@@ -24,6 +24,7 @@
mod common;
mod identity;
+mod host_pipeline;
mod prompt;
mod runtime_dispatch;
mod runtime_tool_calls;
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index db36f83250..327df27ae4 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -17,345 +17,6 @@ use std::time::Duration;
use tinychannels_bus as traits;
use tokio::sync::Barrier;
-#[tokio::test]
-async fn host_pipeline_preserves_inbound_thread_target_on_reply() {
- let threaded = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".into(),
- thread_ts: Some("topic-99".into()),
- response_text: Some("thread reply".into()),
- ..Default::default()
- })
- .await;
- assert_eq!(threaded.sends.len(), 1);
- assert_eq!(threaded.sends[0].recipient, "reply");
- assert_eq!(threaded.sends[0].thread_ts.as_deref(), Some("topic-99"));
-
- let unthreaded = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".into(),
- thread_ts: None,
- response_text: Some("plain reply".into()),
- ..Default::default()
- })
- .await;
- assert_eq!(unthreaded.sends.len(), 1);
- assert_eq!(unthreaded.sends[0].thread_ts, None);
-}
-
-#[tokio::test]
-async fn host_pipeline_sends_reaction_marker_with_inbound_thread_target() {
- let observation = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".into(),
- thread_ts: Some("message-42".into()),
- supports_reactions: true,
- response_text: Some("[REACTION:πŸ‘]".into()),
- ..Default::default()
- })
- .await;
-
- assert_eq!(observation.sends.len(), 1, "one reaction is sent");
- assert_eq!(observation.sends[0].content, "[REACTION:πŸ‘]");
- assert_eq!(
- observation.sends[0].thread_ts.as_deref(),
- Some("message-42")
- );
-}
-
-#[tokio::test]
-async fn discord_host_pipeline_dispatches_reply_without_telegram_reaction() {
- let observation = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "discord".into(),
- thread_ts: Some("thread-42".into()),
- response_text: Some("hi from discord".into()),
- ..Default::default()
- })
- .await;
-
- assert_eq!(observation.sends.len(), 1);
- assert_eq!(observation.sends[0].recipient, "reply");
- assert!(observation.sends[0].content.contains("hi from discord"));
- assert_eq!(observation.sends[0].thread_ts.as_deref(), Some("thread-42"));
-}
-
-#[tokio::test]
-async fn dispatch_publishes_tinychannels_inbound_envelope() {
- let observation = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".to_string(),
- thread_ts: Some("topic-99".to_string()),
- ..Default::default()
- })
- .await;
-
- let envelope = observation
- .received_event_envelope
- .expect("dispatch should publish inbound envelope");
- assert_eq!(envelope.channel.id, "telegram");
- assert_eq!(envelope.message_id, "m1");
- assert_eq!(envelope.conversation.id, "reply");
- assert_eq!(envelope.conversation.thread_id, None);
- assert_eq!(envelope.conversation.topic_id.as_deref(), Some("topic-99"));
- assert_eq!(envelope.sender.id, "alice");
-}
-
-#[tokio::test]
-async fn dispatch_preserves_supplied_tinychannels_inbound_envelope() {
- let supplied = tinychannels::ChannelInboundEnvelope {
- channel: tinychannels::channel::ChannelRef {
- id: "slack".into(),
- account_id: Some("bot-a".into()),
- },
- message_id: "m1".into(),
- conversation: tinychannels::channel::ConversationRef {
- kind: tinychannels::channel::ConversationKind::Channel,
- id: "reply".into(),
- scope_id: Some("T123".into()),
- parent_id: None,
- thread_id: Some("thread-1".into()),
- topic_id: None,
- },
- sender: tinychannels::channel::SenderRef {
- id: "alice".into(),
- name: Some("Alice".into()),
- is_bot: false,
- ..Default::default()
- },
- text: "hello".into(),
- ..Default::default()
- };
-
- let observation = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "slack".to_string(),
- thread_ts: Some("thread-1".to_string()),
- inbound_envelope: Some(supplied),
- ..Default::default()
- })
- .await;
-
- let envelope = observation
- .received_event_envelope
- .expect("dispatch should publish supplied inbound envelope");
- assert_eq!(envelope.conversation.id, "reply");
- assert_eq!(envelope.channel.account_id.as_deref(), Some("bot-a"));
- assert_eq!(envelope.conversation.scope_id.as_deref(), Some("T123"));
- assert_eq!(envelope.conversation.thread_id.as_deref(), Some("thread-1"));
- assert_eq!(envelope.sender.name.as_deref(), Some("Alice"));
-}
-
-#[tokio::test]
-async fn host_dispatch_preserves_thread_reply_and_reaction_targets() {
- let threaded = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".into(),
- thread_ts: Some("topic-99".into()),
- response_text: Some("thread reply".into()),
- ..Default::default()
- })
- .await;
- assert_eq!(threaded.sends.len(), 1);
- assert_eq!(threaded.sends[0].recipient, "reply");
- assert_eq!(threaded.sends[0].thread_ts.as_deref(), Some("topic-99"));
-
- let unthreaded = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".into(),
- thread_ts: None,
- response_text: Some("plain reply".into()),
- ..Default::default()
- })
- .await;
- assert_eq!(unthreaded.sends.len(), 1);
- assert_eq!(unthreaded.sends[0].thread_ts, None);
-
- let reaction = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "telegram".into(),
- thread_ts: Some("message-42".into()),
- supports_reactions: true,
- response_text: Some("[REACTION:πŸ‘]".into()),
- ..Default::default()
- })
- .await;
- assert_eq!(reaction.sends.len(), 1, "one reaction is sent");
- assert_eq!(reaction.sends[0].content, "[REACTION:πŸ‘]");
- assert_eq!(reaction.sends[0].thread_ts.as_deref(), Some("message-42"));
-}
-
-#[tokio::test]
-async fn discord_host_pipeline_dispatches_reply_with_thread_context() {
- let observation = run_dispatch_harness(DispatchHarnessOptions {
- channel_name: "discord".into(),
- thread_ts: Some("thread-42".into()),
- response_text: Some("hi from discord".into()),
- ..Default::default()
- })
- .await;
-
- assert_eq!(observation.sends.len(), 1);
- assert_eq!(observation.sends[0].recipient, "reply");
- assert!(observation.sends[0].content.contains("hi from discord"));
- assert_eq!(observation.sends[0].thread_ts.as_deref(), Some("thread-42"));
-}
-
-#[tokio::test]
-async fn discord_host_pipeline_keeps_thread_histories_separate() {
- let _bus_guard = use_real_agent_handler().await;
- let workspace = tempfile::tempdir().expect("temporary Discord workspace");
- let channel_state = Arc::new(crate::channels::runtime::TestChannel::new("discord"));
- let channel = Arc::new(ChannelHandle::Test(Arc::clone(&channel_state)));
- let model_state = Arc::new(HistoryCaptureModel::default());
- let model: Arc<dyn tinyinference_llm::model::ChatModel<()>> = Arc::clone(&model_state);
- let runtime_ctx = Arc::new(ChannelRuntimeContext {
- relay_thread: None,
- channels_by_name: Arc::new(HashMap::from([("discord".into(), channel)])),
- module_objects: Arc::new(HashMap::new()),
- turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
- Arc::clone(&model),
- )),
- default_provider: Arc::new("test-provider".into()),
- tools_registry: Arc::new(vec![]),
- system_prompt: crate::channels::ChannelSystemPrompt::fixed("test system"),
- model: Arc::new("test-model".into()),
- temperature: 0.0,
- max_tool_iterations: 3,
- turn_model_source_cache: Arc::new(Mutex::new(HashMap::from([(
- "test-provider".into(),
- crate::agent::tinyagents::TurnModelSource::from_model(model),
- )]))),
- route_overrides: Arc::new(Mutex::new(HashMap::new())),
- api_url: None,
- inference_url: None,
- reliability: Arc::new(crate::config::ReliabilityConfig::default()),
- provider_runtime_options: provider::ProviderRuntimeOptions::default(),
- workspace_dir: Arc::new(workspace.path().to_path_buf()),
- message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,
- multimodal: crate::config::MultimodalConfig::default(),
- multimodal_files: crate::config::MultimodalFileConfig::default(),
- config: None,
- core: None,
- });
-
- let first = traits::ChannelMessage {
- reply_to_id: None,
- topic_id: None,
- id: "discord-a".into(),
- sender: "user-123".into(),
- reply_target: "channel-456".into(),
- content: "first thread message".into(),
- channel: "discord".into(),
- timestamp: 1,
- thread_ts: Some("thread-A".into()),
- sender_name: None,
- };
- let second = traits::ChannelMessage {
- id: "discord-b".into(),
- content: "second thread message".into(),
- thread_ts: Some("thread-B".into()),
- ..first.clone()
- };
- assert_ne!(
- super::super::context::conversation_history_key(&first),
- super::super::context::conversation_history_key(&second)
- );
-
- process_channel_message(Arc::clone(&runtime_ctx), first).await;
- process_channel_message(runtime_ctx, second).await;
-
- let calls = model_state.calls.lock().unwrap();
- assert_eq!(calls.len(), 2);
- assert!(calls[0]
- .iter()
- .any(|(_, text)| text == "first thread message"));
- assert!(calls[1]
- .iter()
- .any(|(_, text)| text == "second thread message"));
- assert!(!calls[1]
- .iter()
- .any(|(_, text)| text == "first thread message"));
- drop(calls);
- assert_eq!(channel_state.sent_messages.lock().await.len(), 2);
-}
-
-#[tokio::test]
-async fn discord_host_pipeline_keeps_thread_histories_separate() {
- let observed_histories = Arc::new(Mutex::new(Vec::<Vec<String>>::new()));
- let histories_for_handler = Arc::clone(&observed_histories);
- let _bus_guard = mock_agent_run_turn(move |request: AgentTurnRequest| {
- let histories = Arc::clone(&histories_for_handler);
- async move {
- histories.lock().unwrap().push(
- request
- .history
- .iter()
- .map(|message| message.content.clone())
- .collect(),
- );
- Ok(AgentTurnResponse::new("discord reply"))
- }
- })
- .await;
-
- let workspace = tempfile::tempdir().expect("temporary Discord workspace");
- let channel = Arc::new(ChannelHandle::Test(Arc::new(
- crate::channels::runtime::TestChannel::new("discord"),
- )));
- let runtime_ctx = Arc::new(ChannelRuntimeContext {
- relay_thread: None,
- channels_by_name: Arc::new(HashMap::from([("discord".into(), channel)])),
- module_objects: Arc::new(HashMap::new()),
- turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
- Arc::new(super::common::DummyModel),
- )),
- default_provider: Arc::new("test-provider".into()),
- tools_registry: Arc::new(vec![]),
- system_prompt: crate::channels::ChannelSystemPrompt::fixed("test system"),
- model: Arc::new("test-model".into()),
- temperature: 0.0,
- max_tool_iterations: 3,
- turn_model_source_cache: Arc::new(Mutex::new(HashMap::new())),
- route_overrides: Arc::new(Mutex::new(HashMap::new())),
- api_url: None,
- inference_url: None,
- reliability: Arc::new(crate::config::ReliabilityConfig::default()),
- provider_runtime_options: provider::ProviderRuntimeOptions::default(),
- workspace_dir: Arc::new(workspace.path().to_path_buf()),
- message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS,
- multimodal: crate::config::MultimodalConfig::default(),
- multimodal_files: crate::config::MultimodalFileConfig::default(),
- config: None,
- core: None,
- });
-
- for (id, thread_ts, content) in [
- ("discord-a", "thread-A", "first thread message"),
- ("discord-b", "thread-B", "second thread message"),
- ] {
- process_channel_message(
- Arc::clone(&runtime_ctx),
- traits::ChannelMessage {
- reply_to_id: None,
- topic_id: None,
- id: id.into(),
- sender: "user-123".into(),
- reply_target: "channel-456".into(),
- content: content.into(),
- channel: "discord".into(),
- timestamp: 1,
- thread_ts: Some(thread_ts.into()),
- sender_name: None,
- },
- )
- .await;
- }
-
- let histories = observed_histories.lock().unwrap();
- assert_eq!(histories.len(), 2);
- assert!(histories[0]
- .iter()
- .any(|text| text == "first thread message"));
- assert!(histories[1]
- .iter()
- .any(|text| text == "second thread message"));
- assert!(!histories[1]
- .iter()
- .any(|text| text == "first thread message"));
-}
-
#[tokio::test]
async fn message_dispatch_processes_messages_in_parallel() {
// Install a deterministic stub that takes 250ms per turn and records