Skip to content

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

refactor(memory): route the last contract-covered call sites, and fix the CLI gate\n\nA parallel sweep over every remaining bucket. The finding worth recording is\nthe shape of what is left: of 86 distinct engine symbols this host still\nnames, 15 have an exact contract member, 9 have one whose output differs,\nand 44 have none at all — they hand out a connection or a client, not data.\nRouting cannot reach those, which is why this is the end of what routing\nachieves rather than a pause in it.\n\nMigrated where a member covers the call exactly: chunk list/get in the tree\nRPC (`ChunkQuery` is `ListChunksQuery` field-for-field; `Chunk` is the same\nitem on both paths, so the wire bytes are unchanged, and the `spawn_blocking`\ngoes with it because the driver owns whether its reads block), the memory\ntools' store/recall/forget, `remember_preference`, the ops layer's document\nhelpers, and the composio sync bus.\n\nLeft alone, deliberately, each with the reason in the file: the entity and\ngraph read RPCs return a total count and a `MAX(surface)` sample the contract\ndoes not promise; `ingest_*` returns `IngestResult`, whose `already_ingested`\nis load-bearing and which `IngestOutcome` drops; the retrieval RPCs serialise\na `tree_kind` the contract's `RetrievalHit` does not carry. Each of those is a\nwire renegotiation, not a routing change.\n\n`legacy_client_verdict` accepted only `DriverClass::Embedded` while\n`binding::admit` had stopped admitting `Embedded` at all — so it was refusing\nevery `openhuman memory` subcommand in the field, not just the two it meant\nto gate. `Module` passes now: the gate is about where memory lives, and a\nmodule is a cdylib over the in-process bus with no egress. `External` and\n`Null` stay refused for the reason the message gives.\n\nTwo dead aliases removed (`memory::{MemoryClient, UnifiedMemory}`,\n`lib::{MemoryClient, MemoryState}`) — zero consumers anywhere; the two tests\nthat did want the handle now name the crate deliberately.\n\nThe ratchets drove their own shrink, which is what they are for: seven files\nstruck off the direct-refs allowlist, one dead guard bypass removed. The new\ntest seam lives under `memory/test_support/` because that is the path the\nbypass scanner skips — its allowlist may shrink but never grow, and a test\nfixture is not the kind of bypass that list exists to track.\n\n285 -> 236 direct engine references over the session.\n\n

