Skip to content

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

fix(memory): benchmark retrieval through bound provider

Steven Enamakel50b29a533915
diff --git a/src/openhuman/memory/agent/ops.rs b/src/openhuman/memory/agent/ops.rs
index 1a55311136..56230311a2 100644
--- a/src/openhuman/memory/agent/ops.rs
+++ b/src/openhuman/memory/agent/ops.rs
@@ -8,7 +8,8 @@
use crate::openhuman::config::Config;
use crate::openhuman::memory::agent::types::{BenchmarkSummary, RetrievalStep, WalkBenchmark};
-use crate::openhuman::memory::tree::retrieval::{fast_retrieve, FastRetrieveOptions};
+use crate::openhuman::memory::api::provider::retrieval::{FastRetrieveQuery, RetrievalResponse};
+use crate::openhuman::memory::source_scope::as_bus_scope;
use std::path::PathBuf;
use std::time::Instant;
@@ -32,13 +33,34 @@ pub async fn bench_walk(
limit
);
- let opts = FastRetrieveOptions {
+ let opts = FastRetrieveQuery {
limit,
- ..FastRetrieveOptions::default()
+ ..FastRetrieveQuery::default()
};
+ // Through the bound driver's `MemoryRetrieval`, not the engine (#5560).
+ // `as_bus_scope()` renders this host's own source allowlist in the
+ // contract's vocabulary — `binding.provider()` is the unguarded driver, so
+ // the scope passed here IS the gate, and a literal `None` would fail it
+ // open. See `memory::tree::retrieval::rpc`'s module docs.
+ let scope = as_bus_scope();
+ let binding = crate::openhuman::memory::binding::for_config(config)?;
let start = Instant::now();
- let resp = fast_retrieve(config, query, opts).await?;
+ let resp = match binding.provider().as_retrieval() {
+ Some(retrieval) => retrieval
+ .fast_retrieve(query, opts, scope.as_ref())
+ .await
+ .map_err(|e| anyhow::anyhow!("bench_walk: fast_retrieve: {e}"))?,
+ // A driver with no retrieval family keeps no summary tree to rank, so
+ // an empty result is the honest benchmark rather than an error.
+ None => {
+ log::debug!(
+ "[agent_memory::bench] driver '{}' does not serve Retrieval; reporting empty",
+ binding.driver_id()
+ );
+ RetrievalResponse::default()
+ }
+ };
let total_elapsed = start.elapsed();
let total_bytes_scanned: u64 = resp.hits.iter().map(|h| h.content.len() as u64).sum();
diff --git a/vendor/tinymemory b/vendor/tinymemory
index 42e2d3caa5..8cc4bceaa4 160000
--- a/vendor/tinymemory
+++ b/vendor/tinymemory
@@ -1 +1 @@
-Subproject commit 42e2d3caa5c25348b3c8d743b00b1334fbbd05c5
+Subproject commit 8cc4bceaa44cbc5aa2e4a452a77923892d3c9a1e