Skip to content

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

test(session-host): cover deferred memory with a missing profile owner

Steven Enamakelb9f5e9856f86
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rs
index c3216d9f09..2369d97604 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rs
@@ -144,3 +144,26 @@ async fn deferred_memory_commit_survives_the_turn_scope_without_pinning_the_prof
})
.await;
}
+
+#[tokio::test]
+async fn missing_profile_owner_refuses_deferred_memory_instead_of_running_unscoped() {
+ use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet, SaasConfig};
+ use crate::profiles::ProfileHost;
+ use crate::tools::toolpacks::ToolGroups;
+ let root = tempfile::tempdir().unwrap();
+ let operator = CoreContext::for_test(DomainSet::full(), None);
+ let host = ProfileHost::new(SaasConfig::new(root.path()), operator.clone());
+ let missing = operator.derive_with(
+ ContextOverlay::new(
+ crate::config::Config::default(),
+ DomainSet::full(),
+ ToolGroups::none(),
+ )
+ .profile("missing-owner"),
+ );
+ let captured = CoreContext::scope(missing, async { capture_profile_context(&host) }).await;
+ deferred_memory_work(captured, async {
+ panic!("a failed profile owner capture must not run under the configured external engine")
+ })
+ .await;
+}
diff --git a/crates/openhuman-embed/tests/profile_host_capabilities.rs b/crates/openhuman-embed/tests/profile_host_capabilities.rs
index cfe31b8656..d5f221a0d2 100644
--- a/crates/openhuman-embed/tests/profile_host_capabilities.rs
+++ b/crates/openhuman-embed/tests/profile_host_capabilities.rs
@@ -120,7 +120,7 @@ impl Respond for CallTools {
} else {
"bob"
};
- let channel = if message.contains("[Channel context]") {
+ let channel = if message.contains("\"telegram\" channel") {
"relay"
} else {
"chat"
@@ -570,7 +570,7 @@ async fn scenario() {
let response: Value = tokio::time::timeout(Duration::from_secs(30), async {
loop {
let response: Value = handle
- .call("openhuman.memory_items_list", json!({}))
+ .call("openhuman.memory_items_list", json!({"limit":100}))
.await
.unwrap();
if response
@@ -582,6 +582,9 @@ async fn scenario() {
&& response
.to_string()
.contains(&format!("done: relay:{}", handle.id()))
+ && (handle.id().as_str() != "alice"
+ || (response.to_string().contains("done: reopened-chat:alice")
+ && response.to_string().contains("done: reopened-relay:alice")))
{
break response;
}