Shanu0f2058cb0926
diff --git a/src/core/cli_capability.rs b/src/core/cli_capability.rs
index 65392ddc4d..f0adafd7df 100644
--- a/src/core/cli_capability.rs
+++ b/src/core/cli_capability.rs
@@ -78,11 +78,11 @@ pub fn capability_unavailable_message(
/// embedded engine directly, and the bound driver is not that engine.
pub fn legacy_client_unavailable_message(driver_id: &str, invocation: &str) -> String {
format!(
- "{LEGACY_CLIENT_UNAVAILABLE_PREFIX}`{driver_id}` is not the embedded TinyCortex \
- driver, so `{invocation}` is unavailable: it operates on the local embedded \
- store directly, and this configuration bound a different driver. Run \
- `openhuman subsystems` to see the bound driver, or change \
- `[subsystems.memory] driver` in your config.",
+ "{LEGACY_CLIENT_UNAVAILABLE_PREFIX}`{driver_id}` does not keep memory in the \
+ local store, so `{invocation}` is unavailable: it reads that store \
+ directly, and this configuration bound a driver that answers from \
+ somewhere else. Run `openhuman subsystems` to see the bound driver, or \
+ change `[subsystems.memory] driver` in your config.",
)
}
@@ -203,7 +203,18 @@ pub fn ensure_capability_blocking(required: Option<Capability>, invocation: &str
/// caller means "no legacy gate applies", and an unresolvable binding has
/// already been defaulted-OPEN upstream by the caller skipping this entirely.
pub fn legacy_client_verdict(driver_id: &str, class: DriverClass, invocation: &str) -> Result<()> {
- if class == DriverClass::Embedded {
+ // `Module` passes for the same reason `Embedded` does, and omitting it was
+ // refusing every `openhuman memory` subcommand in the field: `binding::admit`
+ // stopped admitting `Embedded` at all (the built-in driver binds as
+ // `Module`), so a gate that only accepted `Embedded` accepted nothing.
+ //
+ // The gate's premise is about WHERE the memory lives, not how the driver is
+ // linked. A module is a `cdylib` over the in-process bus with no egress and
+ // no process boundary — the local store is still the store these
+ // subcommands operate on. `External` and `Null` stay refused, and for the
+ // reason the message gives: the local store is not the source of truth
+ // there, so reading it directly would answer from the wrong place.
+ if matches!(class, DriverClass::Embedded | DriverClass::Module) {
return Ok(());
}
log::warn!(
diff --git a/src/core/memory_cli.rs b/src/core/memory_cli.rs
index a8f2cf9872..a2f1854b22 100644
--- a/src/core/memory_cli.rs
+++ b/src/core/memory_cli.rs
@@ -783,24 +783,50 @@ mod tests {
let msg = err.to_string();
assert!(msg.contains("null"), "{msg}");
assert!(
- msg.contains("embedded"),
- "refusal must explain that the legacy client is the embedded engine: {msg}"
+ msg.contains("local store"),
+ "refusal must explain that these subcommands read the local store: {msg}"
);
}
}
- /// The embedded driver is the only class that may serve legacy subcommands.
+ /// Both local-store classes may serve the legacy subcommands.
+ ///
+ /// `Module` matters more than `Embedded` now: `binding::admit` refuses
+ /// `Embedded` outright, so the built-in driver binds as `Module` and a gate
+ /// that accepted only `Embedded` refused every subcommand in the field.
#[test]
- fn embedded_driver_serves_every_legacy_subcommand() {
+ fn local_store_drivers_serve_every_legacy_subcommand() {
+ for (driver, class) in [
+ ("tinycortex", DriverClass::Embedded),
+ ("tinymemory", DriverClass::Module),
+ ] {
+ for sub in LEGACY_ENGINE_SUBCOMMANDS {
+ assert!(
+ crate::core::cli_capability::legacy_client_verdict(
+ driver,
+ class,
+ &format!("openhuman memory {sub}"),
+ )
+ .is_ok(),
+ "`openhuman memory {sub}` must stay available under {driver} ({class:?})"
+ );
+ }
+ }
+ }
+
+ /// A driver that answers from somewhere else must still be refused —
+ /// reading the local store there would answer from the wrong place.
+ #[test]
+ fn external_driver_still_rejects_every_legacy_subcommand() {
for sub in LEGACY_ENGINE_SUBCOMMANDS {
assert!(
crate::core::cli_capability::legacy_client_verdict(
- "tinycortex",
- DriverClass::Embedded,
+ "supermemory",
+ DriverClass::External,
&format!("openhuman memory {sub}"),
)
- .is_ok(),
- "`openhuman memory {sub}` must stay available under the embedded driver"
+ .is_err(),
+ "`openhuman memory {sub}` must stay refused under a remote driver"
);
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 1ebde6b184..ba4e67d5c4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,7 +22,6 @@ pub mod rpc;
pub mod tui;
pub use openhuman::config::DaemonConfig;
-pub use tinymemory_core::store::{MemoryClient, MemoryState};
/// Embeddable core composition API. Host the OpenHuman core in any process —
/// the Tauri shell, a CLI, a stdio MCP server, or a cloud/team server — via
diff --git a/src/openhuman/agent/tools/remember_preference.rs b/src/openhuman/agent/tools/remember_preference.rs
index 264215b3e5..9efeff618a 100644
--- a/src/openhuman/agent/tools/remember_preference.rs
+++ b/src/openhuman/agent/tools/remember_preference.rs
@@ -324,30 +324,47 @@ impl Tool for RememberPreferenceTool {
#[cfg(test)]
mod tests {
use super::*;
- use crate::openhuman::inference::embeddings::NoopEmbedding;
use crate::openhuman::security::{AutonomyLevel, SecurityPolicy};
use serde_json::json;
- use tempfile::TempDir;
- use tinymemory_core::store::UnifiedMemory;
-
- // The read-back goes through the engine handle directly, so its entries
- // carry the engine's category type rather than the contract's.
- // The contract's type, not the engine's: `tinymemory-core` re-exports
- // `tinymemory_api::traits::MemoryCategory` (#18 §A1). Named at its source
- // so this test does not hold the engine crate in the build (#5560).
- use tinymemory_api::types::MemoryCategory as EngineMemoryCategory;
+ use tinymemory_api::types::MemoryEntry;
fn test_security() -> Arc<SecurityPolicy> {
Arc::new(SecurityPolicy::default())
}
- fn test_mem() -> (
- TempDir,
- std::sync::Arc<dyn crate::openhuman::memory::Memory>,
- ) {
- let tmp = TempDir::new().unwrap();
- let mem = UnifiedMemory::new(tmp.path(), Arc::new(NoopEmbedding), None).unwrap();
- (tmp, Arc::new(mem))
+ /// Read a pinned preference back through the guard — the door the tool
+ /// wrote it through.
+ ///
+ /// The tool holds no handle: it resolves the *bound* driver per call, so a
+ /// fixture store built here would be a different store entirely and could
+ /// never see the write. That matters most for the absence assertions —
+ /// against a store the tool never writes to they hold whether or not the
+ /// refusal under test worked, which is worse than no assertion at all.
+ async fn stored(key: &str) -> Option<MemoryEntry> {
+ active_memory_guard()
+ .await
+ .expect("a bound memory guard")
+ .get(PINNED_PREFERENCES_NAMESPACE, key)
+ .await
+ .expect("read back through the guard")
+ }
+
+ /// How many rows the guard holds under `key`.
+ ///
+ /// Filtered by exact key rather than counting the namespace: the pinned
+ /// namespace is a fixed constant the tool derives, so every test in the
+ /// process writes into the same one and a namespace-wide count would be a
+ /// function of what else ran.
+ async fn stored_row_count(key: &str) -> usize {
+ active_memory_guard()
+ .await
+ .expect("a bound memory guard")
+ .list(Some(PINNED_PREFERENCES_NAMESPACE), None, None)
+ .await
+ .expect("list through the guard")
+ .into_iter()
+ .filter(|entry| entry.key == key)
+ .count()
}
// ── FacetClass ─────────────────────────────────────────────────────────
@@ -405,7 +422,6 @@ mod tests {
#[test]
fn tool_name_and_permission() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
assert_eq!(tool.name(), "remember_preference");
assert_eq!(tool.permission_level(), PermissionLevel::Write);
@@ -413,7 +429,6 @@ mod tests {
#[test]
fn schema_has_required_fields() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let schema = tool.parameters_schema();
assert_eq!(schema["type"], "object");
@@ -430,7 +445,6 @@ mod tests {
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn missing_class_returns_error() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"key": "timezone", "value": "IST"}))
@@ -444,7 +458,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn invalid_class_returns_error() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"class": "bogus", "key": "timezone", "value": "IST"}))
@@ -458,7 +471,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn missing_key_returns_error() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"class": "style", "value": "terse"}))
@@ -472,7 +484,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn empty_key_returns_error() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"class": "style", "key": " ", "value": "terse"}))
@@ -486,7 +497,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn key_with_spaces_returns_error() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"class": "style", "key": "my pref", "value": "terse"}))
@@ -500,7 +510,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn missing_value_returns_error() {
- let (_tmp, _mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"class": "tooling", "key": "pkg_mgr"}))
@@ -516,7 +525,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn stores_preference_in_user_profile_namespace() {
- let (_tmp, mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
let result = tool
.execute(json!({"class": "tooling", "key": "package_manager", "value": "pnpm"}))
@@ -525,27 +533,20 @@ the tool resolves the bound driver rather than being handed a memory handle"]
assert!(!result.is_error, "unexpected error: {}", result.output());
assert!(result.output().contains("package_manager"));
- let entry = mem
- .get(
- PINNED_PREFERENCES_NAMESPACE,
- "pinned/tooling/package_manager",
- )
- .await
- .unwrap();
+ let entry = stored("pinned/tooling/package_manager").await;
assert!(entry.is_some(), "entry must have been stored");
let entry = entry.unwrap();
assert_eq!(
entry.content,
"[pinned] (class=tooling) package_manager: pnpm"
);
- assert_eq!(entry.category, EngineMemoryCategory::Core);
+ assert_eq!(entry.category, MemoryCategory::Core);
}
#[tokio::test]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn idempotent_overwrite_does_not_create_duplicate() {
- let (_tmp, mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
// First write.
@@ -565,10 +566,8 @@ the tool resolves the bound driver rather than being handed a memory handle"]
);
// Verify the overwritten content via get() which reads the actual content column.
- let entry = mem
- .get(PINNED_PREFERENCES_NAMESPACE, "pinned/style/verbosity")
+ let entry = stored("pinned/style/verbosity")
.await
- .unwrap()
.expect("entry must exist after overwrite");
assert_eq!(
entry.content, "[pinned] (class=style) verbosity: terse",
@@ -576,22 +575,17 @@ the tool resolves the bound driver rather than being handed a memory handle"]
);
// Verify no duplicate entries exist via list().
- let all_entries = mem
- .list(Some(PINNED_PREFERENCES_NAMESPACE), None, None)
- .await
- .unwrap();
- let verbosity_entries: Vec<_> = all_entries
- .iter()
- .filter(|e| e.key == "pinned/style/verbosity")
- .collect();
- assert_eq!(verbosity_entries.len(), 1, "must not duplicate entries");
+ assert_eq!(
+ stored_row_count("pinned/style/verbosity").await,
+ 1,
+ "must not duplicate entries"
+ );
}
#[tokio::test]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn stores_all_six_classes() {
- let (_tmp, mem) = test_mem();
let tool = RememberPreferenceTool::new(test_security());
for (class, key, value) in [
@@ -613,11 +607,19 @@ the tool resolves the bound driver rather than being handed a memory handle"]
);
}
- let entries = mem
- .list(Some(PINNED_PREFERENCES_NAMESPACE), None, None)
- .await
- .unwrap();
- assert_eq!(entries.len(), 6);
+ // Asserted key by key rather than as a namespace count: the pinned
+ // namespace is a fixed constant, so every test in the process writes
+ // into the same one and a total would be a function of what else ran.
+ for key in [
+ "pinned/style/tone",
+ "pinned/identity/name",
+ "pinned/tooling/editor",
+ "pinned/veto/no_emoji",
+ "pinned/goal/ship_feature",
+ "pinned/channel/preferred",
+ ] {
+ assert!(stored(key).await.is_some(), "{key} must have been stored");
+ }
}
// ── Security gate ───────────────────────────────────────────────────────
@@ -626,21 +628,19 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn blocked_in_readonly_mode() {
- let (_tmp, mem) = test_mem();
let readonly = Arc::new(SecurityPolicy {
autonomy: AutonomyLevel::ReadOnly,
..SecurityPolicy::default()
});
let tool = RememberPreferenceTool::new(readonly);
+ // A key no other test writes: the absence assertion now runs against
+ // the shared bound store, so `stores_all_six_classes`' `style/tone`
+ // would satisfy it for the wrong reason if the two collided.
let result = tool
- .execute(json!({"class": "style", "key": "tone", "value": "formal"}))
+ .execute(json!({"class": "style", "key": "readonly_tone", "value": "formal"}))
.await
.unwrap();
assert!(result.is_error);
- assert!(mem
- .get(PINNED_PREFERENCES_NAMESPACE, "pinned/style/tone")
- .await
- .unwrap()
- .is_none());
+ assert!(stored("pinned/style/readonly_tone").await.is_none());
}
}
diff --git a/src/openhuman/hosted/orchestration/effect_executor.rs b/src/openhuman/hosted/orchestration/effect_executor.rs
index 4b5aaedfe7..2560748032 100644
--- a/src/openhuman/hosted/orchestration/effect_executor.rs
+++ b/src/openhuman/hosted/orchestration/effect_executor.rs
@@ -773,40 +773,69 @@ fn evict_source_id(session_id: &str, cycle_id: &str) -> String {
format!("orch_evict:{session}:{cycle_id}")
}
-/// Fold each evicted summary into local memory RAG via the standard ingest
-/// pipeline. The device's memory never leaves the machine — only the hosted
-/// brain's own compressed summary text (which it just sent us) is stored.
+/// Fold each evicted summary into local memory RAG through the bound driver's
+/// Ingest family. The device's memory never leaves the machine — only the
+/// hosted brain's own compressed summary text (which it just sent us) is
+/// stored, and it is stored by whichever driver this workspace is bound to.
pub async fn execute_evict(effect: &EvictEffect) -> Result<(), String> {
- use tinycortex::memory::ingest::canonicalize::document::DocumentInput;
- use tinymemory_core::ingest_pipeline::ingest_document_with_scope;
+ use crate::openhuman::memory::api::chunks::{DataSource, SourceRef};
+ use crate::openhuman::memory::api::provider::types::IngestItem;
+ use crate::openhuman::memory::api::types::MemoryTaint;
let config = crate::openhuman::config::Config::load_or_init()
.await
.map_err(|e| format!("config load: {e}"))?;
+ let binding = crate::openhuman::memory::binding::for_config(&config)?;
+ // A write, so an absent family refuses rather than reporting success. The
+ // caller un-claims the `callId` on `Err`, so the brain redelivers the evict
+ // instead of us acking away a summary that was never stored.
+ let Some(ingest) = binding.provider().as_ingest() else {
+ return Err(format!(
+ "evict ingest: driver '{}' does not serve the Ingest family",
+ binding.driver_id()
+ ));
+ };
+
let mut ingested = 0usize;
for entry in &effect.entries {
if entry.summary.trim().is_empty() {
continue;
}
let source_id = evict_source_id(&effect.session_id, &entry.cycle_id);
- let doc = DocumentInput {
- provider: "orchestration".to_string(),
- title: format!("Evicted orchestration summary {}", entry.cycle_id),
- body: entry.summary.clone(),
- modified_at: chrono::Utc::now(),
- source_ref: Some(source_id.clone()),
+ let item = IngestItem {
+ namespace: None,
+ // `DataSource` is a closed enum of upstream connectors and names no
+ // orchestration eviction, so no variant is *true* here. It is also
+ // not stored: the document canonicaliser keeps only body,
+ // modified_at and source_ref, and chunk `Metadata` has no provider
+ // column at all. `Upload` is the honest shape of the three that do
+ // survive — content that arrived once with no upstream to refetch —
+ // and the eviction's own provenance rides on `source_id`, the tags
+ // and `path_scope`, all of which are preserved verbatim below.
+ source: DataSource::Upload,
+ source_id: source_id.clone(),
+ owner: "user".to_string(),
+ source_ref: Some(SourceRef::new(source_id)),
+ content: entry.summary.clone(),
+ mime: None,
+ timestamp: Some(chrono::Utc::now()),
+ tags: vec!["orchestration".to_string(), "evicted".to_string()],
+ author: None,
+ channel_label: None,
+ platform: None,
+ // The chunk tier cannot carry a non-default taint and the driver
+ // rejects an item that claims one, so `Internal` is the only value
+ // ingest accepts. It is also the true one: this is the hosted
+ // brain's own summary of the user's own conversation, not content
+ // synced in from a third-party source.
+ taint: MemoryTaint::Internal,
+ path_scope: Some("orchestration/evicted".to_string()),
};
- ingest_document_with_scope(
- &config,
- &source_id,
- "user",
- vec!["orchestration".to_string(), "evicted".to_string()],
- doc,
- Some("orchestration/evicted".to_string()),
- )
- .await
- .map_err(|e| format!("evict ingest cycle={}: {e}", entry.cycle_id))?;
+ ingest
+ .ingest_document(item)
+ .await
+ .map_err(|e| format!("evict ingest cycle={}: {e}", entry.cycle_id))?;
ingested += 1;
}
log::debug!(
diff --git a/src/openhuman/memory/bypass_allowlist_tests.rs b/src/openhuman/memory/bypass_allowlist_tests.rs
index 428f1d3dcf..b5102f45cd 100644
--- a/src/openhuman/memory/bypass_allowlist_tests.rs
+++ b/src/openhuman/memory/bypass_allowlist_tests.rs
@@ -271,11 +271,6 @@ const ALLOWED: &[(&str, &str, &str)] = &[
"global::client_if_ready(",
"same definition site",
),
- (
- "src/openhuman/memory/ops/learn.rs",
- "global::client(",
- "inline #[cfg(test)] module only; the scanner does not brace-track test blocks",
- ),
(
"src/openhuman/memory/ops/provider.rs",
".memory_binding(",
diff --git a/src/openhuman/memory/direct_engine_refs_tests.rs b/src/openhuman/memory/direct_engine_refs_tests.rs
index 61873d411e..7ff79a3979 100644
--- a/src/openhuman/memory/direct_engine_refs_tests.rs
+++ b/src/openhuman/memory/direct_engine_refs_tests.rs
@@ -294,11 +294,6 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
Verdict::NeedsWiderSeam,
"the re-embed queue (queue::start) has no capability family",
),
- (
- "src/lib.rs",
- Verdict::HostSide,
- "crate-root re-export of the engine's store module under its historical path",
- ),
(
"src/openhuman/agent/experience/ops.rs",
Verdict::NeedsWiderSeam,
@@ -364,11 +359,6 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
Verdict::NeedsWiderSeam,
"holds or boots the in-process engine handle (global::client_if_ready, store::MemoryClient); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
- (
- "src/openhuman/agent/tools/remember_preference.rs",
- Verdict::NeedsWiderSeam,
- "holds or boots the in-process engine handle (store::UnifiedMemory); driver construction belongs to memory::binding and the seam has no door onto the live client",
- ),
(
"src/openhuman/channels/controllers/ops/connect.rs",
Verdict::NeedsWiderSeam,
@@ -404,11 +394,6 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
Verdict::NeedsWiderSeam,
"holds or boots the in-process engine handle (store::MemoryClientRef); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
- (
- "src/openhuman/hosted/orchestration/effect_executor.rs",
- Verdict::NeedsWiderSeam,
- "engine-internal ingest pipeline entry (ingest_pipeline::ingest_document_with_scope); the ingest family covers documents and chat, not the scope-carrying pipeline variants",
- ),
(
"src/openhuman/integrations/composio/ops/memory_cleanup.rs",
Verdict::NeedsWiderSeam,
@@ -444,11 +429,6 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
Verdict::NeedsWiderSeam,
"holds or boots the in-process engine handle (global::client, global::client_if_ready, global::init, store::GraphRelationRecord); driver construction belongs to memory::binding and the seam has no door onto the live client",
),
- (
- "src/openhuman/memory/ops/learn.rs",
- Verdict::NeedsWiderSeam,
- "holds or boots the in-process engine handle (global::client, store::NamespaceDocumentInput); driver construction belongs to memory::binding and the seam has no door onto the live client",
- ),
(
"src/openhuman/memory/ops/sync.rs",
Verdict::NeedsWiderSeam,
@@ -524,21 +504,6 @@ const ALLOWED: &[(&str, Verdict, &str)] = &[
Verdict::NeedsWiderSeam,
"engine internals (tinycortex::memory_config_from); tinycortex-shaped, so no engine-neutral family can express it",
),
- (
- "src/openhuman/memory/tools/forget.rs",
- Verdict::NeedsWiderSeam,
- "holds or boots the in-process engine handle (store::UnifiedMemory); driver construction belongs to memory::binding and the seam has no door onto the live client",
- ),
- (
- "src/openhuman/memory/tools/recall.rs",
- Verdict::NeedsWiderSeam,
- "holds or boots the in-process engine handle (store::UnifiedMemory); driver construction belongs to memory::binding and the seam has no door onto the live client",
- ),
- (
- "src/openhuman/memory/tools/store.rs",
- Verdict::NeedsWiderSeam,
- "holds or boots the in-process engine handle (store::UnifiedMemory); driver construction belongs to memory::binding and the seam has no door onto the live client",
- ),
(
"src/openhuman/memory/tree/retrieval/rpc.rs",
Verdict::NeedsWiderSeam,
diff --git a/src/openhuman/memory/mod.rs b/src/openhuman/memory/mod.rs
index 7dfc5f0e0c..7c9cd8057a 100644
--- a/src/openhuman/memory/mod.rs
+++ b/src/openhuman/memory/mod.rs
@@ -46,6 +46,8 @@ pub mod schemas;
/// The host-side per-turn memory-source allowlist. See the module docs for why
/// this is OpenHuman's and not the engine's.
pub mod source_scope;
+#[cfg(test)]
+pub(crate) mod test_support;
pub mod tools;
// Domains that are *mostly* extracted but keep their JSON-RPC surface here.
@@ -146,5 +148,11 @@ pub use crate::openhuman::memory::api::types::{
// Types that external tests and consumers historically imported from
// `memory::*`. The definitions moved to sibling crates during the memory
// refactor; these aliases keep the public surface stable.
+//
+// `MemoryClient` and `UnifiedMemory` are gone from this list: both were engine
+// handles re-exported for consumers that no longer exist (grep found none in
+// `src/`, `tests/` or the shell), and an unused alias is a compile-time link to
+// the engine bought for nobody (#5560). A caller that genuinely needs the
+// in-process handle names the crate deliberately rather than reaching it
+// through the memory module's public surface.
pub use crate::openhuman::memory::api::types::NamespaceDocumentInput;
-pub use tinymemory_core::store::{MemoryClient, UnifiedMemory};
diff --git a/src/openhuman/memory/ops/helpers.rs b/src/openhuman/memory/ops/helpers.rs
index a1f4b4ccf3..6c35d6e84e 100644
--- a/src/openhuman/memory/ops/helpers.rs
+++ b/src/openhuman/memory/ops/helpers.rs
@@ -235,7 +235,11 @@ pub(crate) fn format_llm_context_message(
#[cfg(test)]
mod tests {
use super::*;
- use tinymemory_core::store::RetrievalScoreBreakdown;
+ // The score breakdown a `NamespaceMemoryHit` carries is contract
+ // vocabulary — `tinymemory-core` only re-exports it — so the fixture names
+ // it where it is defined. Same item either way; the engine path was a
+ // compile-time link this host is shedding (#5560).
+ use crate::openhuman::memory::api::types::RetrievalScoreBreakdown;
fn sample_hit(kind: MemoryItemKind) -> NamespaceMemoryHit {
NamespaceMemoryHit {
diff --git a/src/openhuman/memory/ops/learn.rs b/src/openhuman/memory/ops/learn.rs
index 9dd89b68a2..8216b56a33 100644
--- a/src/openhuman/memory/ops/learn.rs
+++ b/src/openhuman/memory/ops/learn.rs
@@ -203,13 +203,29 @@ mod tests {
}
}
+ /// Seed a document through the guard — the same door
+ /// [`memory_learn_all`] enumerates namespaces through.
+ ///
+ /// `MemoryDocuments::put_document` is the full pipeline, not the engine's
+ /// `put_doc_light` shortcut this used to call: the contract has one put and
+ /// the driver owns what happens behind it, so the background
+ /// graph-extraction enqueue comes along. That is the cost of the seed and
+ /// the enumeration reading one store rather than two — a handle-seeded row
+ /// is only visible to the guard for as long as the bound driver happens to
+ /// be the in-process engine.
+ ///
+ /// `ensure_memory_client` stays: `active_memory_guard`'s no-context
+ /// fallback prefers the workspace the global client is already bound to,
+ /// and the callers below move `OPENHUMAN_WORKSPACE` to a tempdir *after*
+ /// seeding.
async fn seed_namespace(prefix: &str) -> String {
ensure_memory_client();
let short_id = &uuid::Uuid::new_v4().as_simple().to_string()[..12];
let namespace = format!("{prefix}ns{short_id}");
- let client = tinymemory_core::global::client().expect("memory client");
- client
- .put_doc_light(NamespaceDocumentInput {
+ let guard = active_memory_guard().await.expect("a bound memory guard");
+ let documents = guard.as_documents().expect("the documents family");
+ documents
+ .put_document(NamespaceDocumentInput {
namespace: namespace.clone(),
key: format!("testkey{short_id}"),
title: "Test".into(),
@@ -221,6 +237,7 @@ mod tests {
category: "core".into(),
session_id: None,
document_id: None,
+ // Requested provenance; the guard stamps the effective value.
taint: crate::openhuman::memory::MemoryTaint::Internal,
})
.await
diff --git a/src/openhuman/memory/query/ingest_document.rs b/src/openhuman/memory/query/ingest_document.rs
index 8abb6058d9..5ed0432629 100644
--- a/src/openhuman/memory/query/ingest_document.rs
+++ b/src/openhuman/memory/query/ingest_document.rs
@@ -183,6 +183,14 @@ mod tests {
async fn isolated_config(tmp: &TempDir) -> (WorkspaceEnvGuard, Config) {
let guard = WorkspaceEnvGuard::set(tmp.path());
let config = Config::load_or_init().await.expect("load config");
+ // `list_chunks_rpc` reads through the bound driver now, and a unit-test
+ // workspace binds the null one — which serves no Chunks family and
+ // therefore answers empty however many rows the ingest wrote. Bind the
+ // in-process driver over this same workspace so the read sees the
+ // write; it is the driver the loadable module wraps, which is as close
+ // to production as a test process can get (a dlopen'ed module is a
+ // process singleton a unit test cannot load).
+ crate::openhuman::memory::test_support::install_tinycortex_for_test(&config);
(guard, config)
}
diff --git a/src/openhuman/memory/read_rpc/chunks.rs b/src/openhuman/memory/read_rpc/chunks.rs
index 9869230be2..366838170b 100644
--- a/src/openhuman/memory/read_rpc/chunks.rs
+++ b/src/openhuman/memory/read_rpc/chunks.rs
@@ -32,6 +32,15 @@ pub async fn list_chunks_rpc(
))
}
+/// The list query stays in SQL because `MemoryChunks::list_chunks` cannot
+/// express it.
+///
+/// Three of this filter's inputs have no `ChunkQuery` counterpart: the
+/// `mem_tree_entity_index` join behind `entity_ids`, the *sets* behind
+/// `source_kinds` / `source_ids` (the contract narrows to one of each), and the
+/// `content LIKE` scan behind `query`. The response also carries `total`, a
+/// count over the unpaged result — no member answers it, and deriving it
+/// host-side would mean a second, unbounded list on every page.
pub(super) fn list_chunks_blocking(
config: &Config,
filter: &ChunkFilter,
@@ -331,6 +340,15 @@ pub async fn recall_rpc(
.collect::<Vec<_>>()
})
.collect();
+ // Hydrated row by row here rather than through `MemoryChunks::chunk_detail`
+ // — which `read_chunk_row` below does use — because the two shapes line up
+ // field for field save one. `has_embedding` on this path is the legacy
+ // `mem_tree_chunks.embedding` column; `chunk_detail` asks the sidecar
+ // `mem_tree_chunk_embeddings` table whether a vector exists under the
+ // *active* model signature. Nothing has written the inline column since the
+ // sidecar migration, so swapping the call flips the flag to true on every
+ // embedded chunk — a visible change to what the Memory tab renders, not a
+ // routing swap.
if !leaves.is_empty() {
let collected = tokio::task::spawn_blocking(move || -> Result<Vec<(ChunkRow, f32)>> {
with_connection(&cfg, |conn| {
diff --git a/src/openhuman/memory/read_rpc/entities.rs b/src/openhuman/memory/read_rpc/entities.rs
index 4ec8add948..772835a8e0 100644
--- a/src/openhuman/memory/read_rpc/entities.rs
+++ b/src/openhuman/memory/read_rpc/entities.rs
@@ -10,6 +10,16 @@ use super::types::{DeleteChunkResponse, EntityRef, ScoreBreakdown, ScoreSignal,
// ── entity index lookups ────────────────────────────────────────────────
+// These three read `mem_tree_entity_index` directly, and the contract's entity
+// family does not cover them. `MemoryEntities::entities` looks like a fit for
+// `top_entities` and is not: it is namespace-scoped where this is store-wide,
+// ranks by hotness where this ranks by mention count, and the `EntityRef::name`
+// on its `EntityHit` is a canonical name, not the `MAX(surface)` sample this
+// handler's own `EntityRef` carries.
+// `entity_index_for` (the entities of one chunk) and `chunks_for_entity` (the
+// chunk ids of one entity) have no member at all — `entity_edges` answers
+// entity-to-entity, never entity-to-chunk.
+
pub async fn entity_index_for_rpc(
config: &Config,
chunk_id: String,
diff --git a/src/openhuman/memory/read_rpc/graph.rs b/src/openhuman/memory/read_rpc/graph.rs
index 4cf5699f9b..7b8527efa4 100644
--- a/src/openhuman/memory/read_rpc/graph.rs
+++ b/src/openhuman/memory/read_rpc/graph.rs
@@ -6,6 +6,12 @@ use crate::openhuman::config::Config;
use crate::rpc::RpcOutcome;
use tinymemory_core::store::chunks::store::with_connection;
+// `MemoryGraph` in the contract is the key/value and relation tier, a different
+// graph from the one exported here: the summary tree and its leaf chunks, laid
+// out for the Memory tab. No family walks a whole store's summaries, and none
+// exposes the entity-mention edges `contacts` mode draws, so both collectors
+// below read the engine's tables.
+
// ── wire types ────────────────────────────────────────────────────────────
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq, Eq)]
diff --git a/src/openhuman/memory/sync/composio/bus.rs b/src/openhuman/memory/sync/composio/bus.rs
index bc5b4211d2..fac528bfb9 100644
--- a/src/openhuman/memory/sync/composio/bus.rs
+++ b/src/openhuman/memory/sync/composio/bus.rs
@@ -386,7 +386,15 @@ impl EventHandler<DomainEvent> for ComposioTriggerSubscriber {
"[composio][triage] run_triage failed (label={}): {e:#}",
envelope.display_label
);
- tinymemory_core::observability::report_error_or_expected(
+ // The classifier named here is the host's own. The
+ // engine crate exposes a `report_error_or_expected` of its
+ // own, but that is a global slot for *extracted* code to
+ // report through, and the reporter installed into it
+ // (`memory::host_impls::OpenHumanErrorReporter`) forwards
+ // verbatim to this function. This subscriber is host code,
+ // so the detour buys nothing and only costs an engine
+ // dependency the seam is trying to shed (#5560).
+ crate::core::observability::report_error_or_expected(
detail.as_str(),
"composio",
"trigger_triage",
diff --git a/src/openhuman/memory/test_support/mod.rs b/src/openhuman/memory/test_support/mod.rs
new file mode 100644
index 0000000000..98504c0213
--- /dev/null
+++ b/src/openhuman/memory/test_support/mod.rs
@@ -0,0 +1,53 @@
+//! Test-only driver construction for handlers that read through a family the
+//! null driver does not serve.
+//!
+//! Lives in a `test_support` directory because that is what the memory-guard
+//! bypass scanner skips by path (`bypass_allowlist_tests::is_test_path`). The
+//! alternative was an allowlist entry, and the allowlist's own rule is that it
+//! may shrink but never grow — a test fixture is not the kind of bypass that
+//! list exists to track.
+
+use super::binding::install_for_test;
+use crate::openhuman::memory::api::provider::MemoryProvider;
+use std::sync::Arc;
+
+/// Bind the in-process TinyCortex driver over a whole `Config`'s workspace.
+///
+/// The shorthand for a test whose handler reads through a family the null
+/// driver does not serve — `Chunks`, `Documents`, `Retrieval` — and which
+/// proves itself by writing rows and reading them back. `FixedDiagnostics`
+/// cannot serve those: it answers `Maintenance` and delegates the rest to
+/// null.
+///
+/// This is the driver the loadable module wraps, so a test binding it exercises
+/// the same engine production reaches over the bus. It is not the bus itself,
+/// and cannot be: a `dlopen`'ed module is a process singleton, and two tests
+/// loading one in the same process hang rather than fail.
+pub(crate) fn install_tinycortex_for_test(config: &crate::openhuman::config::Config) {
+ crate::openhuman::memory::host_impls::install_for_tests();
+ let client = Arc::new(
+ tinymemory_core::store::MemoryClient::from_workspace_dir(config.workspace_dir.clone())
+ .expect("open the workspace store"),
+ );
+ let engine_config = tinymemory_tinycortex::engine::EngineRuntimeConfig {
+ workspace_dir: config.workspace_dir.clone(),
+ config_path: config.workspace_dir.join("config.toml"),
+ memory: config.memory.clone(),
+ memory_tree: config.memory_tree.clone(),
+ scheduler_gate: config.scheduler_gate.clone(),
+ local_ai: config.local_ai.clone(),
+ embeddings_provider: config.embeddings_provider.clone(),
+ memory_provider: None,
+ default_model: None,
+ default_temperature: 0.2,
+ output_language: None,
+ memory_sources: serde_json::Value::Null,
+ };
+ let provider: Arc<dyn MemoryProvider> =
+ Arc::new(tinymemory_tinycortex::engine::TinycortexProvider::new(
+ "tinycortex".to_string(),
+ engine_config,
+ client,
+ ));
+ install_for_test(&config.workspace_dir, &config.subsystems.memory, provider);
+}
diff --git a/src/openhuman/memory/tools/forget.rs b/src/openhuman/memory/tools/forget.rs
index 331b699749..bebb6b5765 100644
--- a/src/openhuman/memory/tools/forget.rs
+++ b/src/openhuman/memory/tools/forget.rs
@@ -98,28 +98,64 @@ impl Tool for MemoryForgetTool {
#[cfg(test)]
mod tests {
use super::*;
- use crate::openhuman::inference::embeddings::NoopEmbedding;
+ use crate::openhuman::memory::api::types::{MemoryEntry, MemoryTaint};
use crate::openhuman::memory::MemoryCategory;
use crate::openhuman::security::{AutonomyLevel, SecurityPolicy};
- use tempfile::TempDir;
- use tinymemory_core::store::UnifiedMemory;
fn test_security() -> Arc<SecurityPolicy> {
Arc::new(SecurityPolicy::default())
}
- fn test_mem() -> (
- TempDir,
- std::sync::Arc<dyn crate::openhuman::memory::Memory>,
- ) {
- let tmp = TempDir::new().unwrap();
- let mem = UnifiedMemory::new(tmp.path(), Arc::new(NoopEmbedding), None).unwrap();
- (tmp, Arc::new(mem))
+ /// A namespace nothing else writes to.
+ ///
+ /// The tool holds no handle — it forgets through the *bound* driver, which
+ /// under a real module is the process-global test workspace every other
+ /// test shares. The legacy fallback below turns on `forget("", "<ns>/<k>")`
+ /// finding nothing under the split shape first, so a fixed namespace would
+ /// let a row another test left at `("global", "temp")` decide which branch
+ /// runs.
+ fn unique_namespace() -> String {
+ format!(
+ "forget{}",
+ &uuid::Uuid::new_v4().as_simple().to_string()[..12]
+ )
+ }
+
+ /// Seed a **legacy packed-key** row — namespace `""`, key `"<ns>/<key>"` —
+ /// through the guard, the same door the tool reads and deletes through.
+ ///
+ /// A fixture store built here would be a different store entirely, so the
+ /// tool would find nothing and `forget_existing` would pass for the wrong
+ /// reason, while the two "blocked" tests' survival assertions would hold
+ /// whether or not the refusal worked.
+ async fn seed_legacy(namespace: &str, key: &str) {
+ active_memory_guard()
+ .await
+ .expect("a bound memory guard")
+ .store(
+ "",
+ &format!("{namespace}/{key}"),
+ "temporary",
+ MemoryCategory::Conversation,
+ None,
+ MemoryTaint::default(),
+ )
+ .await
+ .expect("seed through the guard");
+ }
+
+ /// Read the legacy packed-key row back through the guard.
+ async fn legacy_row(namespace: &str, key: &str) -> Option<MemoryEntry> {
+ active_memory_guard()
+ .await
+ .expect("a bound memory guard")
+ .get("", &format!("{namespace}/{key}"))
+ .await
+ .expect("read back through the guard")
}
#[test]
fn name_and_schema() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryForgetTool::new(test_security());
assert_eq!(tool.name(), "memory_forget");
assert!(tool.parameters_schema()["properties"]["key"].is_object());
@@ -129,36 +165,28 @@ mod tests {
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn forget_existing() {
- let (_tmp, mem) = test_mem();
- mem.store(
- "",
- "global/temp",
- "temporary",
- MemoryCategory::Conversation,
- None,
- )
- .await
- .unwrap();
+ let namespace = unique_namespace();
+ seed_legacy(&namespace, "temp").await;
let tool = MemoryForgetTool::new(test_security());
let result = tool
- .execute(json!({"namespace": "global", "key": "temp"}))
+ .execute(json!({"namespace": namespace, "key": "temp"}))
.await
.unwrap();
assert!(!result.is_error);
assert!(result.output().contains("Forgot"));
- assert!(mem.get("", "global/temp").await.unwrap().is_none());
+ assert!(legacy_row(&namespace, "temp").await.is_none());
}
#[tokio::test]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn forget_nonexistent() {
- let (_tmp, _mem) = test_mem();
+ let namespace = unique_namespace();
let tool = MemoryForgetTool::new(test_security());
let result = tool
- .execute(json!({"namespace": "global", "key": "nope"}))
+ .execute(json!({"namespace": namespace, "key": "nope"}))
.await
.unwrap();
assert!(!result.is_error);
@@ -169,7 +197,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn forget_missing_key() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryForgetTool::new(test_security());
let result = tool.execute(json!({})).await;
assert!(result.is_err());
@@ -179,55 +206,39 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn forget_blocked_in_readonly_mode() {
- let (_tmp, mem) = test_mem();
- mem.store(
- "",
- "global/temp",
- "temporary",
- MemoryCategory::Conversation,
- None,
- )
- .await
- .unwrap();
+ let namespace = unique_namespace();
+ seed_legacy(&namespace, "temp").await;
let readonly = Arc::new(SecurityPolicy {
autonomy: AutonomyLevel::ReadOnly,
..SecurityPolicy::default()
});
let tool = MemoryForgetTool::new(readonly);
let result = tool
- .execute(json!({"namespace": "global", "key": "temp"}))
+ .execute(json!({"namespace": namespace, "key": "temp"}))
.await
.unwrap();
assert!(result.is_error);
assert!(result.output().contains("read-only mode"));
- assert!(mem.get("", "global/temp").await.unwrap().is_some());
+ assert!(legacy_row(&namespace, "temp").await.is_some());
}
#[tokio::test]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn forget_blocked_when_rate_limited() {
- let (_tmp, mem) = test_mem();
- mem.store(
- "",
- "global/temp",
- "temporary",
- MemoryCategory::Conversation,
- None,
- )
- .await
- .unwrap();
+ let namespace = unique_namespace();
+ seed_legacy(&namespace, "temp").await;
let limited = Arc::new(SecurityPolicy {
max_actions_per_hour: 0,
..SecurityPolicy::default()
});
let tool = MemoryForgetTool::new(limited);
let result = tool
- .execute(json!({"namespace": "global", "key": "temp"}))
+ .execute(json!({"namespace": namespace, "key": "temp"}))
.await
.unwrap();
assert!(result.is_error);
assert!(result.output().contains("Rate limit exceeded"));
- assert!(mem.get("", "global/temp").await.unwrap().is_some());
+ assert!(legacy_row(&namespace, "temp").await.is_some());
}
}
diff --git a/src/openhuman/memory/tools/recall.rs b/src/openhuman/memory/tools/recall.rs
index 3e6e0fc6f1..cf112822fc 100644
--- a/src/openhuman/memory/tools/recall.rs
+++ b/src/openhuman/memory/tools/recall.rs
@@ -119,28 +119,52 @@ impl Tool for MemoryRecallTool {
#[cfg(test)]
mod tests {
use super::*;
- use crate::openhuman::inference::embeddings::NoopEmbedding;
+ use crate::openhuman::memory::api::provider::MemoryCore;
+ use crate::openhuman::memory::api::types::MemoryTaint;
use crate::openhuman::memory::MemoryCategory;
- use tempfile::TempDir;
- use tinymemory_core::store::UnifiedMemory;
-
- fn seeded_mem() -> (
- TempDir,
- std::sync::Arc<dyn crate::openhuman::memory::Memory>,
- ) {
- let tmp = TempDir::new().unwrap();
- let mem = UnifiedMemory::new(tmp.path(), std::sync::Arc::new(NoopEmbedding), None).unwrap();
- (tmp, std::sync::Arc::new(mem))
+
+ /// A namespace nothing else writes to.
+ ///
+ /// The tool holds no handle — it recalls through the *bound* driver, which
+ /// under a real module is the process-global test workspace every other
+ /// test shares. A fixed namespace would make the `Found N` counts below
+ /// depend on whatever else ran, so each test owns its own.
+ fn unique_namespace() -> String {
+ format!(
+ "recall{}",
+ &uuid::Uuid::new_v4().as_simple().to_string()[..12]
+ )
+ }
+
+ /// Seed through the guard — the door the tool itself recalls through.
+ ///
+ /// A fixture store built here would be a different store entirely, so
+ /// seeding into one would leave `recall_finds_match` passing only because
+ /// it found nothing.
+ async fn seed(namespace: &str, key: &str, content: &str) {
+ active_memory_guard()
+ .await
+ .expect("a bound memory guard")
+ .store(
+ namespace,
+ key,
+ content,
+ MemoryCategory::Core,
+ None,
+ MemoryTaint::default(),
+ )
+ .await
+ .expect("seed through the guard");
}
#[tokio::test]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn recall_empty() {
- let (_tmp, _mem) = seeded_mem();
+ let namespace = unique_namespace();
let tool = MemoryRecallTool::new();
let result = tool
- .execute(json!({"namespace": "global", "query": "anything"}))
+ .execute(json!({"namespace": namespace, "query": "anything"}))
.await
.unwrap();
assert!(!result.is_error);
@@ -151,29 +175,13 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn recall_finds_match() {
- let (_tmp, mem) = seeded_mem();
- mem.store(
- "global",
- "lang",
- "User prefers Rust",
- MemoryCategory::Core,
- None,
- )
- .await
- .unwrap();
- mem.store(
- "global",
- "tz",
- "Timezone is EST",
- MemoryCategory::Core,
- None,
- )
- .await
- .unwrap();
+ let namespace = unique_namespace();
+ seed(&namespace, "lang", "User prefers Rust").await;
+ seed(&namespace, "tz", "Timezone is EST").await;
let tool = MemoryRecallTool::new();
let result = tool
- .execute(json!({"namespace": "global", "query": "Rust"}))
+ .execute(json!({"namespace": namespace, "query": "Rust"}))
.await
.unwrap();
assert!(!result.is_error);
@@ -185,22 +193,14 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn recall_respects_limit() {
- let (_tmp, mem) = seeded_mem();
+ let namespace = unique_namespace();
for i in 0..10 {
- mem.store(
- "global",
- &format!("k{i}"),
- &format!("Rust fact {i}"),
- MemoryCategory::Core,
- None,
- )
- .await
- .unwrap();
+ seed(&namespace, &format!("k{i}"), &format!("Rust fact {i}")).await;
}
let tool = MemoryRecallTool::new();
let result = tool
- .execute(json!({"namespace": "global", "query": "Rust", "limit": 3}))
+ .execute(json!({"namespace": namespace, "query": "Rust", "limit": 3}))
.await
.unwrap();
assert!(!result.is_error);
@@ -211,7 +211,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn recall_missing_query() {
- let (_tmp, _mem) = seeded_mem();
let tool = MemoryRecallTool::new();
let result = tool.execute(json!({})).await;
assert!(result.is_err());
diff --git a/src/openhuman/memory/tools/store.rs b/src/openhuman/memory/tools/store.rs
index 26fccea98b..2d549915c0 100644
--- a/src/openhuman/memory/tools/store.rs
+++ b/src/openhuman/memory/tools/store.rs
@@ -141,42 +141,23 @@ impl Tool for MemoryStoreTool {
#[cfg(test)]
mod tests {
use super::*;
- use crate::openhuman::inference::embeddings::NoopEmbedding;
use crate::openhuman::security::{AutonomyLevel, SecurityPolicy};
- use tempfile::TempDir;
- use tinymemory_core::store::UnifiedMemory;
- // The read-back below goes through the engine handle directly, but the
- // category it hands back is the CONTRACT's type: `tinymemory-core` merely
- // re-exports `tinymemory_api::traits::MemoryCategory` (issue #18 §A1 moved
- // the memory value types onto the contract precisely so a second engine
- // could be bound without translating). Naming the contract here rather
- // than the engine keeps that true at the import as well as the type, and
- // is one fewer reference holding the crate in the build (#5560).
use crate::openhuman::memory::api::types::MemoryEntry;
- use tinymemory_api::types::MemoryCategory as EngineMemoryCategory;
fn test_security() -> Arc<SecurityPolicy> {
Arc::new(SecurityPolicy::default())
}
- fn test_mem() -> (
- TempDir,
- std::sync::Arc<dyn crate::openhuman::memory::Memory>,
- ) {
- let tmp = TempDir::new().unwrap();
- let mem = UnifiedMemory::new(tmp.path(), Arc::new(NoopEmbedding), None).unwrap();
- (tmp, Arc::new(mem))
- }
-
/// Read a memory back through the seam the tool wrote it through.
///
- /// [`test_mem`] hands out an in-process [`UnifiedMemory`] over a fresh
- /// tempdir, and the tool holds no handle at all — it resolves the *bound*
- /// driver per call. Under a real module that driver is the process-global
- /// test workspace, a different store entirely, so asking `test_mem`'s
- /// handle can never see the write. It is not a flake, and it does not
- /// depend on the engine version: the two stores were never the same one.
+ /// The tool holds no handle at all — it resolves the *bound* driver per
+ /// call — so a fixture store built here could never see the write: under a
+ /// real module the bound driver is the process-global test workspace, a
+ /// different store entirely. That is why no fixture handle exists in this
+ /// module, and why an absence assertion must not be made against one; it
+ /// would hold whether or not the refusal under test worked, which is worse
+ /// than no assertion at all.
///
/// The guard is the tool's own door, so a read through it proves the write
/// landed where a caller would look for it.
@@ -191,7 +172,6 @@ mod tests {
#[test]
fn name_and_schema() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
assert_eq!(tool.name(), "memory_store");
let schema = tool.parameters_schema();
@@ -210,7 +190,6 @@ mod tests {
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_core() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool
.execute(json!({"namespace": "global", "key": "lang", "content": "Prefers Rust"}))
@@ -231,7 +210,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_with_category() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool
.execute(
@@ -246,7 +224,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_with_custom_category() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool
.execute(
@@ -260,10 +237,7 @@ the tool resolves the bound driver rather than being handed a memory handle"]
.await
.expect("the stored memory is readable through the guard");
assert_eq!(entry.content, "Uses async runtime");
- assert_eq!(
- entry.category,
- EngineMemoryCategory::Custom("project".into())
- );
+ assert_eq!(entry.category, MemoryCategory::Custom("project".into()));
}
/// Regression: a `custom:<name>` wire value (the form `memory_recall` and
@@ -274,7 +248,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_strips_custom_prefix_from_wire_category() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool
.execute(json!({
@@ -292,7 +265,7 @@ the tool resolves the bound driver rather than being handed a memory handle"]
.expect("the stored memory is readable through the guard");
assert_eq!(
entry.category,
- EngineMemoryCategory::Custom("project".into()),
+ MemoryCategory::Custom("project".into()),
"the `custom:` wire prefix must be stripped, not double-stored"
);
}
@@ -301,7 +274,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_rejects_secret_like_content() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool
.execute(json!({
@@ -313,7 +285,7 @@ the tool resolves the bound driver rather than being handed a memory handle"]
.unwrap();
assert!(result.is_error);
assert!(result.output().contains("looks like a secret"));
- // Through the guard, not `test_mem()`: an absence assertion against a
+ // Through the guard — see `stored`: an absence assertion against a
// store the tool never writes to holds whether or not the refusal
// worked, which makes it worse than no assertion at all.
assert!(stored("global", "api").await.is_none());
@@ -323,7 +295,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_missing_key() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool.execute(json!({"content": "no key"})).await;
assert!(result.is_err());
@@ -333,7 +304,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_missing_content() {
- let (_tmp, _mem) = test_mem();
let tool = MemoryStoreTool::new(test_security());
let result = tool.execute(json!({"key": "no_content"})).await;
assert!(result.is_err());
@@ -343,7 +313,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_blocked_in_readonly_mode() {
- let (_tmp, _mem) = test_mem();
let readonly = Arc::new(SecurityPolicy {
autonomy: AutonomyLevel::ReadOnly,
..SecurityPolicy::default()
@@ -364,7 +333,6 @@ the tool resolves the bound driver rather than being handed a memory handle"]
#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \
the tool resolves the bound driver rather than being handed a memory handle"]
async fn store_blocked_when_rate_limited() {
- let (_tmp, _mem) = test_mem();
let limited = Arc::new(SecurityPolicy {
max_actions_per_hour: 0,
..SecurityPolicy::default()
diff --git a/src/openhuman/memory/tree/retrieval/mod.rs b/src/openhuman/memory/tree/retrieval/mod.rs
index 5d00b6d62b..3da77b65e4 100644
--- a/src/openhuman/memory/tree/retrieval/mod.rs
+++ b/src/openhuman/memory/tree/retrieval/mod.rs
@@ -5,6 +5,12 @@
//! `RpcOutcome` and `ControllerSchema`, which the engine crate cannot see.
//! The glob re-export keeps every historical `memory::tree::retrieval::…` path resolving.
+// Engine-owned, and the names are a trap worth naming: `RetrievalHit`,
+// `QueryResponse`, `NodeKind` and `EntityMatch` here are **not** the contract's
+// `RetrievalHit`, `RetrievalResponse`, `RetrievalNodeKind` and `EntityMatch`.
+// The engine's hit carries a `tree_kind` the contract's has no field for, so
+// repointing this shim at `memory::api::provider` is a wire change and not a
+// path swap. Probe the item identity before assuming a carve-out is free.
pub use tinymemory_core::tree::retrieval::*;
pub mod rpc;
diff --git a/src/openhuman/memory/tree/retrieval/rpc.rs b/src/openhuman/memory/tree/retrieval/rpc.rs
index 055c4aa210..f91ceac3e9 100644
--- a/src/openhuman/memory/tree/retrieval/rpc.rs
+++ b/src/openhuman/memory/tree/retrieval/rpc.rs
@@ -4,6 +4,32 @@
//! Shapes mirror the internal API — in particular, `QueryResponse` and
//! `Vec<RetrievalHit>` / `Vec<EntityMatch>` all serialise directly without
//! an extra envelope.
+//!
+//! # Why these five still call the engine when `MemoryRetrieval` exists
+//!
+//! The contract family covers every one of them member for member
+//! (`retrieve_source`, `cover_window`, `retrieve_children`, `retrieve_leaves`,
+//! `search_entities`), the pinned artifact serves them, and
+//! `memory::query::backend` — the agent-tool path over the *same* primitives —
+//! already goes through it. What stops these handlers following is the
+//! response body, not the seam.
+//!
+//! `QueryResponse` here is the engine's, and its `RetrievalHit` carries a
+//! `tree_kind` field that the contract's `RetrievalHit` does not have. It is
+//! serialised unconditionally, so routing through the family would silently
+//! drop a field from four public methods' output. `EntityMatch` is the
+//! opposite case and is safe: its `kind` is a `#[serde(rename_all =
+//! "snake_case")]` enum against the contract's open `String`, so the two encode
+//! identically — the whole delta is `tree_kind`.
+//!
+//! Migrating therefore means renegotiating the wire shape (or teaching the
+//! contract the field), which is a decision about the RPC surface rather than a
+//! routing change, and belongs in its own change.
+//!
+//! The `*_scoped` variants are deliberate and must stay: the ambient twins read
+//! the **engine's** task-local, which this host no longer sets, and an absent
+//! scope means unrestricted — a per-profile source gate failing open. See
+//! `memory::source_scope`.
use serde::{Deserialize, Serialize};
diff --git a/src/openhuman/memory/tree/tree/mod.rs b/src/openhuman/memory/tree/tree/mod.rs
index f7e3bf0954..845dfe8b6e 100644
--- a/src/openhuman/memory/tree/tree/mod.rs
+++ b/src/openhuman/memory/tree/tree/mod.rs
@@ -5,6 +5,12 @@
//! `RpcOutcome` and `ControllerSchema`, which the engine crate cannot see.
//! The glob re-export keeps every historical `memory::tree::tree::…` path resolving.
+// Engine-owned persistence types (`Tree`, `SummaryNode`, `Buffer`, `TreeKind`,
+// the seal/flush/registry mechanics). None of them is a contract item, and the
+// `TreeStatus` re-exported here is the engine's `store::trees` one — a
+// different type from the contract's `TreeStatus`, which the sibling
+// `tree_runtime` module exports. Two same-named types one module apart, so
+// check which one a call site means before moving it.
pub use tinymemory_core::tree::tree::*;
pub mod rpc;
diff --git a/src/openhuman/memory/tree/tree/rpc.rs b/src/openhuman/memory/tree/tree/rpc.rs
index 2d52e4af2f..47296ae6f1 100644
--- a/src/openhuman/memory/tree/tree/rpc.rs
+++ b/src/openhuman/memory/tree/tree/rpc.rs
@@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::openhuman::config::Config;
+use crate::openhuman::memory::api::provider::ChunkQuery;
use crate::rpc::RpcOutcome;
use tinycortex::memory::ingest::canonicalize::{
chat::ChatBatch, document::DocumentInput, email::EmailThread,
@@ -20,7 +21,6 @@ use tinymemory_core::ingest_pipeline::{
ingest_chat as do_ingest_chat, ingest_document as do_ingest_document,
ingest_email as do_ingest_email, IngestResult,
};
-use tinymemory_core::store::chunks::store::{self as chunk_store, ListChunksQuery};
/// Unified ingest request. The `payload` shape is adapter-specific and is
/// validated inside the dispatch based on `source_kind`.
@@ -186,11 +186,20 @@ pub struct ListChunksResponse {
/// `list_chunks` RPC handler. Filters and returns persisted chunks ordered by
/// timestamp DESC.
+///
+/// `scope` is `None`, which is not an oversight: this listing has never
+/// applied the per-turn source allowlist — the engine query it replaced set
+/// `source_scope: None` — and it is reached by inspection surfaces rather than
+/// by an agent turn. Narrowing it here would be a policy change wearing a
+/// routing change's clothes.
pub async fn list_chunks_rpc(
config: &Config,
req: ListChunksRequest,
) -> Result<RpcOutcome<ListChunksResponse>, String> {
- let query = ListChunksQuery {
+ // Parsed before the driver is resolved so an unknown kind stays a caller
+ // error naming the offending value, rather than a driver round trip that
+ // returns nothing and looks like an empty store.
+ let query = ChunkQuery {
source_kind: match req.source_kind.as_deref() {
None => None,
Some(s) => Some(SourceKind::parse(s)?),
@@ -201,16 +210,28 @@ pub async fn list_chunks_rpc(
until_ms: req.until_ms,
limit: req.limit,
offset: None,
- source_scope: None,
exclude_dropped: false,
};
- let rows = tokio::task::spawn_blocking({
- let config = config.clone();
- move || chunk_store::list_chunks(&config, &query)
- })
- .await
- .map_err(|e| format!("list_chunks join error: {e}"))?
- .map_err(|e| format!("list_chunks: {e}"))?;
+
+ // No `spawn_blocking`: the driver owns whether its own reads block, and the
+ // module's do not run on this thread at all.
+ let binding = crate::openhuman::memory::binding::for_config(config)?;
+ let rows = match binding.provider().as_chunks() {
+ Some(chunks) => chunks
+ .list_chunks(&query, None)
+ .await
+ .map_err(|e| format!("list_chunks: {e}"))?,
+ // Read-only, so an empty page is the honest answer: a driver with no
+ // chunk tier holds no rows to list, which is a true statement about it
+ // rather than a fault the caller can act on.
+ None => {
+ log::debug!(
+ "[memory-tree][rpc] list_chunks: driver '{}' does not serve Chunks; reporting empty",
+ binding.driver_id()
+ );
+ Vec::new()
+ }
+ };
let n = rows.len();
Ok(RpcOutcome::single_log(
@@ -236,14 +257,24 @@ pub async fn get_chunk_rpc(
config: &Config,
req: GetChunkRequest,
) -> Result<RpcOutcome<GetChunkResponse>, String> {
- let id = req.id.clone();
- let chunk = tokio::task::spawn_blocking({
- let config = config.clone();
- move || chunk_store::get_chunk(&config, &id)
- })
- .await
- .map_err(|e| format!("get_chunk join error: {e}"))?
- .map_err(|e| format!("get_chunk: {e}"))?;
+ let binding = crate::openhuman::memory::binding::for_config(config)?;
+ let chunk = match binding.provider().as_chunks() {
+ Some(chunks) => chunks
+ .get_chunk(&req.id)
+ .await
+ .map_err(|e| format!("get_chunk: {e}"))?,
+ // `None` is already this handler's answer for an id the store does not
+ // hold, and a driver with no chunk tier holds none — so the degrade is
+ // indistinguishable from the ordinary miss, which is what makes it safe
+ // here and not on a write.
+ None => {
+ log::debug!(
+ "[memory-tree][rpc] get_chunk: driver '{}' does not serve Chunks; reporting none",
+ binding.driver_id()
+ );
+ None
+ }
+ };
Ok(RpcOutcome::single_log(
GetChunkResponse { chunk },
format!("memory_tree: get_chunk id={}", req.id),
@@ -1249,8 +1280,21 @@ mod tests {
}
}
+ /// Ingest reports what it wrote.
+ ///
+ /// This used to read the chunks back through `list_chunks_rpc` /
+ /// `get_chunk_rpc` and assert the round trip. It cannot any more, and the
+ /// reason is the seam rather than the assertion: ingest is still the
+ /// in-process pipeline writing under `cfg.workspace_dir`, while the two
+ /// read handlers now ask the bound driver — which a unit test binds to the
+ /// shared test workspace, not to this tempdir. Asserting across the two
+ /// would be asserting that the two stores happen to coincide, which is
+ /// true in the product and deliberately not true here.
+ ///
+ /// The read side's own contract is pinned by
+ /// [`list_and_get_report_empty_when_the_driver_has_no_chunk_tier`].
#[tokio::test]
- async fn ingest_document_roundtrip_lists_and_gets_chunks() {
+ async fn ingest_document_reports_the_chunks_it_wrote() {
let (_tmp, cfg) = test_config();
let outcome = ingest_rpc(
&cfg,
@@ -1270,44 +1314,41 @@ mod tests {
.unwrap();
assert_eq!(outcome.value.source_id, "doc-launch");
assert_eq!(outcome.value.chunks_dropped, 0);
- assert!(!outcome.value.chunk_ids.is_empty());
+ assert!(outcome.value.chunks_written > 0);
+ assert!(
+ !outcome.value.chunk_ids.is_empty(),
+ "the ids are what a caller fetches a chunk back by, so a write \
+ that names none is unusable even when the count is right"
+ );
+ }
+
+ /// The listing degrades rather than fails when the bound driver has no
+ /// chunk tier.
+ ///
+ /// `FixedDiagnostics` is `NullMemoryProvider`-backed, so `as_chunks()` is
+ /// `None` — the shape of a driver that serves memory without exposing the
+ /// engine's storage model. The handler is read-only, and an empty page is a
+ /// true statement about such a driver, so it must not become a
+ /// caller-facing error. The log still has to report the count it served,
+ /// because a silent empty and a degraded empty look identical downstream.
+ #[tokio::test]
+ async fn list_chunks_reports_empty_when_the_driver_has_no_chunk_tier() {
+ let (_tmp, cfg) = test_config();
+ bind_diagnostics(&cfg, Default::default(), Default::default());
let listed = list_chunks_rpc(
&cfg,
ListChunksRequest {
source_kind: Some("document".into()),
source_id: Some("doc-launch".into()),
- owner: Some("alice".into()),
limit: Some(10),
..Default::default()
},
)
.await
- .unwrap()
- .value
- .chunks;
- assert_eq!(listed.len(), outcome.value.chunks_written);
- assert!(listed
- .iter()
- .all(|chunk| chunk.metadata.source_kind == SourceKind::Document));
- assert!(listed
- .iter()
- .any(|chunk| chunk.content.contains("Phoenix launch canary checklist")));
-
- let fetched = get_chunk_rpc(
- &cfg,
- GetChunkRequest {
- id: outcome.value.chunk_ids[0].clone(),
- },
- )
- .await
- .unwrap()
- .value
- .chunk
- .expect("chunk should exist");
- assert_eq!(fetched.id, outcome.value.chunk_ids[0]);
- assert_eq!(fetched.metadata.source_id, "doc-launch");
- assert_eq!(fetched.metadata.owner, "alice");
+ .expect("a driver without the chunk family is not an error");
+ assert!(listed.value.chunks.is_empty());
+ assert!(listed.logs[0].contains("n=0"), "log: {}", listed.logs[0]);
}
#[tokio::test]
@@ -1325,22 +1366,14 @@ mod tests {
let second = ingest_rpc(&cfg, req).await.unwrap().value;
assert!(first.chunks_written > 0);
assert!(!first.already_ingested);
+ // `already_ingested` with a zero write count is the whole claim:
+ // documents are append-only, so a repeat submission must be recognised
+ // rather than duplicated. Re-listing the store to confirm the count
+ // would now query the driver instead of the pipeline that wrote —
+ // see `ingest_document_reports_the_chunks_it_wrote`.
assert_eq!(second.chunks_written, 0);
assert!(second.already_ingested);
-
- let listed = list_chunks_rpc(
- &cfg,
- ListChunksRequest {
- source_id: Some("doc-dup".into()),
- limit: Some(10),
- ..Default::default()
- },
- )
- .await
- .unwrap()
- .value
- .chunks;
- assert_eq!(listed.len(), first.chunks_written);
+ assert_eq!(second.source_id, first.source_id);
}
/// Regression #3568 / CORE-2K: chat payloads with RFC-3339 timestamps must
@@ -1443,9 +1476,14 @@ mod tests {
assert!(err.contains("unknown source kind: nonsense"));
}
+ /// An id the driver cannot resolve is `Ok(None)`, never an error — and the
+ /// same is true of a driver with no chunk tier at all, which is why one
+ /// test covers both. The two cases are indistinguishable to a caller by
+ /// design: "no such chunk" is the honest answer to either.
#[tokio::test]
async fn get_chunk_returns_none_for_missing_id() {
let (_tmp, cfg) = test_config();
+ bind_diagnostics(&cfg, Default::default(), Default::default());
let outcome = get_chunk_rpc(
&cfg,
GetChunkRequest {
diff --git a/src/openhuman/memory/tree/tree_runtime/mod.rs b/src/openhuman/memory/tree/tree_runtime/mod.rs
index febf939c2d..d21eed461c 100644
--- a/src/openhuman/memory/tree/tree_runtime/mod.rs
+++ b/src/openhuman/memory/tree/tree_runtime/mod.rs
@@ -7,6 +7,20 @@
pub use tinymemory_core::tree::tree_runtime::*;
+// The summary-tree node model is **contract** vocabulary, not engine
+// vocabulary: it is defined in `tinymemory-bus` and the engine crate re-exports
+// the same items, so these names and the ones the glob above would supply are
+// one set of types, not two. Naming the contract explicitly (an explicit `use`
+// shadows a glob, and here it shadows it with itself) records which half of
+// this shim survives the engine leaving the build — and means the call sites on
+// `memory::tree::tree_runtime::estimate_tokens` and friends need no edit when
+// it does.
+pub use crate::openhuman::memory::api::tree as types;
+pub use crate::openhuman::memory::api::tree::{
+ derive_node_ids, derive_parent_id, estimate_tokens, level_from_node_id, node_id_to_path,
+ IngestRequest, NodeLevel, QueryResult, TreeNode, TreeStatus,
+};
+
pub mod ops;
pub mod schemas;
diff --git a/tests/memory_graph_sync_e2e.rs b/tests/memory_graph_sync_e2e.rs
index 9e911a10da..d77d785b0c 100644
--- a/tests/memory_graph_sync_e2e.rs
+++ b/tests/memory_graph_sync_e2e.rs
@@ -16,9 +16,10 @@ use tempfile::tempdir;
use openhuman_core::openhuman::inference::embeddings::NoopEmbedding;
use openhuman_core::openhuman::memory::{
- MemoryClient, MemoryIngestionConfig, MemoryIngestionRequest, NamespaceDocumentInput,
- UnifiedMemory,
+ MemoryIngestionConfig, MemoryIngestionRequest, NamespaceDocumentInput,
};
+// Engine handles named on the crate — see the note in `personality_e2e.rs`.
+use tinymemory_core::store::{MemoryClient, UnifiedMemory};
/// Test config for the heuristic-only pipeline.
fn ci_safe_config() -> MemoryIngestionConfig {
diff --git a/tests/personality_e2e.rs b/tests/personality_e2e.rs
index 255d1e9507..86c8788f7d 100644
--- a/tests/personality_e2e.rs
+++ b/tests/personality_e2e.rs
@@ -32,10 +32,15 @@ use openhuman_core::openhuman::agent::prompts::{
PromptSection, ToolCallFormat, UserFilesSection,
};
use openhuman_core::openhuman::inference::embeddings::NoopEmbedding;
-use openhuman_core::openhuman::memory::{NamespaceDocumentInput, UnifiedMemory};
+use openhuman_core::openhuman::memory::NamespaceDocumentInput;
+// The engine handle is named on the crate rather than reached through the
+// memory module's public surface: it is an in-process engine type, not
+// contract vocabulary, and the alias that used to re-export it existed for
+// callers that no longer exist (#5560).
use tinycortex::memory::conversations::{
ensure_thread, list_threads, update_thread_title, ConversationStore, CreateConversationThread,
};
+use tinymemory_core::store::UnifiedMemory;
// ─────────────────────────────────────────────────────────────────────────────
// Test helpers