Skip to content

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

fix(storage): avoid deadlock when opening backend on storage runtime

Steven Enamakelce600cc9460d
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index 8a09f63472..6a57d990da 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -223,6 +223,15 @@ pub async fn backend_for_async(workspace_dir: &Path) -> Result<Arc<dyn StorageBa
return Ok(backend);
}
let workspace_dir = workspace_dir.to_path_buf();
+ if super::ON_STORAGE_RUNTIME.with(std::cell::Cell::get) {
+ // A sync store may bridge into an async module operation that needs
+ // the same workspace fallback. Initializing through `backend_for`
+ // here would queue a second synchronous bridge request while this
+ // bridge worker is waiting for it. The existing initializer is async
+ // and safe to drive directly from this runtime.
+ let cell = workspace_backend(&workspace_dir);
+ return initialized_backend(cell, workspace_dir).await;
+ }
tokio::task::spawn_blocking(move || backend_for(&workspace_dir))
.await
.context("join the workspace storage opener")?