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/bus_host.rs,crates/openhuman-core/src/cron/bus_h
Steven Enamakel70fc4fb2e50e
diff --git a/crates/openhuman-core/src/cron/bus_host.rs b/crates/openhuman-core/src/cron/bus_host.rsindex 7b6c5855e4..78bcd1d3ec 100644--- a/crates/openhuman-core/src/cron/bus_host.rs+++ b/crates/openhuman-core/src/cron/bus_host.rs@@ -140,7 +140,11 @@ impl Binding {#[cfg(feature = "flows")]pub(crate) fn flows(&self) -> &crate::flows::bus::FlowTriggerSubscriber {self.flows- .get_or_init(|| crate::flows::bus::FlowTriggerSubscriber::new(Arc::new(self.config())))+ .get_or_init(|| {+ crate::flows::bus::FlowTriggerSubscriber::with_config_source(+ Arc::clone(&self.config),+ )+ })}}diff --git a/crates/openhuman-core/src/cron/bus_host_tests.rs b/crates/openhuman-core/src/cron/bus_host_tests.rsindex 3cf65b3418..292df535b1 100644--- a/crates/openhuman-core/src/cron/bus_host_tests.rs+++ b/crates/openhuman-core/src/cron/bus_host_tests.rs@@ -312,8 +312,8 @@ async fn refreshing_binding_config_updates_existing_flow_subscriber() {)),);let (seen_tx, mut seen_rx) = mpsc::unbounded_channel();- let subscriber = crate::flows::bus::FlowTriggerSubscriber::with_runner(- Arc::new(initial),+ let subscriber = crate::flows::bus::FlowTriggerSubscriber::with_runner_and_config_source(+ Arc::clone(&binding.config),1,move |_ctx, config, _request| {let seen_tx = seen_tx.clone();diff --git a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs b/crates/openhuman-core/src/cron/scheduler/run_delivery.rsindex 1c4aefb86d..e9576f49b5 100644--- a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/run_delivery.rs@@ -136,6 +136,11 @@ pub(crate) async fn trigger(binding: &Binding, flow_id: &str, run_id: &str) -> Aretryable: false,};};+ BUS.publish(DomainEvent::CronJobTriggered {+ job_id: job.id.clone(),+ job_name: job.name.clone().unwrap_or_default(),+ job_type: format!("{:?}", job.job_type),+ });let outcome = handler.run(&JobRunContext::new(binding.clone()), &job, run_id).await;diff --git a/crates/openhuman-core/src/cron/store.rs b/crates/openhuman-core/src/cron/store.rsindex 3afce2c194..ae428f9836 100644--- a/crates/openhuman-core/src/cron/store.rs+++ b/crates/openhuman-core/src/cron/store.rs@@ -175,7 +175,7 @@ pub fn remove_job(config: &Config, id: &str) -> Result<()> {job_id: id.to_string(),},)?;- println!("✅ Removed cron job {id}");+ tracing::info!(job_id = %id, "removed cron job");Ok(())}diff --git a/crates/openhuman-core/src/flows/bus/trigger.rs b/crates/openhuman-core/src/flows/bus/trigger.rsindex b201196c53..34bb83ec45 100644--- a/crates/openhuman-core/src/flows/bus/trigger.rs+++ b/crates/openhuman-core/src/flows/bus/trigger.rs@@ -12,7 +12,7 @@ use std::collections::HashMap;use std::future::Future;use std::pin::Pin;use std::sync::atomic::{AtomicUsize, Ordering};-use std::sync::{Arc, Mutex};+use std::sync::{Arc, Mutex, RwLock};use tinybus::EventHandler;use tinyflows::model::TriggerKind;use tinyflows_catalog::Flow;@@ -78,7 +78,7 @@ pub(super) fn matches_app_event(flow: &Flow, toolkit: &str, trigger_slug: &str)/// Listens for normalized trigger events and starts runs for matching/// enabled flows. See the module doc for the full contract.pub struct FlowTriggerSubscriber {- config: Arc<Config>,+ config: Arc<RwLock<Config>>,queues: Arc<Mutex<HashMap<DispatchKey, Arc<FlowRunQueue>>>>,runner: Arc<RunExecutor>,queue_capacity: usize,@@ -146,6 +146,10 @@ const APP_EVENT_QUEUE_CAPACITY: usize = 32;impl FlowTriggerSubscriber {pub fn new(config: Arc<Config>) -> Self {+ Self::with_config_source(Arc::new(RwLock::new((*config).clone())))+ }++ pub(crate) fn with_config_source(config: Arc<RwLock<Config>>) -> Self {Self::with_executor(config,APP_EVENT_QUEUE_CAPACITY,@@ -173,7 +177,7 @@ impl FlowTriggerSubscriber {)}- fn with_executor<F, Fut>(config: Arc<Config>, queue_capacity: usize, runner: F) -> Self+ fn with_executor<F, Fut>(config: Arc<RwLock<Config>>, queue_capacity: usize, runner: F) -> SelfwhereF: Fn(crate::core::runtime::DispatchCtx, Arc<Config>, TriggerRunRequest) -> Fut+ Send@@ -195,6 +199,22 @@ impl FlowTriggerSubscriber {#[cfg(test)]pub(crate) fn with_runner<F, Fut>(config: Arc<Config>, queue_capacity: usize, runner: F) -> Self+ where+ F: Fn(crate::core::runtime::DispatchCtx, Arc<Config>, TriggerRunRequest) -> Fut+ + Send+ + Sync+ + 'static,+ Fut: Future<Output = ()> + Send + 'static,+ {+ Self::with_executor(Arc::new(RwLock::new((*config).clone())), queue_capacity, runner)+ }++ #[cfg(test)]+ pub(crate) fn with_runner_and_config_source<F, Fut>(+ config: Arc<RwLock<Config>>,+ queue_capacity: usize,+ runner: F,+ ) -> SelfwhereF: Fn(crate::core::runtime::DispatchCtx, Arc<Config>, TriggerRunRequest) -> Fut+ Send@@ -435,7 +455,13 @@ impl FlowTriggerSubscriber {/// The configuration to handle an event under (`super::owner::config_for_scope`).pub(super) fn config_for_scope(&self, ctx: &crate::core::runtime::DispatchCtx) -> Arc<Config> {- super::owner::config_for_scope(ctx, &self.config)+ let config = Arc::new(+ self.config+ .read()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .clone(),+ );+ super::owner::config_for_scope(ctx, &config)}/// A `flow`-type cron job fired (`cron::scheduler`'s trigger sink calls@@ -449,7 +475,8 @@ impl FlowTriggerSubscriber {host: &crate::core::runtime::DispatchCtx,flow_id: &str,) {- super::owner::as_owner(host, &self.config, flow_id, |ctx| {+ let config = self.config_for_scope(host);+ super::owner::as_owner(host, &config, flow_id, |ctx| {self.handle_schedule_tick(ctx, flow_id)}).await