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
fix(memory): search all memory when a connection's source holds none of its items
M3gA-Mind3b0a701f0af2
diff --git a/crates/openhuman-core/src/memory/sources/composio.rs b/crates/openhuman-core/src/memory/sources/composio.rsindex 1c468b1545..59b11a7b39 100644--- a/crates/openhuman-core/src/memory/sources/composio.rs+++ b/crates/openhuman-core/src/memory/sources/composio.rs@@ -160,9 +160,10 @@ pub fn source_id_for_toolkit(config: &Config, toolkit: &str) -> String {////// With the connection's `toolkit` known, only that toolkit's brain source/// is read (`source:<toolkit>`, where its items are filed): one source,-/// not every scope memory holds. Without it the whole tree is searched, so-/// a connection whose toolkit cannot be resolved still has its items-/// forgotten.+/// not every scope memory holds. Without it, or when that source holds+/// none of the connection's items (they were filed under a root that is no+/// longer configured, such as a removed source's own namespace), the whole+/// tree is searched, so a connection's items are never left behind.pub async fn forget_connection(config: &Config,connection_id: &str,@@ -190,22 +191,35 @@ pub async fn forget_connection(None}};+ let scoped = reach.is_some();tracing::debug!(connection_id = %connection_id,- scoped = reach.is_some(),+ scoped,"[memory:sources] forgetting a connection's items");- let filter = tinymemory_api::MetaFilter {+ let filter = |reach| tinymemory_api::MetaFilter {reach,sources: vec![SourceKind::Composio],tags_any: vec![connection_tag(connection_id)],..tinymemory_api::MetaFilter::default()};- let report = bound+ let mut forgotten = bound.engine- .forget(tinymemory_api::ForgetTarget::Filter(filter))- .await?;- Ok(report.forgotten)+ .forget(tinymemory_api::ForgetTarget::Filter(filter(reach)))+ .await?+ .forgotten;+ if scoped && forgotten == 0 {+ tracing::debug!(+ connection_id = %connection_id,+ "[memory:sources] nothing in the toolkit's source; searching all memory"+ );+ forgotten = bound+ .engine+ .forget(tinymemory_api::ForgetTarget::Filter(filter(None)))+ .await?+ .forgotten;+ }+ Ok(forgotten)}#[cfg(test)]diff --git a/crates/openhuman-core/src/memory/sources/composio_tests.rs b/crates/openhuman-core/src/memory/sources/composio_tests.rsindex f077bed6d0..ca96aa1531 100644--- a/crates/openhuman-core/src/memory/sources/composio_tests.rs+++ b/crates/openhuman-core/src/memory/sources/composio_tests.rs@@ -268,6 +268,28 @@ async fn forget_connection_reads_only_its_toolkits_source() {assert_eq!(left.len(), 1);assert_eq!(left[0].meta.namespace.to_string(), "source:notion");+ // Items filed under a root no longer configured (a removed source's own+ // namespace) are outside the toolkit's source: the scoped forget finds+ // none and falls back to the whole tree.+ let elsewhere = MemoryLayout::new("team:old".parse().unwrap()).unwrap();+ store_records(+ &config,+ &bound,+ "gmail",+ "conn-b",+ "src",+ &elsewhere,+ &[record("b", "b", "from an old root")],+ )+ .await+ .unwrap();+ assert_eq!(+ forget_connection(&config, "conn-b", Some("gmail"))+ .await+ .unwrap(),+ 1+ );+// An unknown toolkit falls back to the whole tree.assert_eq!(forget_connection(&config, "conn-a", None).await.unwrap(), 1);assert!(stored(&engine, MetaFilter::default()).await.is_empty());