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
test(memory): e2e the agent learn returning on accept
M3gA-Mind11504efff69f
diff --git a/tests/memory_v2_e2e.rs b/tests/memory_v2_e2e.rsindex 8b1008f45a..81039d5db8 100644--- a/tests/memory_v2_e2e.rs+++ b/tests/memory_v2_e2e.rs@@ -836,6 +836,86 @@ async fn learn_list_fetch_recall_and_forget_round_trip() {assert_eq!(none["forgotten"], json!(0));}+/// The `/memory/*` requests the mock logged after the first `skip`, as+/// `METHOD path` lines.+async fn memory_requests_since(f: &Fixture, skip: usize) -> Vec<String> {+ f.mock+ .request_rows()+ .await+ .into_iter()+ .skip(skip)+ .filter_map(|row| {+ let url = row["url"].as_str()?.to_string();+ url.starts_with("/memory/").then(|| {+ let method = row["method"].as_str().unwrap_or("?");+ format!("{method} {}", url.split('?').next().unwrap_or(&url))+ })+ })+ .collect()+}++#[tokio::test]+async fn the_agent_learn_returns_on_accept_and_recall_finds_it() {+ let f = Fixture::new(true).await;+ let config = openhuman_core::config::load_config_with_timeout()+ .await+ .expect("the signed-in config");+ let facts = openhuman_core::memory::tools::CallFacts::of(+ &config,+ &openhuman_core::memory::scope::MemoryIdentity::agent("orchestrator"),+ );++ // Control: `memory_learn` over RPC returns once the write is readable, so+ // the hosted engine reads the store back after its write.+ let before = f.mock.request_rows().await.len();+ f.learn("Carol keeps her standup notes in a paper notebook")+ .await;+ let rpc_calls = memory_requests_since(&f, before).await;+ assert!(+ rpc_calls+ .last()+ .is_some_and(|last| !last.starts_with("POST /memory/experience")),+ "the RPC learn must read its write back before returning: {rpc_calls:?}"+ );++ // The agent's tool returns on accept: its write is the last memory call+ // the turn waits on, and the model is told recall may lag.+ let before = f.mock.request_rows().await.len();+ let learned = openhuman_core::memory::tools::run_action(+ &config,+ &json!({"action": "learn", "text": "Dave takes his coffee with oat milk"}),+ &facts,+ )+ .await;+ assert!(!learned.is_error, "{}", learned.text());+ let tool_calls = memory_requests_since(&f, before).await;+ assert!(+ tool_calls+ .last()+ .is_some_and(|last| last.starts_with("POST /memory/experience")),+ "the agent learn must return right after its write, with no visibility reads: {tool_calls:?}"+ );+ let view: Value = serde_json::from_str(&learned.text()).expect("learn result json");+ let id = view["id"].as_str().expect("learn keeps the receipt id");+ assert_eq!(view["status"], json!("saved; searchable in recall shortly"));++ // Shortly after, the learning is readable like any other.+ let deadline = Instant::now() + Duration::from_secs(30);+ loop {+ let listed = f+ .ok(+ "openhuman.memory_items_list",+ json!({ "filter": { "kinds": ["learning"] } }),+ )+ .await;+ if ids_of(&listed, "items").iter().any(|known| known == id) {+ break;+ }+ assert!(Instant::now() < deadline, "never listed: {listed}");+ tokio::time::sleep(Duration::from_millis(250)).await;+ }+}+#[tokio::test]async fn memory_is_isolated_per_account() {let f = Fixture::new(true).await;