Skip to content

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

feat(memory): ingest session transcripts into memory

Steven Enamakelab2bbf090690
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs
index a1fb78759f..ba5dbbad92 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs
@@ -128,7 +128,7 @@ impl OpenHumanTurnPrelude {
if self.omit_memory_context {
identity.recall = false;
}
- let profile_context = capture_profile_context(crate::profiles::host::host().as_deref());
+ let profile_context = capture_profile_context(&self.dispatch_ctx(), crate::profiles::host::host().as_deref());
if matches!(profile_context, ProfileMemoryContext::Denied) {
return None;
}
@@ -237,8 +237,11 @@ impl OpenHumanTurnPrelude {
// Resolve the profile owner at preparation; a canonical commit may run after
// the immutable turn-origin scope has ended.
-fn capture_profile_context(host: Option<&crate::profiles::ProfileHost>) -> ProfileMemoryContext {
- let Some(context) = crate::core::runtime::CoreContext::scoped() else {
+fn capture_profile_context(
+ ctx: &DispatchCtx,
+ host: Option<&crate::profiles::ProfileHost>,
+) -> ProfileMemoryContext {
+ let Some(context) = ctx.core().cloned() else {
return if crate::core::runtime::is_saas() {
ProfileMemoryContext::Denied
} else {
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 29ee52c29b..bb4a15aa52 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
@@ -90,10 +90,7 @@ async fn deferred_memory_commit_survives_the_turn_scope_without_pinning_the_prof
let id = ProfileId::parse("deferred-memory").unwrap();
host.provision(&id).await.unwrap();
let profile = host.open(&id).await.unwrap();
- let captured = CoreContext::scope_with_turn_origin(profile.context().clone(), None, async {
- capture_profile_context(Some(&host))
- })
- .await;
+ let captured = capture_profile_context(&DispatchCtx::new(profile.context().clone()), Some(&host));
// The entire temporary turn context is gone before this callback is polled.
let config = profile.config.clone();
let work = async {
@@ -161,8 +158,7 @@ async fn missing_profile_owner_refuses_deferred_memory_instead_of_running_unscop
)
.profile("missing-owner"),
);
- let captured =
- CoreContext::scope(missing, async { capture_profile_context(Some(&host)) }).await;
+ let captured = capture_profile_context(&DispatchCtx::new(missing), Some(&host));
deferred_memory_work(captured, async {
panic!("a failed profile owner capture must not run under the configured external engine")
})
@@ -183,14 +179,14 @@ async fn failed_profile_capture_is_denied_but_ordinary_desktop_work_still_runs()
)
.profile(id),
);
- let captured = CoreContext::scope(profile, async { capture_profile_context(None) }).await;
+ let captured = capture_profile_context(&DispatchCtx::new(profile), None);
assert!(matches!(captured, ProfileMemoryContext::Denied));
deferred_memory_work(captured, async {
panic!("a profile without its host cannot resolve an external engine")
})
.await;
}
- let captured = CoreContext::scope(operator, async { capture_profile_context(None) }).await;
+ let captured = capture_profile_context(&DispatchCtx::new(operator), None);
assert!(matches!(captured, ProfileMemoryContext::NonProfile));
let mut ran = false;
deferred_memory_work(captured, async {