Skip to content

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

test(sessions): cover pinned lease routing by profile and agent

Steven Enamakelf1a06a24b1f8
diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
index 08e23d9804..03332d31bb 100644
--- a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
+++ b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
@@ -56,3 +56,28 @@ fn one_provider_serves_every_agent_of_a_tenant() {
let (other, _) = router.route("u~two");
assert!(!Arc::ptr_eq(&first, &other));
}
+
+#[test]
+fn pinned_session_store_leases_keep_profile_and_agent_routing() {
+ let router = stores();
+ let alice_key = crate::core::runtime::session_key(&crate::core::runtime::Tenant {
+ profile: Some("alice".into()),
+ agent: Some("asha".into()),
+ });
+ let bob_key = crate::core::runtime::session_key(&crate::core::runtime::Tenant {
+ profile: Some("bob".into()),
+ agent: Some("asha".into()),
+ });
+ let alice = router.lease_for_agent(&alice_key).unwrap();
+ let alice_again = router.lease_for_agent(&alice_key).unwrap();
+ let bob = router.lease_for_agent(&bob_key).unwrap();
+
+ assert_eq!(
+ alice.stores().transcripts.destination_key(),
+ alice_again.stores().transcripts.destination_key()
+ );
+ assert_ne!(
+ alice.stores().transcripts.destination_key(),
+ bob.stores().transcripts.destination_key()
+ );
+}