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): record a disconnect even with memory off; cover the skipped pass
M3gA-Mind3bedaab90467
diff --git a/crates/openhuman-core/src/memory/sources/composio.rs b/crates/openhuman-core/src/memory/sources/composio.rsindex e5fb374538..19b08e9442 100644--- a/crates/openhuman-core/src/memory/sources/composio.rs+++ b/crates/openhuman-core/src/memory/sources/composio.rs@@ -119,7 +119,6 @@ pub async fn store_records(if is_disconnected(config, connection_id) {tracing::debug!(connection_id = %connection_id,- records = records.len(),"[memory:sources] dropping records read before their connection was deleted");return Ok(0);@@ -282,16 +281,17 @@ pub async fn forget_connection(connection_id: &str,toolkit: Option<&str>,) -> MemoryResult<usize> {+ // A sync pass storing this connection's records finishes first, so none+ // of its items lands after the forget; any pass after it, even one that+ // read its records before, stores nothing (`DISCONNECTED`). Marked even+ // with memory off, so nothing is stored if memory comes back on.+ let _serial = STORE.lock().await;+ disconnected().insert((config.workspace_dir.clone(), connection_id.to_string()));let bound = match crate::memory::engine::resolve(config).engine() {Ok(bound) => bound,Err(MemoryError::Off(_)) => return Ok(0),Err(error) => return Err(error),};- // A sync pass storing this connection's records finishes first, so none- // of its items lands after the forget; any pass after it, even one that- // read its records before, stores nothing (`DISCONNECTED`).- let _serial = STORE.lock().await;- disconnected().insert((config.workspace_dir.clone(), connection_id.to_string()));let recorded = super::roots::of(&config.workspace_dir, connection_id);let reaches = match toolkit {// An unreadable roots record cannot bound the search: search all.diff --git a/crates/openhuman-core/src/memory/sources/composio_tests.rs b/crates/openhuman-core/src/memory/sources/composio_tests.rsindex accead4163..6a71fab6ed 100644--- a/crates/openhuman-core/src/memory/sources/composio_tests.rs+++ b/crates/openhuman-core/src/memory/sources/composio_tests.rs@@ -354,6 +354,10 @@ async fn forget_connection_with_memory_off_forgets_nothing() {.unwrap(),0);+ assert!(+ is_disconnected(&config, "conn-a"),+ "the deletion is recorded even with memory off"+ );}#[tokio::test]@@ -475,3 +479,31 @@ async fn records_read_before_a_disconnect_are_not_stored_after_it() {// Another connection, or the same id in another workspace, is unaffected.assert!(!is_disconnected(&config, "conn-other"));}++#[tokio::test]+async fn a_deleted_connection_is_not_read_again() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ bind_reference(&config);+ let bound = crate::memory::engine::resolve(&config).engine().unwrap();+ forget_connection(&config, "conn-x", Some("gmail"))+ .await+ .unwrap();+ // No connector call is made: an empty pass with nothing pending ends+ // the caller's loop.+ let pass = run_sync_pass(+ &config,+ &bound,+ "gmail",+ "conn-x",+ "src",+ "manual",+ SYNC_PASS_MAX_ITEMS,+ )+ .await+ .unwrap();+ assert_eq!(pass.records_read, 0);+ assert_eq!(pass.written, 0);+ assert!(!pass.more_pending);+ assert!(pass.failure.is_none());+}