Skip to content

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

fix(cron): report manual run errors to the caller

Steven Enamakel9692a04cfb14
diff --git a/crates/openhuman-core/src/cron/scheduler/dispatcher.rs b/crates/openhuman-core/src/cron/scheduler/dispatcher.rs
index f7a0dce701..23a70fe871 100644
--- a/crates/openhuman-core/src/cron/scheduler/dispatcher.rs
+++ b/crates/openhuman-core/src/cron/scheduler/dispatcher.rs
@@ -52,8 +52,13 @@ pub(crate) async fn run_job_now(
let ctx = ctx.clone();
let config = config.clone();
tokio::spawn(async move {
- let result = own_manual_run(ctx, config, job, run_id, wait, delivery, reply_tx).await;
+ let mut reply_tx = Some(reply_tx);
+ let result =
+ own_manual_run(ctx, config, job, run_id, wait, delivery, &mut reply_tx).await;
if let Err(error) = result {
+ if let Some(reply_tx) = reply_tx.take() {
+ let _ = reply_tx.send(Err(error.to_string()));
+ }
tracing::warn!(%error, "[cron:scheduler] manual worker owner stopped before acknowledgement");
}
});
@@ -69,7 +74,7 @@ async fn own_manual_run(
run_id: String,
wait: bool,
delivery: ManualDelivery,
- reply_tx: tokio::sync::oneshot::Sender<Result<RunJobReply, String>>,
+ reply_tx: &mut Option<tokio::sync::oneshot::Sender<Result<RunJobReply, String>>>,
) -> Result<()> {
// Keep the invocation's CoreContext strongly pinned while Binding itself
// retains only a Weak reference. The task is the acyclic lifetime owner.
@@ -134,7 +139,6 @@ async fn own_manual_run(
};
let mut started = false;
- let mut reply_tx = Some(reply_tx);
let mut retry_delay = Duration::from_millis(20);
let terminal = loop {
let state = if !started {