Skip to content

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

fix(cron): sync legacy next_run fields in test helper

Steven Enamakelbfd6c6a99956
diff --git a/crates/openhuman-core/src/cron/store.rs b/crates/openhuman-core/src/cron/store.rs
index 1a9bbd1514..b455c53688 100644
--- a/crates/openhuman-core/src/cron/store.rs
+++ b/crates/openhuman-core/src/cron/store.rs
@@ -311,6 +311,9 @@ pub fn list_runs(config: &Config, job_id: &str, limit: usize) -> Result<Vec<Cron
/// Moves a job's next run to `at`, which no production path can do directly
/// (a patch reschedules from the schedule, not to a given instant). Writes the
/// instant the store keeps (`next_run_ms`), so the due-job query sees it.
+/// Legacy TinyFlows rows also carry `next_run` and `next_run_ns`; keep those
+/// representations in sync when present so the module's claim decoder sees
+/// the same deadline as the due-job query.
#[cfg(test)]
pub(crate) fn force_next_run_for_test(
config: &Config,
@@ -326,6 +329,15 @@ pub(crate) fn force_next_run_for_test(
if let Some(stored) = docs.get(collection, &job_id).await? {
let mut doc = stored.doc;
doc["next_run_ms"] = serde_json::json!(at.timestamp_millis());
+ if doc.get("next_run").is_some() {
+ doc["next_run"] = serde_json::json!(at.to_rfc3339());
+ }
+ if doc.get("next_run_ns").is_some() {
+ let next_run_ns = at
+ .timestamp_nanos_opt()
+ .ok_or_else(|| anyhow::anyhow!("next run is outside nanosecond range"))?;
+ doc["next_run_ns"] = serde_json::json!(next_run_ns);
+ }
docs.put(collection, &job_id, doc, Precondition::None)
.await?;
return Ok(());