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(session_store): give each tenant router a unique destination key
Steven Enamakelbd4aecfd9dc7
diff --git a/crates/openhuman-core/src/agent/session_store/tenant_router.rs b/crates/openhuman-core/src/agent/session_store/tenant_router.rsindex b9caf83f95..3906fef9c5 100644--- a/crates/openhuman-core/src/agent/session_store/tenant_router.rs+++ b/crates/openhuman-core/src/agent/session_store/tenant_router.rs@@ -24,6 +24,8 @@ pub struct TenantSessionStores {recover_on_open: bool,admission: SchemaAdmission,tenants: Mutex<HashMap<Scope, Arc<DriverSessionStores>>>,+ /// Names this router in [`SessionStoreProvider::destination_key`].+ id: uuid::Uuid,}impl std::fmt::Debug for TenantSessionStores {@@ -58,6 +60,7 @@ impl TenantSessionStores {recover_on_open,admission,tenants: Mutex::new(HashMap::new()),+ id: uuid::Uuid::new_v4(),}}@@ -175,7 +178,7 @@ impl SessionStoreProvider for TenantSessionStores {}fn destination_key(&self) -> Option<String> {- Some(format!("{}://tenants", self.backend.driver()))+ Some(format!("{}://{}", self.backend.driver(), self.id))}}diff --git a/crates/openhuman-core/src/modules/storage_host_tests.rs b/crates/openhuman-core/src/modules/storage_host_tests.rsindex b4bcc5eada..477cc2306a 100644--- a/crates/openhuman-core/src/modules/storage_host_tests.rs+++ b/crates/openhuman-core/src/modules/storage_host_tests.rs@@ -678,7 +678,7 @@ async fn every_call_is_audited_without_its_payload() {trail[0],AuditRecord {module: "alpha".into(),- scope: "module:alpha@local".into(),+ scope: "local/module:alpha".into(),object: "Documents",op: "Put".into(),target: "notes".into(),diff --git a/crates/openhuman-core/src/profiles/fence_tests.rs b/crates/openhuman-core/src/profiles/fence_tests.rsindex 0e86289af5..7953c924b6 100644--- a/crates/openhuman-core/src/profiles/fence_tests.rs+++ b/crates/openhuman-core/src/profiles/fence_tests.rs@@ -69,7 +69,19 @@ fn a_profiles_fence_covers_its_scope_and_its_sessions() {profile: Some("alice".into()),agent: None,};- assert!(covers(&crate::core::runtime::session_key(&tenant)));+ let _ = tenant;+ assert!(covers(+ crate::storage::scope_for_profile("alice")+ .agent("default")+ .unwrap()+ .as_str()+ ));+ assert!(covers(+ crate::storage::scope_for_profile("alice")+ .module("tinymcp")+ .unwrap()+ .as_str()+ ));assert!(!covers(crate::storage::scope_for_profile("alice2").as_str()));@@ -83,8 +95,8 @@ async fn a_takeover_fences_the_old_holders_writes_before_its_heartbeat_runs() {let alice = profile("alice");a.provision(&alice).await.unwrap();let state = a.open(&alice).await.unwrap();- write(&a_storage, "profile:alice").await.unwrap();- write(&a_storage, "alice~default").await.unwrap();+ write(&a_storage, "u:alice").await.unwrap();+ write(&a_storage, "u:alice/agent:default").await.unwrap();// Another node takes the profile over (by its clock the lease ran out).let thief = DocumentLeases::cluster(@@ -100,7 +112,7 @@ async fn a_takeover_fences_the_old_holders_writes_before_its_heartbeat_runs() {.unwrap();// Node A's next write is refused at once, and the profile is latched.- let refused = write(&a_storage, "alice~default").await.unwrap_err();+ let refused = write(&a_storage, "u:alice/agent:default").await.unwrap_err();assert!(matches!(fence_error(&refused),Some(FenceError::Superseded { .. })@@ -114,10 +126,10 @@ async fn a_takeover_fences_the_old_holders_writes_before_its_heartbeat_runs() {// writes) while the profile's state is still held.let report = renew_once(&a).await;assert_eq!(report.fenced, vec![alice.clone()]);- assert!(write(&a_storage, "profile:alice").await.is_err());+ assert!(write(&a_storage, "u:alice").await.is_err());drop(state);// Nothing holds the fenced context any more: the tombstone is pruned.- write(&a_storage, "profile:alice").await.unwrap();+ write(&a_storage, "u:alice").await.unwrap();}#[tokio::test]@@ -128,15 +140,15 @@ async fn a_clean_release_retires_the_fence_and_a_reopen_registers_a_new_one() {let alice = profile("alice");a.provision(&alice).await.unwrap();let first = a.open(&alice).await.unwrap().lease_fence().epoch();- assert_eq!(a.fences().lookup("profile:alice").unwrap().epoch(), first);+ assert_eq!(a.fences().lookup("u:alice").unwrap().epoch(), first);assert!(a.release(&alice).await.unwrap());- assert!(a.fences().lookup("profile:alice").is_none());+ assert!(a.fences().lookup("u:alice").is_none());let second = a.open(&alice).await.unwrap();assert!(second.lease_fence().epoch() > first);assert!(Arc::ptr_eq(- &a.fences().lookup("alice~default").unwrap(),+ &a.fences().lookup("u:alice/agent:default").unwrap(),second.lease_fence()));