Skip to content

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

fix: bound store lock registry growth

Steven Enamakel8f1539e4c25c
diff --git a/src/openhuman/memory/conversations/store/store_locks.rs b/src/openhuman/memory/conversations/store/store_locks.rs
index c938ad6bd6..78d8d79769 100644
--- a/src/openhuman/memory/conversations/store/store_locks.rs
+++ b/src/openhuman/memory/conversations/store/store_locks.rs
@@ -81,6 +81,10 @@ static ROOTS: LazyLock<Mutex<HashMap<PathBuf, Weak<StoreLocks>>>> =
pub(super) fn for_root(root: &Path) -> Arc<StoreLocks> {
let root = normalized_root(root);
let mut roots = ROOTS.lock();
+ // A process may open many ephemeral workspaces over its lifetime. The
+ // weak value avoids retaining each lock set; pruning dead values here also
+ // prevents their path keys from making the registry itself grow forever.
+ roots.retain(|_, locks| locks.strong_count() > 0);
if let Some(existing) = roots.get(&root).and_then(Weak::upgrade) {
return existing;
}
diff --git a/src/openhuman/web_chat/progress_bridge.rs b/src/openhuman/web_chat/progress_bridge.rs
index cb52f2b200..77a7ee5625 100644
--- a/src/openhuman/web_chat/progress_bridge.rs
+++ b/src/openhuman/web_chat/progress_bridge.rs
@@ -342,7 +342,7 @@ pub(crate) fn spawn_progress_bridge(
AgentRunKind, AgentRunStatus, AgentRunUpsert, RunEventAppend, RunTelemetryUpsert,
};
- let bridge = async move {
+ tokio::spawn(async move {
log::debug!(
"[web_channel][bridge] spawned client_id={} thread_id={} request_id={} speak_reply={:?} source={:?} session_id={:?}",
client_id,
@@ -1539,10 +1539,7 @@ pub(crate) fn spawn_progress_bridge(
round,
events_seen,
);
- };
- tokio::spawn(crate::core::runtime::context::CoreContext::propagate(
- bridge,
- ));
+ });
}
#[cfg(test)]