Skip to content

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

test(cron): cover announce delivery through the channel module

Steven Enamakele6e3fa3b77a3
diff --git a/crates/openhuman-core/src/cron/scheduler_announce_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler_announce_delivery_tests.rs
index ce104962d4..9493d8bebb 100644
--- a/crates/openhuman-core/src/cron/scheduler_announce_delivery_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_announce_delivery_tests.rs
@@ -30,3 +30,38 @@ async fn announce_to_unavailable_channel_is_reported_as_failed() {
"an announce without a registered channel must not report Delivered"
);
}
+
+/// An announce to a configured account goes through the channel module's
+/// progressive output and reaches the provider; the run's id is the turn id.
+#[tokio::test]
+async fn announce_success_is_delivered_through_the_channel_module_to_the_provider() {
+ let linked = crate::channels::runtime::test_support::linked_telegram_runtime().await;
+ crate::cron::channel_bridge::register_channel_bridge(linked.module_objects());
+ let tmp = TempDir::new().unwrap();
+ let config = test_config(&tmp).await;
+ let mut job = test_job("echo ok");
+ job.delivery = DeliveryConfig {
+ mode: "announce".into(),
+ channel: Some("telegram".into()),
+ to: Some("42".into()),
+ best_effort: false,
+ };
+
+ let result = deliver_run(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &job,
+ "run-announce-success",
+ "announced hello",
+ true,
+ )
+ .await;
+ crate::cron::channel_bridge::clear_channel_bridge();
+
+ assert_eq!(result.unwrap(), DeliveryStatus::Delivered);
+ let requests = linked.provider_request_paths().await;
+ assert!(
+ requests.iter().any(|path| path.ends_with("/sendMessage")),
+ "the provider should receive the announcement: {requests:?}"
+ );
+}