Skip to content

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

test(agent_runs): cover tenant isolation in report cache keys

Steven Enamakel0931429333de
diff --git a/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs b/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs
index db475caf72..ba1adfb5c8 100644
--- a/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs
+++ b/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs
@@ -84,6 +84,25 @@ fn config_fingerprint_is_stable_for_identical_config() {
assert_eq!(config_fingerprint(&a), config_fingerprint(&b));
}
+#[test]
+fn report_cache_key_isolated_by_tenant_even_for_identical_config() {
+ let config = Config::default();
+ let alice = crate::core::runtime::Tenant {
+ profile: Some("alice".into()),
+ agent: None,
+ };
+ let bob = crate::core::runtime::Tenant {
+ profile: Some("bob".into()),
+ agent: None,
+ };
+
+ assert_eq!(config_fingerprint(&config), config_fingerprint(&config));
+ assert_ne!(
+ report_cache_key(alice, "orchestrator", &config),
+ report_cache_key(bob, "orchestrator", &config),
+ );
+}
+
#[tokio::test]
async fn history_section_is_none_for_an_unknown_thread() {
// No transcripts exist for this id, so `token_usage` should report