Skip to content

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

chore: files changed crates/openhuman-core/src/cron/scheduler/delivery.rs

Steven Enamakel9e5581ed2b68
diff --git a/crates/openhuman-core/src/cron/scheduler/delivery.rs b/crates/openhuman-core/src/cron/scheduler/delivery.rs
index 0c993a5d76..00b84e01e8 100644
--- a/crates/openhuman-core/src/cron/scheduler/delivery.rs
+++ b/crates/openhuman-core/src/cron/scheduler/delivery.rs
@@ -5,8 +5,6 @@ use super::agent_run::EMPTY_AGENT_OUTPUT;
use super::failure_classification::AGENT_JOB_USER_FAILURE_MESSAGE;
use super::origin_delivery::{deliver_to_origin, is_suppressed_output};
use crate::config::Config;
-use crate::core::bus::BUS;
-use crate::core::events::DomainEvent;
use anyhow::Result;
use chrono::Utc;
use {
@@ -215,7 +213,8 @@ pub(super) async fn deliver_run(
}
// Announce delivery — the cron job specifies the exact channel
- // and target. Used for explicit channel-targeted output.
+ // and target. Send synchronously so the recorded status reflects
+ // whether the channel runtime accepted the message.
"announce" if deliver_to_chat => {
let channel = delivery
.channel
@@ -226,19 +225,37 @@ pub(super) async fn deliver_run(
.as_deref()
.ok_or_else(|| anyhow::anyhow!("delivery.to is required for announce mode"))?;
- tracing::debug!(
- job_id = %job.id,
- channel = %channel,
- target = %target,
- "[cron] publishing CronDeliveryRequested event"
- );
- BUS.publish(DomainEvent::CronDeliveryRequested {
- job_id: job.id.clone(),
- channel: channel.to_string(),
- target: target.to_string(),
- output: output.to_string(),
- });
- status = DeliveryStatus::Delivered;
+ let idempotency_key = super::origin_delivery::origin_request_id(&job.id, run_id);
+ match super::channel_bridge::send_to_channel(
+ channel,
+ target,
+ None,
+ output,
+ &idempotency_key,
+ )
+ .await
+ {
+ Ok(()) => {
+ tracing::debug!(
+ job_id = %job.id,
+ run_id = %run_id,
+ channel = %channel,
+ "[cron] announce delivery sent"
+ );
+ status = DeliveryStatus::Delivered;
+ }
+ Err(error) => {
+ tracing::warn!(
+ job_id = %job.id,
+ run_id = %run_id,
+ channel = %channel,
+ target = %target,
+ error = %error,
+ "[cron] announce delivery failed"
+ );
+ status = DeliveryStatus::Failed;
+ }
+ }
}
// No delivery configured — output is stored in last_output only.