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
test(channels): add tests for runtime dispatch behavior
Steven Enamakel9c5d3608d141
diff --git a/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs b/crates/openhuman-core/src/channels/providers/relay/channel_tests.rsindex d7d8fde26e..0c722f3cdc 100644--- a/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs@@ -85,10 +85,8 @@ async fn send_publishes_under_the_callers_stamp_and_records_the_text() {assert_eq!(channel.sent(), vec!["reply one".to_string()]);}-#[tokio::test]-async fn a_relay_has_no_listener() {- let (tx, _rx) = tokio::sync::mpsc::channel(1);- assert!(sink().listen(tx).await.is_err());+#[test]+fn a_relay_does_not_support_draft_updates() {assert_eq!(sink().name(), "telegram");assert!(!sink().supports_draft_updates());}diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rsindex ef3ca703e2..0c9848e595 100644--- a/crates/openhuman-core/src/channels/runtime/test_support.rs+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs@@ -6,7 +6,7 @@ use super::dispatch::{};pub use super::startup::test_support::resolve_yuanbao_app_secret_for_test;use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};-use crate::channels::context::ChannelRuntimeContext;+use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};use crate::channels::ChannelSystemPrompt;use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};use crate::core::bus::BUS;diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rsindex a716545afc..1e26307687 100644--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs@@ -17,6 +17,62 @@ use tinychannels_bus as traits;use crate::channels::runtime::ChannelHandle;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 {