Skip to content

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

chore(storage): log backtrace when backend clone count is high

Steven Enamakel4793844e6daa
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index b337a4d2f6..b6f6d50c25 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -209,7 +209,16 @@ pub fn backend_for(workspace_dir: &Path) -> Result<Arc<dyn StorageBackend>> {
let cell = workspace_backend(workspace_dir);
if let Some(backend) = cell.get() {
- return Ok(Arc::clone(backend));
+ let backend = Arc::clone(backend);
+ if Arc::strong_count(&backend) >= 5 {
+ eprintln!(
+ "workspace backend clone reached {} refs at {}\n{}",
+ Arc::strong_count(&backend),
+ workspace_dir.display(),
+ std::backtrace::Backtrace::force_capture()
+ );
+ }
+ return Ok(backend);
}
let workspace_dir = workspace_dir.to_path_buf();
super::block_on_anyhow(async move { initialized_backend(cell, workspace_dir).await })