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(profiles): route cron admission reconciliation through the host backend
Steven Enamakel0599497d68e6
diff --git a/crates/openhuman-core/src/core/runtime/saas.rs b/crates/openhuman-core/src/core/runtime/saas.rsindex 6592665367..e5f6c06920 100644--- a/crates/openhuman-core/src/core/runtime/saas.rs+++ b/crates/openhuman-core/src/core/runtime/saas.rs@@ -523,7 +523,11 @@ pub async fn build_with_profile_capabilities();}let host = Arc::new(- crate::profiles::ProfileHost::with_backend(config, runtime.context().clone(), backend)+ crate::profiles::ProfileHost::with_fenced_backend(+ config,+ runtime.context().clone(),+ backend,+ ).map_err(|e| anyhow::anyhow!("[saas] {e}"))?.with_capabilities(capabilities),);diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rsindex d13efe3135..128cdae2db 100644--- a/crates/openhuman-core/src/profiles/host.rs+++ b/crates/openhuman-core/src/profiles/host.rs@@ -139,7 +139,9 @@ impl ProfileHost {}/// A host over `backend` when given (the shared registry and cluster- /// leases), else as [`Self::new`].+ /// leases), else as [`Self::new`]. Supplied backends are guarded by this+ /// host's profile fences for cron policy writes; an already-fenced backend+ /// remains safe, with an additional host guard around it.////// # Errors///@@ -153,8 +155,8 @@ impl ProfileHost {}/// Construct a host over the already-fenced backend installed by the- /// runtime. Kept crate-private so external callers use [`Self::with_backend`],- /// which adds this host's fence around a supplied raw backend.+ /// runtime. Kept crate-private so the installed backend is not wrapped a+ /// second time.pub(crate) fn with_fenced_backend(saas: SaasConfig,operator: Arc<CoreContext>,@@ -402,7 +404,13 @@ impl ProfileHost {let anchor: Arc<dyn std::any::Any + Send + Sync> = context.clone();fence.anchor_to(Arc::downgrade(&anchor));self.fences.register(Arc::clone(&fence));- if let Err(error) = super::lifecycle::reconcile_cron_admission(&config, id).await {+ if let Err(error) = super::lifecycle::reconcile_cron_admission(+ &config,+ id,+ self.cron_backend.as_ref(),+ )+ .await+ {self.fences.retire(id.as_str(), grant.epoch);profile_lease::release_all(self, vec![(id.clone(), grant)]).await;return Err(OpenError::Storage(error));diff --git a/crates/openhuman-core/src/profiles/lifecycle.rs b/crates/openhuman-core/src/profiles/lifecycle.rsindex 0e34ff4c6d..cb30f8a793 100644--- a/crates/openhuman-core/src/profiles/lifecycle.rs+++ b/crates/openhuman-core/src/profiles/lifecycle.rs@@ -43,11 +43,17 @@ use crate::storage::lease::{LeaseError, LeaseGrant};pub(super) async fn reconcile_cron_admission(config: &Config,id: &ProfileId,+ backend: Option<&Arc<dyn crate::storage::StorageBackend>>,) -> Result<(), String> {- let scope = crate::cron::documents_port::DocScope::for_scope(- config,- crate::storage::scope_for_profile(id.as_str()),- );+ let profile_scope = crate::storage::scope_for_profile(id.as_str());+ let scope = match backend {+ Some(backend) => crate::cron::documents_port::DocScope::on_backend(+ config,+ Arc::clone(backend),+ profile_scope,+ ),+ None => crate::cron::documents_port::DocScope::for_scope(config, profile_scope),+ };let limit = if config.cron.agent_jobs_only {Some(config.cron.max_active_jobs as usize)} else {@@ -151,7 +157,7 @@ impl ProfileHost {let anchor: Arc<dyn std::any::Any + Send + Sync> = Arc::new(());fence.anchor_to(Arc::downgrade(&anchor));self.fences.register(Arc::clone(&fence));- let reconciled = reconcile_cron_admission(&config, id).await;+ let reconciled = reconcile_cron_admission(&config, id, self.cron_backend.as_ref()).await;self.fences.retire(id.as_str(), grant.epoch);reconciled?;let meta = ProfileMeta {