Skip to content

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

feat(session_host): ingest memory from runtime sessions

Steven Enamakel31d645757814
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index f98a81a27f..fffff877b9 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -861,6 +861,8 @@ impl OpenHumanSessionHost {
.unwrap_or_else(|poisoned| poisoned.into_inner())
.take_turn_inputs();
let origin = options.run_context.data.origin.clone();
+ let memory_identity =
+ options.run_context.data.memory_identity.clone();
let (enriched, memory_turn) = futures::join!(
prelude.enrich_request(
&original_user_message,
@@ -875,6 +877,7 @@ impl OpenHumanSessionHost {
view.committed_turns,
view.history.last().filter(|last| **last == request.input),
origin,
+ memory_identity,
)),
);
options.run_context.data.memory_turn = memory_turn;
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 77cd2d08d0..ea96110b08 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
@@ -88,8 +88,8 @@ impl OpenHumanTurnPrelude {
/// Takes completed memory and queues a user-authored turn's log and recall.
/// Remembers the turn so the reply is logged under the same identity and
/// index, and returns its memory for the run context without engine I/O.
- /// `origin` is the turn's origin as the run context carries it (the
- /// session host never reads the task-local one); a channel turn is
+ /// `origin` and `memory_identity` are the turn's, as the run context
+ /// carries them (nothing is read from the running task); a channel turn is
/// logged as observed from its sender
/// ([`crate::memory::lifecycle::sender::channel_actor`]).
pub(super) async fn memory_pre_turn(
@@ -98,6 +98,7 @@ impl OpenHumanTurnPrelude {
committed_turns: usize,
current: Option<&Message>,
origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,
+ memory_identity: Option<crate::memory::scope::MemoryIdentity>,
) -> Option<Arc<MemoryTurn>> {
let user_text = self
.mutable
@@ -107,7 +108,7 @@ impl OpenHumanTurnPrelude {
.clone()?;
let thread_id = self.thread_id.clone()?;
let config = self.memory_config().await?;
- let mut identity = crate::memory::scope::resolve_current(&config);
+ let mut identity = memory_identity.unwrap_or_default().resolve(&config);
if self.omit_memory_context {
identity.recall = false;
}