Skip to content

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

fix(memory): address CodeRabbit review on #5725\n\nFour real fixes and one stale-comment update:\n\n- guard/families.rs: apply redact_outbound to turn.content and\n event.content in GuardedEpisodic::insert_turn/insert_event, matching\n the pattern already in place for ingest_document — episodic content\n is user-authored conversation text and must be scrubbed on egress.\n\n- effect_executor.rs: route evict ingest through binding.guard()\n instead of binding.provider(), so policy (redaction, taint stamping)\n applies to evicted summaries the same way it applies to explicit\n ingest calls.\n\n- cli_capability.rs: make legacy_client_unavailable_message class-aware\n so Null (no driver configured) and External (remote store) get\n accurate descriptions rather than the same "answers from somewhere\n else" message.\n\n- preferences/mod.rs: filter out empty values in\n recall_situational_preferences_on, mirroring the filter already in\n the recall_by_vector helper used by the MemoryGuard path.\n\n- ops/provider.rs: update stale comment that still said "seventeen\n families" and "episodic alone stays withheld"; both are no longer\n true since as_episodic landed in this PR.\n

shanud2c36adbe123
diff --git a/src/core/cli_capability.rs b/src/core/cli_capability.rs
index f0adafd7df..4dc9a42cf8 100644
--- a/src/core/cli_capability.rs
+++ b/src/core/cli_capability.rs
@@ -76,13 +76,29 @@ pub fn capability_unavailable_message(
/// capability one: a null or external binding does not necessarily lack the
/// family — the legacy command is unavailable because it operates on the
/// embedded engine directly, and the bound driver is not that engine.
-pub fn legacy_client_unavailable_message(driver_id: &str, invocation: &str) -> String {
+///
+/// The `class` parameter tailors the explanation: a `Null` driver is
+/// unconfigured (no external source), while an `External` one answers from
+/// a remote store — both refuse legacy subcommands for the same structural
+/// reason but deserve different descriptions.
+pub fn legacy_client_unavailable_message(
+ driver_id: &str,
+ class: DriverClass,
+ invocation: &str,
+) -> String {
+ let detail = if class == DriverClass::Null {
+ "no memory driver is configured".to_string()
+ } else {
+ format!(
+ "this configuration bound a driver (`{driver_id}`) that answers from \
+ a remote store, not this machine's embedded engine"
+ )
+ };
format!(
"{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.",
+ directly, and {detail}. Run `openhuman subsystems` to see the bound driver, \
+ or change `[subsystems.memory] driver` in your config.",
)
}
@@ -222,7 +238,9 @@ pub fn legacy_client_verdict(driver_id: &str, class: DriverClass, invocation: &s
class={} — not the embedded engine",
class.as_str()
);
- anyhow::bail!(legacy_client_unavailable_message(driver_id, invocation))
+ anyhow::bail!(legacy_client_unavailable_message(
+ driver_id, class, invocation
+ ))
}
#[cfg(test)]
diff --git a/src/core/memory_cli.rs b/src/core/memory_cli.rs
index a2f1854b22..81cb957cf3 100644
--- a/src/core/memory_cli.rs
+++ b/src/core/memory_cli.rs
@@ -834,8 +834,10 @@ mod tests {
/// The legacy-client diagnostic must not leak credentials or endpoints.
#[test]
fn legacy_message_never_contains_a_credential_or_endpoint() {
+ use crate::core::subsystem::DriverClass;
let msg = crate::core::cli_capability::legacy_client_unavailable_message(
"supermemory",
+ DriverClass::External,
"openhuman memory clear",
);
assert!(!msg.contains("keychain:"), "{msg}");
diff --git a/src/openhuman/hosted/orchestration/effect_executor.rs b/src/openhuman/hosted/orchestration/effect_executor.rs
index 2560748032..2bbcde4b97 100644
--- a/src/openhuman/hosted/orchestration/effect_executor.rs
+++ b/src/openhuman/hosted/orchestration/effect_executor.rs
@@ -780,6 +780,7 @@ fn evict_source_id(session_id: &str, cycle_id: &str) -> String {
pub async fn execute_evict(effect: &EvictEffect) -> Result<(), String> {
use crate::openhuman::memory::api::chunks::{DataSource, SourceRef};
use crate::openhuman::memory::api::provider::types::IngestItem;
+ use crate::openhuman::memory::api::provider::MemoryProvider;
use crate::openhuman::memory::api::types::MemoryTaint;
let config = crate::openhuman::config::Config::load_or_init()
@@ -790,7 +791,10 @@ pub async fn execute_evict(effect: &EvictEffect) -> Result<(), String> {
// 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 {
+ // Routed through the guard so policy (redaction, taint stamping) applies
+ // to evicted summaries the same way it applies to explicit ingest calls.
+ let guard = binding.guard();
+ let Some(ingest) = guard.as_ingest() else {
return Err(format!(
"evict ingest: driver '{}' does not serve the Ingest family",
binding.driver_id()
diff --git a/src/openhuman/memory/guard/families.rs b/src/openhuman/memory/guard/families.rs
index 852484e88b..f2f89b8f34 100644
--- a/src/openhuman/memory/guard/families.rs
+++ b/src/openhuman/memory/guard/families.rs
@@ -1150,7 +1150,9 @@ impl MemoryEpisodic for GuardedEpisodic {
NO_NAMESPACE,
false,
)?;
- self.family()?.insert_turn(turn).await
+ let mut turn = turn.clone();
+ turn.content = self.policy.redact_outbound(&turn.content).into_owned();
+ self.family()?.insert_turn(&turn).await
}
async fn session_turns(&self, session_id: &str) -> Result<Vec<EpisodicTurn>, MemoryError> {
@@ -1239,7 +1241,9 @@ impl MemoryEpisodic for GuardedEpisodic {
&event.namespace,
false,
)?;
- self.family()?.insert_event(event).await
+ let mut event = event.clone();
+ event.content = self.policy.redact_outbound(&event.content).into_owned();
+ self.family()?.insert_event(&event).await
}
async fn close_segment(&self, segment_id: &str, now: f64) -> Result<(), MemoryError> {
diff --git a/src/openhuman/memory/ops/provider.rs b/src/openhuman/memory/ops/provider.rs
index b72f7de99a..c66025cb08 100644
--- a/src/openhuman/memory/ops/provider.rs
+++ b/src/openhuman/memory/ops/provider.rs
@@ -168,25 +168,19 @@ mod tests {
crate::openhuman::memory::api::CONTRACT_VERSION
)
);
- // The seventeen families the pinned v1.2.0 tinymemory artifact actually
- // serves — not the eighteen the contract crate declares. This used to
- // assert all eighteen, including `chunks`, `episodic`, `people`,
- // `profile`, and `retrieval`; that encoded #5598 as expected: those
- // five had no bus member in the pre-v1.2.0 release, so calling them
- // answered `UnknownMethod` rather than reporting themselves absent.
- // The v1.2.0 re-pin gave `chunks`, `people`, `profile` and `retrieval`
- // bus members, widening the boundary from thirteen to seventeen;
- // `episodic` alone stays withheld, because the artifact serves it but
- // `ModuleMemoryProvider` has no `as_episodic`, so advertising it would
- // be the same over-claim in a different coat.
- // `modules::memory::ARTIFACT_CAPABILITIES` was narrowed to match what
- // is actually served (see its module docs); this pins the same
- // corrected boundary. Spelled out rather than derived from
- // `Capabilities::all()` on purpose: this is the wire surface the
- // frontend reads, so the strings themselves are the assertion. A
- // family the pinned artifact starts serving should widen this
- // deliberately, together with the registry version bump — not
- // silently.
+ // The full eighteen families the pinned tinymemory artifact serves.
+ // Previously this comment documented a narrower set (seventeen, then
+ // thirteen) while the host under-claimed or over-claimed; the gap is
+ // now closed: v1.4.0 serves all eighteen, `ModuleMemoryProvider`
+ // implements all eighteen accessors including `as_episodic`, so the
+ // wire surface and the advertised set agree.
+ // `modules::memory::ARTIFACT_CAPABILITIES` is the machine-checked
+ // source of truth for what the pinned release serves (see its module
+ // docs); this pins the same corrected boundary. Spelled out rather
+ // than derived from `Capabilities::all()` on purpose: this is the
+ // wire surface the frontend reads, so the strings themselves are the
+ // assertion. A NEW contract family must still widen this deliberately,
+ // together with the registry version bump — not silently.
assert_eq!(
status.capabilities,
vec![
diff --git a/src/openhuman/memory/preferences/mod.rs b/src/openhuman/memory/preferences/mod.rs
index 5a8ace0f7d..b856fb3d6b 100644
--- a/src/openhuman/memory/preferences/mod.rs
+++ b/src/openhuman/memory/preferences/mod.rs
@@ -185,6 +185,7 @@ pub async fn recall_situational_preferences_on(
.unwrap_or_default()
.into_iter()
.map(|(_topic, value)| value)
+ .filter(|value| !value.trim().is_empty())
.collect()
}