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
fix(agent): reap orphaned runs across every agent scope
Steven Enamakelfbfa3b449f6a
diff --git a/crates/openhuman-core/src/agent/tinyagents/reaper.rs b/crates/openhuman-core/src/agent/tinyagents/reaper.rsindex 266cf6c8c5..5b66fbb538 100644--- a/crates/openhuman-core/src/agent/tinyagents/reaper.rs+++ b/crates/openhuman-core/src/agent/tinyagents/reaper.rs@@ -17,8 +17,16 @@ use tinyagents_session::transcript::import::ops::open_session_stores;/// Skipped on a storage backend other processes may share (MongoDB): there a/// non-terminal status can belong to a run another replica is still driving,/// and cancelling it would hide that run from active and late-attach status.+///+/// With a storage backend every agent keeps its own status store, so the+/// sweep visits `local` and then each known agent (`crate::storage::agents`).pub(crate) async fn reap_orphaned_runs(workspace: &Path) -> usize {- reap_unless_shared(workspace, crate::storage::installed_is_shared()).await+ let shared = crate::storage::installed_is_shared();+ crate::storage::agents::for_each_scope("run reaper", || reap_unless_shared(workspace, shared))+ .await+ .into_iter()+ .map(|(_, reaped)| reaped)+ .sum()}async fn reap_unless_shared(workspace: &Path, shared: bool) -> usize {diff --git a/crates/openhuman-core/src/flows/ops/triggers.rs b/crates/openhuman-core/src/flows/ops/triggers.rsindex c7b48941c8..2fc64bdc2e 100644--- a/crates/openhuman-core/src/flows/ops/triggers.rs+++ b/crates/openhuman-core/src/flows/ops/triggers.rs@@ -248,10 +248,11 @@ pub async fn reconcile_schedule_triggers_on_boot(config: &Config) -> Result<(),// (`crate::storage::agents`); each scope's flows get their cron jobs in// that scope, where the scheduler visits them.let mut errors = Vec::new();- for (agent, result) in crate::storage::agents::for_each_scope("flows schedule reconcile", || {- reconcile_schedule_triggers_in_scope(config)- })- .await+ for (agent, result) in+ crate::storage::agents::for_each_scope("flows schedule reconcile", || {+ reconcile_schedule_triggers_in_scope(config)+ })+ .await{if let Err(error) = result {errors.push(format!("{}: {error}", agent.as_deref().unwrap_or("local")));