The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed crates/openhuman-core/src/cron/scheduler.rs,crates/openhuman-core/src/cron/sche
Steven Enamakel48b19d63e0c5
diff --git a/crates/openhuman-core/src/cron/scheduler.rs b/crates/openhuman-core/src/cron/scheduler.rsindex 88c0f3eda2..93f2a0667f 100644--- a/crates/openhuman-core/src/cron/scheduler.rs+++ b/crates/openhuman-core/src/cron/scheduler.rs@@ -6,6 +6,7 @@mod agent_run;mod delivery;mod failure_classification;+pub(crate) mod in_flight;mod retry;mod run_record;mod shell_job;diff --git a/crates/openhuman-core/src/cron/scheduler/in_flight.rs b/crates/openhuman-core/src/cron/scheduler/in_flight.rsnew file mode 100644index 0000000000..ae8f0fb2ea--- /dev/null+++ b/crates/openhuman-core/src/cron/scheduler/in_flight.rs@@ -0,0 +1,18 @@+//! Which cron jobs are running right now. Stub (RED).++/// Held for the duration of one run.+pub(crate) struct InFlightGuard;++/// Mark `job_id` as running until the returned guard drops.+pub(crate) fn enter(_job_id: &str) -> InFlightGuard {+ InFlightGuard+}++/// Whether any run of `job_id` is in progress.+pub(crate) fn is_running(_job_id: &str) -> bool {+ false+}++#[cfg(test)]+#[path = "in_flight_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/cron/scheduler/in_flight_tests.rs b/crates/openhuman-core/src/cron/scheduler/in_flight_tests.rsnew file mode 100644index 0000000000..0303f17f29--- /dev/null+++ b/crates/openhuman-core/src/cron/scheduler/in_flight_tests.rs@@ -0,0 +1,32 @@+use super::*;++#[test]+fn a_job_is_running_exactly_while_a_guard_is_held() {+ let id = "in-flight-single";+ assert!(!is_running(id));+ let guard = enter(id);+ assert!(is_running(id));+ drop(guard);+ assert!(!is_running(id));+}++#[test]+fn overlapping_runs_keep_the_job_running_until_the_last_one_ends() {+ // A "Run now" may overlap a scheduled run of a default (not single-flight)+ // job; the first to finish must not mark the other as done.+ let id = "in-flight-overlap";+ let scheduled = enter(id);+ let manual = enter(id);+ drop(scheduled);+ assert!(is_running(id), "the manual run is still going");+ drop(manual);+ assert!(!is_running(id));+}++#[test]+fn jobs_are_tracked_independently() {+ let a = enter("in-flight-a");+ assert!(is_running("in-flight-a"));+ assert!(!is_running("in-flight-b"));+ drop(a);+}