Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(storage): use scoped runtime spawn for blob sweeper

Steven Enamakele9b6b924a5f1
diff --git a/crates/openhuman-core/src/storage/blob_sweep.rs b/crates/openhuman-core/src/storage/blob_sweep.rs
index 9ddd68c55e..990aa6d482 100644
--- a/crates/openhuman-core/src/storage/blob_sweep.rs
+++ b/crates/openhuman-core/src/storage/blob_sweep.rs
@@ -91,7 +91,7 @@ pub async fn sweep_installed() -> u64 {
/// Spawns the sweeper: after `first_delay`, then every `interval`, until the
/// task is aborted. Missed ticks are skipped, not replayed.
pub fn spawn(first_delay: Duration, interval: Duration) -> tokio::task::JoinHandle<()> {
- tokio::spawn(async move {
+ crate::core::runtime::spawn_scoped(async move {
tracing::debug!(
first_delay_secs = first_delay.as_secs(),
interval_secs = interval.as_secs(),
diff --git a/scripts/ci/saas-ambient-baseline.json b/scripts/ci/saas-ambient-baseline.json
index d7c7557c76..2397431a84 100644
--- a/scripts/ci/saas-ambient-baseline.json
+++ b/scripts/ci/saas-ambient-baseline.json
@@ -16,14 +16,14 @@
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/agent/harness/host_definition.rs",
- "line": 190,
+ "line": 207,
"text": "let config = crate::config::Config::load_or_init().await?;",
"occurrence": 1
},
{
"rule": "ambient-context",
"path": "crates/openhuman-core/src/agent/harness/host_definition.rs",
- "line": 270,
+ "line": 287,
"text": "crate::core::runtime::CoreContext::current()",
"occurrence": 1
},
@@ -100,7 +100,7 @@
{
"rule": "ambient-context",
"path": "crates/openhuman-core/src/agent/session_store/mod.rs",
- "line": 237,
+ "line": 236,
"text": "crate::core::runtime::CoreContext::current()",
"occurrence": 1
},
@@ -415,77 +415,77 @@
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 143,
+ "line": 152,
"text": "tokio::spawn(async move {",
"occurrence": 1
},
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 144,
+ "line": 153,
"text": "match crate::config::Config::load_or_init().await {",
"occurrence": 1
},
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 178,
+ "line": 187,
"text": "tokio::spawn(async {",
"occurrence": 1
},
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 179,
+ "line": 188,
"text": "match crate::config::Config::load_or_init().await {",
"occurrence": 2
},
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 209,
+ "line": 218,
"text": "tokio::spawn(async {",
"occurrence": 2
},
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 211,
+ "line": 220,
"text": "match crate::config::Config::load_or_init().await {",
"occurrence": 3
},
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 245,
+ "line": 254,
"text": "tokio::spawn(crate::core::runtime::CoreContext::scope(ctx, async {",
"occurrence": 1
},
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 298,
+ "line": 307,
"text": "let config = match crate::config::Config::load_or_init().await {",
"occurrence": 1
},
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 409,
+ "line": 418,
"text": "tokio::spawn(async move {",
"occurrence": 2
},
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 466,
+ "line": 475,
"text": "tokio::spawn(async move {",
"occurrence": 3
},
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/core/runtime/services.rs",
- "line": 468,
+ "line": 477,
"text": "let config = match Config::load_or_init().await {",
"occurrence": 1
},
@@ -576,7 +576,7 @@
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs",
- "line": 518,
+ "line": 532,
"text": "tokio::spawn(async move { while rx.recv().await.is_some() {} });",
"occurrence": 1
},
@@ -765,14 +765,14 @@
{
"rule": "ambient-context",
"path": "crates/openhuman-core/src/mcp/module_client.rs",
- "line": 518,
+ "line": 516,
"text": "let Some(context) = crate::core::runtime::CoreContext::current() else {",
"occurrence": 1
},
{
"rule": "ambient-context",
"path": "crates/openhuman-core/src/mcp/module_client.rs",
- "line": 521,
+ "line": 519,
"text": "context.session_agent().is_some()",
"occurrence": 1
},
@@ -786,7 +786,7 @@
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/mcp/server/http.rs",
- "line": 48,
+ "line": 49,
"text": "let host_config = Config::load_or_init().await?;",
"occurrence": 1
},
@@ -800,7 +800,7 @@
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/mcp/server/module.rs",
- "line": 405,
+ "line": 403,
"text": "task: tokio::spawn((self.callback_dispatch)(call)),",
"occurrence": 1
},
@@ -1038,21 +1038,21 @@
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/skills/runtime/run_machinery.rs",
- "line": 64,
+ "line": 63,
"text": "let config_snapshot = match Config::load_or_init().await {",
"occurrence": 1
},
{
"rule": "bare-spawn",
"path": "crates/openhuman-core/src/skills/runtime/run_machinery.rs",
- "line": 160,
+ "line": 159,
"text": "tokio::spawn(async move {",
"occurrence": 1
},
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/skills/runtime/run_machinery.rs",
- "line": 166,
+ "line": 165,
"text": "let mut config = match Config::load_or_init().await {",
"occurrence": 1
},
@@ -1161,13 +1161,6 @@
"text": "let config = Config::load_or_init()",
"occurrence": 1
},
- {
- "rule": "bare-spawn",
- "path": "crates/openhuman-core/src/threads/store/blocking.rs",
- "line": 72,
- "text": "match tokio::task::spawn_blocking(f).await {",
- "occurrence": 1
- },
{
"rule": "ambient-config",
"path": "crates/openhuman-core/src/tools/impl/document/engine.rs",