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/bus_host.rs,crates/openhuman-core/src/cron/bus_h

Steven Enamakel44908ae363eb
diff --git a/crates/openhuman-core/src/cron/bus_host.rs b/crates/openhuman-core/src/cron/bus_host.rs
index ff03ddeffd..9f693f88b6 100644
--- a/crates/openhuman-core/src/cron/bus_host.rs
+++ b/crates/openhuman-core/src/cron/bus_host.rs
@@ -113,11 +113,7 @@ impl Binding {
if runs.contains(run_id) {
return;
}
- if runs.len() >= 1024 {
- runs.clear();
- }
runs.insert(run_id.to_string());
- drop(runs);
crate::core::bus::BUS.publish(crate::core::events::DomainEvent::CronJobTriggered {
job_id: job.id.clone(),
job_name: job.name.clone().unwrap_or_default(),
diff --git a/crates/openhuman-core/src/cron/bus_host_tests.rs b/crates/openhuman-core/src/cron/bus_host_tests.rs
index 9668953d9d..e228e70a6c 100644
--- a/crates/openhuman-core/src/cron/bus_host_tests.rs
+++ b/crates/openhuman-core/src/cron/bus_host_tests.rs
@@ -356,6 +356,39 @@ async fn refreshing_binding_config_updates_existing_flow_subscriber() {
assert_eq!(seen_rx.recv().await, Some(refreshed.action_dir));
}
+#[test]
+fn triggered_run_guard_retains_long_lived_ids_past_1024_runs() {
+ let tmp = TempDir::new().unwrap();
+ let config = config(&tmp);
+ let binding = Binding::new(
+ &DispatchCtx::ambient(),
+ &config,
+ Arc::new(SecurityPolicy::from_config(
+ &config.autonomy,
+ &config.workspace_dir,
+ &config.action_dir,
+ )),
+ );
+ let job = shell_job(&config, "echo guard");
+ for index in 0..1025 {
+ binding.publish_triggered_once(&job, &format!("long-lived-run-{index}"));
+ }
+
+ let before = binding
+ .triggered_runs
+ .lock()
+ .unwrap()
+ .len();
+ assert_eq!(before, 1025);
+ binding.publish_triggered_once(&job, "long-lived-run-0");
+ let after = binding
+ .triggered_runs
+ .lock()
+ .unwrap()
+ .len();
+ assert_eq!(after, before, "an active run must remain deduplicated");
+}
+
#[cfg(feature = "flows")]
#[tokio::test]
async fn a_scheduled_flow_run_publishes_a_trigger_before_completion() {