Skip to content

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

feat(memory): prefetch memory context before thread edits

Steven Enamakelc7ed2c527693
diff --git a/crates/openhuman-core/src/memory/lifecycle/prefetch.rs b/crates/openhuman-core/src/memory/lifecycle/prefetch.rs
index 568fb64f95..cb515b57e6 100644
--- a/crates/openhuman-core/src/memory/lifecycle/prefetch.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/prefetch.rs
@@ -171,7 +171,7 @@ pub(crate) fn pre_turn(
if let Some(channel) = channel {
let workspace = config.workspace_dir.clone();
let thread = input.thread_id.clone();
- let _ = crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {
+ let _ = dispatch.spawn_blocking(move || {
crate::memory::channels::record(&workspace, &channel, &thread)
})
.await;
diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rs
index 82b532d549..de73401d60 100644
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@ -391,7 +391,7 @@ impl Tool for MemoryTool {
let config = self.config.clone();
let write_args = args.clone();
let queued_root = facts.reach.at.clone();
- let queued = crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {
+ let queued = dispatch.spawn_blocking(move || {
super::tool_writes::enqueue(&config, &write_args, &facts)
})
.await;
diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rs
index d4e2616398..ceb4e4c1c4 100644
--- a/crates/openhuman-core/src/threads/ops/edit.rs
+++ b/crates/openhuman-core/src/threads/ops/edit.rs
@@ -109,7 +109,7 @@ pub async fn edit_message(
let store_owned = store.clone();
let thread_id_owned = thread_id.clone();
let cut_request_id_owned = cut_request_id.clone();
- crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {
+ ctx.spawn_blocking(move || {
truncate_transcript_before_turn(&store_owned, &thread_id_owned, &cut_request_id_owned)
})
.await
@@ -181,7 +181,7 @@ pub async fn regenerate(
let store_for_blocking = store.clone();
let thread_id_for_blocking = thread_id.clone();
let target_for_blocking = target_request_id.clone();
- let (prompt, cut_request_id) = crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {
+ let (prompt, cut_request_id) = ctx.spawn_blocking(move || {
truncate_transcript_for_regenerate(
&store_for_blocking,
&thread_id_for_blocking,