Skip to content

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

test(memory): keep legacy brain nodes and aliased toolkits honest end to end

M3gA-Mind14352b6ff773
diff --git a/tests/memory_v2_e2e.rs b/tests/memory_v2_e2e.rs
index cf54e786a9..c5dced4785 100644
--- a/tests/memory_v2_e2e.rs
+++ b/tests/memory_v2_e2e.rs
@@ -1325,6 +1325,65 @@ async fn local_files_and_text_file_under_the_files_source() {
assert_eq!(found["hits"].as_array().unwrap().len(), 1, "{found}");
}
+#[tokio::test]
+async fn legacy_brain_nodes_stay_readable_and_aliased_toolkits_are_one_source() {
+ let f = Fixture::new(true).await;
+
+ // A document at a per-format node from before (`source:pdf`) stays
+ // listed, searchable and forgettable beside `files`, until the
+ // migration re-files it.
+ let legacy = f
+ .ok(
+ "openhuman.memory_brain_ingest",
+ json!({ "text": "The old vendor code is PV-7023", "source": "pdf" }),
+ )
+ .await;
+ assert_eq!(legacy["source"], json!("pdf"), "{legacy}");
+ f.ok(
+ "openhuman.memory_brain_ingest",
+ json!({ "text": "The new vendor code is PV-9000" }),
+ )
+ .await;
+ let sources = f.ok("openhuman.memory_brain_sources", json!({})).await;
+ let mut listed: Vec<String> = sources["sources"]
+ .as_array()
+ .expect("sources")
+ .iter()
+ .map(|s| s["source"].as_str().unwrap_or_default().to_string())
+ .collect();
+ listed.sort();
+ assert_eq!(listed, ["files", "pdf"], "{sources}");
+ let found = f
+ .ok(
+ "openhuman.memory_brain_search",
+ json!({ "query": "vendor code", "source": "pdf" }),
+ )
+ .await;
+ assert_eq!(found["hits"].as_array().unwrap().len(), 1, "{found}");
+ let gone = f
+ .ok("openhuman.memory_brain_forget", json!({ "source": "pdf" }))
+ .await;
+ assert_eq!(gone["forgotten"], json!(1), "{gone}");
+
+ // A toolkit added under an alias is stored under the slug Composio uses,
+ // and adding it again under that slug is a duplicate.
+ let drive = f
+ .ok(
+ "openhuman.memory_sources_add",
+ json!({ "kind": "composio", "target": "Google_Drive" }),
+ )
+ .await;
+ assert_eq!(drive["source"]["target"], json!("googledrive"), "{drive}");
+ assert_eq!(
+ f.code(
+ "openhuman.memory_sources_add",
+ json!({ "kind": "composio", "target": "googledrive" })
+ )
+ .await,
+ "INVALID_REQUEST"
+ );
+}
+
#[tokio::test]
async fn brain_pack_preview_and_jobs_round_trip() {
let f = Fixture::new(true).await;