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
chore: files changed crates/openhuman-core/src/flows/memory_tools_tests.rs,crates/openhuman-core/src
Steven Enamakel9496be836e20
diff --git a/crates/openhuman-core/src/flows/memory_tools_tests.rs b/crates/openhuman-core/src/flows/memory_tools_tests.rsindex 6d92101c9d..06492863ae 100644--- a/crates/openhuman-core/src/flows/memory_tools_tests.rs+++ b/crates/openhuman-core/src/flows/memory_tools_tests.rs@@ -1,5 +1,6 @@use super::*;use crate::memory::types::ItemsListParams;+use crate::memory::test_fixtures::RecordingEngine;use tempfile::TempDir;use tinymemory_api::conformance::ReferenceEngine;@@ -96,6 +97,29 @@ async fn remember_keyed_replaces_the_previous_value() {);}+#[tokio::test]+async fn failed_replacement_keeps_the_previous_value() {+ let tmp = TempDir::new().unwrap();+ let mut config = Config::default();+ config.workspace_dir = tmp.path().to_path_buf();+ let engine = Arc::new(RecordingEngine::new());+ RecordingEngine::bind(&engine, &config);+ let old_id = remember_keyed(&config, "f1", "k", "first", LearningKind::Fact)+ .await+ .unwrap();++ engine.fail_next_store();+ let error = remember_keyed(&config, "f1", "k", "second", LearningKind::Fact)+ .await+ .unwrap_err();++ assert!(error.to_string().contains("injected store failure"));+ let items = list(&config, flow_filter("f1")).await;+ assert_eq!(items.len(), 1);+ assert_eq!(items[0].id.0, old_id);+ assert!(items[0].text.contains("first"));+}+#[tokio::test]async fn flow_filters_isolate_flows_and_cross_flow_sees_all() {let (_tmp, config) = engine_config();diff --git a/crates/openhuman-core/src/memory/test_fixtures.rs b/crates/openhuman-core/src/memory/test_fixtures.rsindex 6f3ccbdc4e..6a910794e4 100644--- a/crates/openhuman-core/src/memory/test_fixtures.rs+++ b/crates/openhuman-core/src/memory/test_fixtures.rs@@ -141,6 +141,7 @@ pub(crate) struct RecordingEngine {/// `"erase"` / `"forget"`, in call order.pub(crate) calls: std::sync::Mutex<Vec<&'static str>>,erase_unsupported: bool,+ fail_next_store: std::sync::atomic::AtomicBool,}impl RecordingEngine {@@ -150,6 +151,7 @@ impl RecordingEngine {inner: ReferenceEngine::new(),calls: std::sync::Mutex::new(Vec::new()),erase_unsupported: false,+ fail_next_store: std::sync::atomic::AtomicBool::new(false),}}@@ -170,6 +172,12 @@ impl RecordingEngine {pub(crate) fn calls(&self) -> Vec<&'static str> {self.calls.lock().unwrap().clone()}++ /// Makes the next store fail, then resumes normal behavior.+ pub(crate) fn fail_next_store(&self) {+ self.fail_next_store+ .store(true, std::sync::atomic::Ordering::SeqCst);+ }}#[async_trait::async_trait]@@ -200,6 +208,14 @@ impl MemoryEngine for RecordingEngine {&self,item: tinymemory_api::StoreItem,) -> tinymemory_api::Result<tinymemory_api::StoreReceipt> {+ if self+ .fail_next_store+ .swap(false, std::sync::atomic::Ordering::SeqCst)+ {+ return Err(tinymemory_api::Error::Engine(+ "injected store failure".into(),+ ));+ }self.inner.store(item).await}