Skip to content

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

fix(storage): log backend clone warning only at exactly five refs

Steven Enamakela0c1f7b868a5
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index b6f6d50c25..d3f141b211 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -210,12 +210,14 @@ pub fn backend_for(workspace_dir: &Path) -> Result<Arc<dyn StorageBackend>> {
let cell = workspace_backend(workspace_dir);
if let Some(backend) = cell.get() {
let backend = Arc::clone(backend);
- if Arc::strong_count(&backend) >= 5 {
+ if Arc::strong_count(&backend) == 5 {
+ let trace = format!("{:?}", std::backtrace::Backtrace::force_capture());
+ let trace = trace.lines().take(12).collect::<Vec<_>>().join("\n");
eprintln!(
"workspace backend clone reached {} refs at {}\n{}",
Arc::strong_count(&backend),
workspace_dir.display(),
- std::backtrace::Backtrace::force_capture()
+ trace
);
}
return Ok(backend);