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/core/runtime/builder.rs,crates/openhuman-core/src/cor
Steven Enamakelb6e76dac7875
diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rsindex 26349589d1..5bf727c04d 100644--- a/crates/openhuman-core/src/core/runtime/builder.rs+++ b/crates/openhuman-core/src/core/runtime/builder.rs@@ -673,6 +673,7 @@ impl CoreBuilder {has_operator_token,host: self.host,port: self.port,+ service_tasks: crate::core::runtime::services::ServiceTasks::default(),})}}@@ -687,6 +688,10 @@ pub struct CoreRuntime {has_operator_token: bool,host: Option<String>,port: Option<u16>,+ /// The background services [`start_services`](Self::start_services)+ /// started; aborted by [`stop_services`](Self::stop_services) and when+ /// the runtime drops.+ service_tasks: crate::core::runtime::services::ServiceTasks,}impl CoreRuntime {@@ -783,18 +788,33 @@ impl CoreRuntime {/// never leaves pollers, one-shot jobs, MCP processes or socket/// reconnect work running without a live runtime. A runtime with no/// transport calls it directly.+ ///+ /// Idempotent: a second call while the services run does nothing. The+ /// long-lived service loops (cron, channels, login-gated services, the+ /// update checker) are tracked and stopped by+ /// [`stop_services`](Self::stop_services) or when this runtime drops.pub async fn start_services(&self) {use crate::core::runtime::services;+ if !self.service_tasks.begin() {+ log::debug!("[core-runtime] start_services: already started; skipped");+ return;+ }+ log::debug!("[core-runtime] start_services services={:?}", self.services);super::bootstrap::start_core_runtime_services(self.services, self.config.as_ref()).await;if self.services.login_gated {- services::spawn_login_gated_services(self.ctx.host_kind().is_desktop_shell());+ self.service_tasks.track(+ "login_gated",+ services::spawn_login_gated_services(self.ctx.host_kind().is_desktop_shell()),+ );}if self.services.update_scheduler {- services::spawn_update_scheduler();+ self.service_tasks+ .track("update_scheduler", services::spawn_update_scheduler());}if self.services.cron {- services::spawn_cron_service();+ self.service_tasks+ .track("cron", services::spawn_cron_service(Arc::clone(&self.ctx)));}// Flow-run boot reconciliation is selected by the flows *domain*, not by// a background service — runs can be started without cron in the@@ -803,9 +823,18 @@ impl CoreRuntime {services::spawn_flows_boot_reconcile();}if self.services.channels {- services::spawn_channels_service();+ if let Some(handle) = services::spawn_channels_service() {+ self.service_tasks.track("channels", handle);+ }}}++ /// Stop the background services [`start_services`](Self::start_services)+ /// started. They may be started again afterwards. Also runs on drop.+ pub fn stop_services(&self) {+ log::debug!("[core-runtime] stop_services");+ self.service_tasks.stop();+ }}#[cfg(test)]diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rsindex a767bdeeac..6fe1398fff 100644--- a/crates/openhuman-core/src/core/runtime/services.rs+++ b/crates/openhuman-core/src/core/runtime/services.rs@@ -242,7 +242,7 @@ pub fn spawn_cron_service(/// messages are never polled. Skipped entirely when/// `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set to `1`/`true`, and returns early/// when no channel integrations are configured.-pub fn spawn_channels_service() {+pub fn spawn_channels_service() -> Option<tokio::task::JoinHandle<()>> {// Compile-time `channels` gate: the body names `channels::start_channels`,// so the whole thing is `#[cfg]`-gated. With the feature off there are no// realtime listeners to spawn.@@ -255,7 +255,7 @@ pub fn spawn_channels_service() {// Capture before loading config: logout during that await must also// invalidate a listener that has not finished starting yet.let channel_session = crate::channels::session::channel_session();- tokio::spawn(async move {+ return Some(tokio::spawn(async move {let config = match crate::config::Config::load_or_init().await {Ok(c) => c,Err(e) => {@@ -275,12 +275,15 @@ pub fn spawn_channels_service() {{log::error!("[channels] start_channels ended with error: {e}");}- });- } else {+ }));+ }+ #[cfg(feature = "channels")]+ {log::info!("[channels] OPENHUMAN_DISABLE_CHANNEL_LISTENERS set — skipping start_channels");}#[cfg(not(feature = "channels"))]log::debug!("[channels] channels feature disabled at compile time — not spawning listeners");+ None}/// Which bootstrap jobs a given [`ServiceSet`] enables — the single source of