Skip to content

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

fix(ci): spawn sandbox shell and storage imports through scoped spawns

M3gA-Mind8def41724143
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
index 0d955ea436..6604eb0c3e 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
@@ -91,9 +91,10 @@ async fn import_into(scoped: &ScopedStorage, state_dir: &Path) -> Result<Outcome
return Ok(Outcome::NoSource);
}
- let legacy = tokio::task::spawn_blocking(move || read_legacy(&prefs_dir, &triggers_dir))
- .await
- .context("the legacy reader panicked")??;
+ let legacy =
+ crate::core::runtime::spawn_blocking_scoped(move || read_legacy(&prefs_dir, &triggers_dir))
+ .await
+ .context("the legacy reader panicked")??;
docs.ensure_collection(&CollectionSpec::new(PREFS_COLLECTION))
.await
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs
index 088fbfba61..f41eec91d9 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs
@@ -92,9 +92,10 @@ async fn import_into(
}
let dir = root.to_owned();
- let (originals, mut skipped) = tokio::task::spawn_blocking(move || read_originals(&dir, now))
- .await
- .context("the legacy reader panicked")??;
+ let (originals, mut skipped) =
+ crate::core::runtime::spawn_blocking_scoped(move || read_originals(&dir, now))
+ .await
+ .context("the legacy reader panicked")??;
let (mut imported, mut expired) = (0usize, 0usize);
for original in originals {
diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
index 46ebceff10..b7c36bf1e3 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
@@ -109,21 +109,22 @@ async fn import_into(
}
// The files are read on a blocking thread, from copies.
- let (legacy_servers, legacy_audit) = tokio::task::spawn_blocking(move || -> Result<_> {
- let servers = if clients.exists() {
- read_servers(&clients)?
- } else {
- Vec::new()
- };
- let audit = if audit.exists() {
- read_audit(&audit)?
- } else {
- Vec::new()
- };
- Ok((servers, audit))
- })
- .await
- .context("the legacy reader panicked")??;
+ let (legacy_servers, legacy_audit) =
+ crate::core::runtime::spawn_blocking_scoped(move || -> Result<_> {
+ let servers = if clients.exists() {
+ read_servers(&clients)?
+ } else {
+ Vec::new()
+ };
+ let audit = if audit.exists() {
+ read_audit(&audit)?
+ } else {
+ Vec::new()
+ };
+ Ok((servers, audit))
+ })
+ .await
+ .context("the legacy reader panicked")??;
for name in [SERVERS, SERVER_NAMES] {
docs.ensure_collection(&CollectionSpec::new(name))
diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
index a615833920..6cbde7552a 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
@@ -66,7 +66,7 @@ async fn import_into(scoped: &ScopedStorage, workspace_dir: &Path) -> Result<Out
if !ledger.is_file() {
return Ok(Outcome::NoSource);
}
- let (records, skipped) = tokio::task::spawn_blocking(move || -> Result<_> {
+ let (records, skipped) = crate::core::runtime::spawn_blocking_scoped(move || -> Result<_> {
let text = std::fs::read_to_string(&ledger)
.with_context(|| format!("read {}", ledger.display()))?;
Ok(support::parse_jsonl(&text))
diff --git a/crates/openhuman-core/src/sandbox/shell_exec.rs b/crates/openhuman-core/src/sandbox/shell_exec.rs
index 88ecbeb95b..226a4e3b98 100644
--- a/crates/openhuman-core/src/sandbox/shell_exec.rs
+++ b/crates/openhuman-core/src/sandbox/shell_exec.rs
@@ -108,7 +108,7 @@ pub(crate) async fn run(config: &Config, run: NativeShellRun) -> anyhow::Result<
timeout_ms = run.timeout.as_millis() as u64,
"[sandbox:shell] starting native shell through TinyBox"
);
- tokio::spawn(async move { run_owned(&config, run).await })
+ crate::core::runtime::spawn_scoped(async move { run_owned(&config, run).await })
.await
.map_err(|_| anyhow::anyhow!("TinyBox shell worker did not finish"))?
}
diff --git a/scripts/ci/saas-ambient-baseline.json b/scripts/ci/saas-ambient-baseline.json
index ea8d3555db..db09000b6e 100644
--- a/scripts/ci/saas-ambient-baseline.json
+++ b/scripts/ci/saas-ambient-baseline.json
@@ -930,13 +930,6 @@
"text": "tokio::spawn(async move {",
"occurrence": 1
},
- {
- "rule": "bare-spawn",
- "path": "crates/openhuman-core/src/sandbox/native_jail.rs",
- "line": 108,
- "text": "tokio::spawn(async move {",
- "occurrence": 2
- },
{
"rule": "ambient-context",
"path": "crates/openhuman-core/src/sandbox/ops.rs",