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
feat(memory): sync every live agent's memory sources under its own context (#7032)
oxoxDevb512b29bb1db
diff --git a/crates/openhuman-core/src/memory/bus.rs b/crates/openhuman-core/src/memory/bus.rsindex 353a0fcaf8..6c8c2fff8c 100644--- a/crates/openhuman-core/src/memory/bus.rs+++ b/crates/openhuman-core/src/memory/bus.rs@@ -56,6 +56,28 @@ impl EventHandler<DomainEvent> for SystemJobsSubscriber {}};run_system_job(&config, job).await;+ if job == SOURCES_SYNC_JOB {+ sync_live_agent_sources().await;+ }+ }+}++/// Starts the due source syncs of every live embedded agent, each under its+/// own context so its memory binding and sources apply.+async fn sync_live_agent_sources() {+ for (agent_id, ctx) in crate::core::runtime::AgentContextRegistry::live() {+ crate::core::runtime::CoreContext::scope(ctx, async {+ match crate::config::ops::load_current_or_init().await {+ Ok(config) => {+ tracing::debug!(agent = %agent_id, "[memory:bus] agent source sync");+ run_system_job(&config, SOURCES_SYNC_JOB).await;+ }+ Err(error) => {+ tracing::debug!(agent = %agent_id, %error, "[memory:bus] agent config unavailable");+ }+ }+ })+ .await;}}diff --git a/crates/openhuman-core/src/memory/sources/sync.rs b/crates/openhuman-core/src/memory/sources/sync.rsindex a1929d1fdf..dd4ba264b6 100644--- a/crates/openhuman-core/src/memory/sources/sync.rs+++ b/crates/openhuman-core/src/memory/sources/sync.rs@@ -197,7 +197,7 @@ pub fn start_sync(config: &Config, id: Option<&str>) -> MemoryResult<Vec<String>});started.push(source.id.clone());let config = config.clone();- tokio::spawn(async move {+ crate::core::runtime::spawn_scoped(async move {run_and_record(&config, &source).await;RUNNING.lock()