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
refactor(core): thread profile lease through runtime services
Steven Enamakel2923885ed1cc
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rsindex d70ba5fb3e..a0e60f4c39 100644--- a/crates/openhuman-core/src/core/runtime/services.rs+++ b/crates/openhuman-core/src/core/runtime/services.rs@@ -255,8 +255,8 @@ pub fn spawn_flows_boot_reconcile() {pub fn spawn_cron_service(ctx: std::sync::Arc<crate::core::runtime::CoreContext>,) -> tokio::task::JoinHandle<()> {- let dispatch = crate::core::runtime::DispatchCtx::new(ctx.clone());- tokio::spawn(crate::core::runtime::CoreContext::scope(ctx, async move {+ let dispatch = crate::core::runtime::DispatchCtx::new(ctx);+ dispatch.clone().spawn(async move {match dispatch.load_config().await {Ok(config) => {if !config.cron.enabled {diff --git a/crates/openhuman-core/src/profiles/lease.rs b/crates/openhuman-core/src/profiles/lease.rsindex 93d609b94a..25d6590b68 100644--- a/crates/openhuman-core/src/profiles/lease.rs+++ b/crates/openhuman-core/src/profiles/lease.rs@@ -172,7 +172,7 @@ pub async fn renew_once(host: &ProfileHost) -> HeartbeatReport {/// the operator context. Runs until the process exits.pub fn heartbeat(host: Arc<ProfileHost>, operator: Arc<crate::core::runtime::CoreContext>) {let every = renew_interval(host.saas().lease_ttl());- let renewals = crate::core::runtime::CoreContext::scope(operator, async move {+ crate::core::runtime::DispatchCtx::new(operator).spawn(async move {log::info!("[profiles][lease] heartbeat started every_ms={}",every.as_millis()@@ -191,7 +191,6 @@ pub fn heartbeat(host: Arc<ProfileHost>, operator: Arc<crate::core::runtime::Cor}}});- tokio::spawn(renewals);}#[cfg(test)]diff --git a/crates/openhuman-core/src/web_chat/ops/state.rs b/crates/openhuman-core/src/web_chat/ops/state.rsindex 2c6ff3df18..2f3e79e51f 100644--- a/crates/openhuman-core/src/web_chat/ops/state.rs+++ b/crates/openhuman-core/src/web_chat/ops/state.rs@@ -220,7 +220,7 @@ pub(crate) async fn track_parallel_turn_for_test(cancel: tokio_util::sync::CancellationToken,) {let watched = cancel.clone();- let handle = tokio::spawn(async move { watched.cancelled().await });+ let handle = ctx.spawn(async move { watched.cancelled().await });parallel_in_flight(ctx).lock_owned().await.insert(key_for(ctx, request_id),ParallelEntry {