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(storage): route blocking work through the dispatch context
Steven Enamakel5e6c2f5a95ac
diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rsindex 93a4e418c8..ad312454f3 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs@@ -111,21 +111,22 @@ pub(crate) async fn import_legacy(ctx: &DispatchCtx, data_dir: &Path) -> Result<if !clients.exists() && !audit.exists() {return Ok(Outcome::NoSource);}- let (legacy_servers, legacy_audit) = tokio::task::spawn_blocking(move || {- let servers = if clients.exists() {- read_servers(&clients)?- } else {- Vec::new()- };- let audit_rows = if audit.exists() {- read_audit(&audit)?- } else {- Vec::new()- };- Ok::<_, anyhow::Error>((servers, audit_rows))- })- .await- .context("the legacy reader panicked")??;+ let (legacy_servers, legacy_audit) = ctx+ .spawn_blocking(move || {+ let servers = if clients.exists() {+ read_servers(&clients)?+ } else {+ Vec::new()+ };+ let audit_rows = if audit.exists() {+ read_audit(&audit)?+ } else {+ Vec::new()+ };+ Ok::<_, anyhow::Error>((servers, audit_rows))+ })+ .await+ .context("the legacy reader panicked")??;let outcome =import_payload(&scoped, &scope, legacy_servers, legacy_audit, None).await?;super::storage_import_support::mark_imported(&scoped, MARKER_COLLECTION, &marker)@@ -192,21 +193,16 @@ async fn import_into({return Ok(Outcome::AlreadyDone);}- let (legacy_servers, legacy_audit) = tokio::task::spawn_blocking(move || {- let servers = if clients.exists() {- read_servers(&clients)?- } else {- Vec::new()- };- let audit_rows = if audit.exists() {- read_audit(&audit)?- } else {- Vec::new()- };- Ok::<_, anyhow::Error>((servers, audit_rows))- })- .await- .context("the legacy reader panicked")??;+ let legacy_servers = if clients.exists() {+ read_servers(&clients)?+ } else {+ Vec::new()+ };+ let legacy_audit = if audit.exists() {+ read_audit(&audit)?+ } else {+ Vec::new()+ };let result = import_payload(&claimed_scoped,&scope,diff --git a/crates/openhuman-core/src/skills/runtime/run_machinery.rs b/crates/openhuman-core/src/skills/runtime/run_machinery.rsindex 81f5073a99..936335ef78 100644--- a/crates/openhuman-core/src/skills/runtime/run_machinery.rs+++ b/crates/openhuman-core/src/skills/runtime/run_machinery.rs@@ -163,7 +163,8 @@ pub async fn spawn_workflow_run_background(let workspace = workspace.clone();let inherited_origin = inherited_origin.clone();let ctx = ctx.clone();- tokio::spawn(async move {+ let task_ctx = ctx.clone();+ task_ctx.spawn(async move {if let Err(e) = run_log::write_header(&workspace,&log_path,@@ -232,6 +233,8 @@ pub async fn spawn_workflow_run_background());let (tx, rx) = tokio::sync::mpsc::channel(256);agent.set_on_progress(Some(tx));+ // The bridge only drains events into this run's captured log file;+ // it does not read or write tenant state.let bridge = tokio::spawn(run_log::drain_to_log(rx,workspace.clone(),diff --git a/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_db.rs b/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_db.rsindex a466349e15..5b1bd7cf0a 100644--- a/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_db.rs+++ b/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_db.rs@@ -35,6 +35,8 @@ impl LegacyDb {F: FnOnce(&rusqlite::Connection) -> rusqlite::Result<T> + Send + 'static,{let path: PathBuf = self.snapshot.db().to_path_buf();+ // This worker reads only the explicit private snapshot. Tenant-scoped+ // writes happen later through the caller's captured module proxy.tokio::task::spawn_blocking(move || {let connection = rusqlite::Connection::open_with_flags(path,diff --git a/crates/openhuman-core/src/storage/scope_move.rs b/crates/openhuman-core/src/storage/scope_move.rsindex 51a31b30ea..879b21dc30 100644--- a/crates/openhuman-core/src/storage/scope_move.rs+++ b/crates/openhuman-core/src/storage/scope_move.rs@@ -393,6 +393,8 @@ pub async fn run_from_source(use anyhow::Context;let path = source_db.to_owned();+ // Inventory reads only the explicit legacy file; `copy_inventory` uses+ // the supplied backend and `Known` scopes for tenant data.let inventory = tokio::task::spawn_blocking(move || {crate::storage::import::scope_move::LegacyScopeInventory::read(&path)})