Skip to content

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

chore: merge upstream main, pin tinymemory v1.24.0; isolate engine-cache tests

Steven Enamakel2fea0d97f903
diff --cc crates/openhuman-core/src/memory/engine.rs
index f2eb1a54ef,716c082b0b..186c3307e8
--- a/crates/openhuman-core/src/memory/engine.rs
+++ b/crates/openhuman-core/src/memory/engine.rs
@@@ -487,8 -477,8 +487,18 @@@ fn key_digest(key: &str) -> String
.collect()
}
++/// Held for writing by a test that compares cached engines by identity, and
++/// for reading by [`invalidate`], so another test's invalidation (a layout
++/// switch, a key change) cannot clear the cache between its two binds.
++#[cfg(test)]
++pub(crate) static CACHE_STABLE: RwLock<()> = RwLock::new(());
++
/// Drops every cached engine, so the next [`resolve`] rebuilds.
pub fn invalidate() {
++ #[cfg(test)]
++ let _stable = CACHE_STABLE
++ .read()
++ .unwrap_or_else(std::sync::PoisonError::into_inner);
CACHE
.write()
.unwrap_or_else(std::sync::PoisonError::into_inner)
diff --cc crates/openhuman-core/src/memory/engine_tests.rs
index 0509ced2d4,0509ced2d4..8a7a872898
--- a/crates/openhuman-core/src/memory/engine_tests.rs
+++ b/crates/openhuman-core/src/memory/engine_tests.rs
@@@ -68,6 -68,6 +68,9 @@@ fn tinyhumans_with_a_local_session_toke
#[test]
fn tinyhumans_with_the_host_credential_binds_and_caches() {
++ let _stable = CACHE_STABLE
++ .write()
++ .unwrap_or_else(std::sync::PoisonError::into_inner);
let tmp = tempfile::tempdir().unwrap();
let mut config = config_in(&tmp);
config
@@@ -135,6 -135,6 +138,9 @@@ fn cortexdb_is_off_until_a_key_is_store
#[test]
fn switching_observed_actor_rebuilds_the_cortexdb_engine() {
++ let _stable = CACHE_STABLE
++ .write()
++ .unwrap_or_else(std::sync::PoisonError::into_inner);
let tmp = tempfile::tempdir().unwrap();
let mut config = config_in(&tmp);
config.memory.engine = CORTEXDB_ENGINE.to_string();
@@@ -231,7 -231,7 +237,12 @@@ fn user_config(tmp: &tempfile::TempDir
#[test]
fn layout_v3_binds_its_own_engine_beside_legacy() {
++ let _stable = CACHE_STABLE
++ .write()
++ .unwrap_or_else(std::sync::PoisonError::into_inner);
let tmp = tempfile::tempdir().unwrap();
++ // A user id of its own: the credential store is shared by id, so another
++ // test storing a key for the same id would change the fingerprint.
let mut config = user_config(&tmp, "6512ab0f6512ab0f6512ab0f");
config.memory.engine = CORTEXDB_ENGINE.to_string();
store_cortexdb_key(&config, "cdb-key-layout").unwrap();
@@@ -305,7 -305,7 +316,7 @@@ fn a_root_sets_the_scope_root_its_owner
#[tokio::test]
async fn switching_to_v3_persists_and_rebinds_the_persons_own_config() {
let tmp = tempfile::tempdir().unwrap();
-- let mut config = user_config(&tmp, "6512ab0f6512ab0f6512ab0f");
++ let mut config = user_config(&tmp, "6512ab0f6512ab0f6512ab10");
config.memory.engine = CORTEXDB_ENGINE.to_string();
config.save().await.unwrap();
store_cortexdb_key(&config, "cdb-key-switch").unwrap();
diff --cc crates/openhuman-core/src/memory/mod.rs
index fe83517d5c,d1648e8af8..dd6f781e24
--- a/crates/openhuman-core/src/memory/mod.rs
+++ b/crates/openhuman-core/src/memory/mod.rs
@@@ -24,8 -24,8 +24,9 @@@ pub mod billing
pub mod brain;
pub mod bus;
pub mod channels;
+ pub mod confine;
pub(crate) mod convert;
+pub mod deletion;
pub mod engine;
pub mod error;
pub mod explore;