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
perf(storage): return cached workspace backend without bridging
Steven Enamakel9a7f894272a7
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rsindex fb8cb24c01..b337a4d2f6 100644--- a/crates/openhuman-core/src/storage/local.rs+++ b/crates/openhuman-core/src/storage/local.rs@@ -208,25 +208,32 @@ pub fn backend_for(workspace_dir: &Path) -> Result<Arc<dyn StorageBackend>> {signal_test_sync_backend_entry();let cell = workspace_backend(workspace_dir);+ if let Some(backend) = cell.get() {+ return Ok(Arc::clone(backend));+ }let workspace_dir = workspace_dir.to_path_buf();super::block_on_anyhow(async move { initialized_backend(cell, workspace_dir).await })}/// Async counterpart to [`backend_for`] for boot and module-proxy paths that-/// already run inside a future. Cold initialization is delegated to Tokio's-/// blocking pool so the shared OnceCell initializer is driven by the storage-/// bridge rather than by the caller's runtime. When already on the bridge's-/// runtime, initialize directly: queueing a synchronous bridge call from a-/// bridge worker would wait on itself. A synchronous store may wait for the-/// same initializer, including from a current-thread runtime, without+/// already run inside a future. A cached workspace backend is returned without+/// crossing the synchronous bridge. Cold initialization is delegated to+/// Tokio's blocking pool so the shared OnceCell initializer is driven by the+/// storage bridge rather than by the caller's runtime. When already on the+/// bridge's runtime, initialize directly: queueing a synchronous bridge call+/// from a bridge worker would wait on itself. A synchronous store may wait for+/// the same initializer, including from a current-thread runtime, without/// preventing it from making progress.pub async fn backend_for_async(workspace_dir: &Path) -> Result<Arc<dyn StorageBackend>> {if let Some(backend) = installed() {return Ok(backend);}+ let cell = workspace_backend(workspace_dir);+ if let Some(backend) = cell.get() {+ return Ok(Arc::clone(backend));+ }let workspace_dir = workspace_dir.to_path_buf();if super::ON_STORAGE_RUNTIME.with(std::cell::Cell::get) {- let cell = workspace_backend(&workspace_dir);return initialized_backend(cell, workspace_dir).await;}tokio::task::spawn_blocking(move || backend_for(&workspace_dir))