The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(memory): add fallback guard for auto-recall memory operations
Steven Enamakelc5a435b13d4d
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex 875588ad4c..29a05c2270 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -267,20 +267,27 @@ tinymemory-bus = { path = "../../vendor/tinymemory/crates/tinymemory-bus" }# threads/messages, cross-thread inverted index). A pure library: serde,# parking_lot, uuid, chrono, async-trait, sha2. No SQLite/HTTP/engine crate.tinymemory-conversations = { path = "../../vendor/tinymemory/crates/tinymemory-conversations" }+# The fake memory drivers the host's tests bind in place of an in-process engine+# (openhuman#6161): `RecordingProvider` serves every optional family, so a+# handler that asks for one by accessor gets `Some`; `InMemoryProvider` retains+# and substring-recalls; `FixedRecallProvider` answers a constant recall. A+# regular dependency, not a dev-dependency, because `memory::guard::in_memory`+# is `pub` and compiled into the lib: the debug-build channel harness+# (`channels::runtime::test_support`, used by root integration targets that link+# the lib without `cfg(test)`) builds its guards through it.+#+# It costs this manifest nothing. The crate is `publish = false` and reached by+# path like `tinymemory-api`, and its only dependencies are `tinymemory-api`,+# `async-trait`, `serde_json` and `anyhow` — all already in the product graph.+# By construction it cannot pull an engine back in: `tinymemory-conformance`+# refuses to depend on `tinymemory-core`, and its CI asserts that.+tinymemory-conformance = { path = "../../vendor/tinymemory/crates/tinymemory-conformance" }# `tinymemory-guard` is the policy decorator over any `MemoryProvider`# (`GuardedProvider<P: GuardPolicy>`): the seven-step enforcement chain and the# per-family decorators. The facts it consults — the live `SecurityPolicy` tier,# the task-local source scope, the sanitizer, egress disclosure, the audit event# — stay here, behind `memory::guard::HostGuardPolicy`. Only `tinymemory-api`,# `async-trait`, `serde_json`, `chrono`, `log` and `tracing`, all already here.-# The in-memory reference drivers `memory::guard::in_memory` wraps in a real-# guard: `InMemoryProvider` (retains, substring recall) and `FixedRecallProvider`-# (constant recall). A regular dependency, not a dev-dependency, because that-# module is `pub` and compiled into the lib: the debug-build channel harness-# (`channels::runtime::test_support`, used by root integration targets that link-# the lib without `cfg(test)`) builds its guards through it. Only depends on-# `tinymemory-api`, `async-trait`, `serde_json` and `anyhow`, all already here.-tinymemory-conformance = { path = "../../vendor/tinymemory/crates/tinymemory-conformance" }tinymemory-guard = { path = "../../vendor/tinymemory/crates/tinymemory-guard" }# `tinymemory-sources` is the source registry, its types and its readers, in a# crate of its own. Taken directly rather than through `tinymemory-core`diff --git a/crates/openhuman-core/src/memory/auto_recall/auto_recall_tests.rs b/crates/openhuman-core/src/memory/auto_recall/auto_recall_tests.rsindex 75cfa9ce9a..6da8fa059c 100644--- a/crates/openhuman-core/src/memory/auto_recall/auto_recall_tests.rs+++ b/crates/openhuman-core/src/memory/auto_recall/auto_recall_tests.rs@@ -491,7 +491,7 @@ async fn from_guard_honours_the_hooks_switch() {auto_recall: false,..Default::default()};- let policy = crate::memory::guard::GuardPolicy::new(+ let policy = crate::memory::guard::HostGuardPolicy::new("recording",crate::core::subsystem::DriverClass::Embedded,hooks,diff --git a/crates/openhuman-core/src/memory/guard/mod.rs b/crates/openhuman-core/src/memory/guard/mod.rsindex d696cb8924..e5c69c3959 100644--- a/crates/openhuman-core/src/memory/guard/mod.rs+++ b/crates/openhuman-core/src/memory/guard/mod.rs@@ -108,10 +108,11 @@//! is the actual enforcement, this paragraph is not.mod audit;-/// In-memory provider fakes and guard-wrapping helpers for tests. The drivers-/// are `tinymemory-conformance`'s; only the host-policy wrapping lives here.-#[cfg(test)]-pub(crate) mod in_memory;+/// Guard-wrapping helpers over `tinymemory-conformance`'s in-memory drivers.+/// Not `#[cfg(test)]` — the debug-build channel harness and the root+/// integration targets link the lib without it.+#[doc(hidden)]+pub mod in_memory;pub mod policy;#[cfg(test)]diff --git a/crates/openhuman-core/src/memory/guard/policy_tests.rs b/crates/openhuman-core/src/memory/guard/policy_tests.rsindex 2286e4828e..3b189c5867 100644--- a/crates/openhuman-core/src/memory/guard/policy_tests.rs+++ b/crates/openhuman-core/src/memory/guard/policy_tests.rs@@ -3,6 +3,7 @@use super::*;use std::sync::Arc;+use crate::memory::api::types::MemoryTaint;use crate::memory::source_scope::with_source_scope;use crate::security::live_policy;use crate::security::policy::{AutonomyLevel, SecurityPolicy};diff --git a/crates/openhuman-core/src/memory/guard/provider_tests.rs b/crates/openhuman-core/src/memory/guard/provider_tests.rsindex f77ea597f5..3884888aa0 100644--- a/crates/openhuman-core/src/memory/guard/provider_tests.rs+++ b/crates/openhuman-core/src/memory/guard/provider_tests.rs@@ -6,7 +6,7 @@use std::sync::Arc;-use crate::memory::api::provider::{MemoryCore, MemoryProvider, MemoryRecall};+use crate::memory::api::provider::{MemoryCore, MemoryRecall};use crate::memory::api::recall::OwnedRecallOpts;use crate::memory::api::types::{MemoryCategory, MemoryTaint};diff --git a/crates/openhuman-core/src/memory/ops/fallback.rs b/crates/openhuman-core/src/memory/ops/fallback.rsindex 3982b92bd3..45c31c7c9c 100644--- a/crates/openhuman-core/src/memory/ops/fallback.rs+++ b/crates/openhuman-core/src/memory/ops/fallback.rs@@ -65,7 +65,7 @@ pub(crate) fn classify_for_engine(external: bool, message: String) -> String {pub(crate) fn classify_rpc_error(message: String) -> String {let external = crate::core::runtime::context::CoreContext::current().and_then(|ctx| ctx.memory().ok())- .is_none_or(|guard| guard.class() == crate::core::subsystem::DriverClass::External);+ .is_none_or(|guard| guard.policy().class() == crate::core::subsystem::DriverClass::External);classify_for_engine(external, message)}