Skip to content

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

fix(cron): deliver scheduled output to the originating channel

Steven Enamakelad0048f8b6e2
diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs
index e8c5558c2d..82139fbf03 100644
--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs
+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs
@@ -204,6 +204,18 @@ async fn deliver_to_web_thread(
.map_err(|e| anyhow!("origin reply persistence task failed: {e}"))?
.map_err(|e| anyhow!("could not store the reply in the origin thread: {e}"))?;
+ publish_web_channel_event(WebChannelEvent {
+ event: "proactive_message".to_string(),
+ client_id: "system".to_string(),
+ thread_id: thread_id.to_string(),
+ request_id: request_id.clone(),
+ full_response: Some(text.to_string()),
+ success: Some(true),
+ ..Default::default()
+ });
+
+ // After the announcement: waiting out a live turn of this session must not
+ // delay the user seeing the reply (the thread row is already stored).
if let Err(e) = append_to_origin_transcript(
&config.workspace_dir,
&TranscriptAppend {
@@ -225,15 +237,6 @@ async fn deliver_to_web_thread(
);
}
- publish_web_channel_event(WebChannelEvent {
- event: "proactive_message".to_string(),
- client_id: "system".to_string(),
- thread_id: thread_id.to_string(),
- request_id: request_id.clone(),
- full_response: Some(text.to_string()),
- success: Some(true),
- ..Default::default()
- });
tracing::debug!(
job_id = %job.id,
run_id = %run_id,