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
fix(memory): handle missing preferences gracefully in auto-recall
Steven Enamakel488305194fba
diff --git a/crates/openhuman-core/src/memory/auto_recall/source.rs b/crates/openhuman-core/src/memory/auto_recall/source.rsindex a736a5efb0..3dd412fcb0 100644--- a/crates/openhuman-core/src/memory/auto_recall/source.rs+++ b/crates/openhuman-core/src/memory/auto_recall/source.rs@@ -85,12 +85,20 @@ impl AutoRecallSource for GuardSource {query: &str,limit: usize,) -> Result<Vec<NamespaceMemoryHit>, MemoryError> {- // Same degradation as the tree leg: no retrieval family, no notes.+ // No retrieval family (a remote engine): the notes still come from the+ // mandatory ranked recall. Only the tree leg has no equivalent.let Some(retrieval) = self.guard.as_retrieval() else {log::debug!(- "[auto_recall] bound driver exposes no retrieval family; no notes to recall"+ "[auto_recall] bound driver exposes no retrieval family; notes via mandatory recall");- return Ok(Vec::new());+ return crate::memory::ops::fallback::recall_hits(+ self.guard.as_ref(),+ namespace,+ query,+ limit,+ )+ .await+ .map_err(MemoryError::other);};// No session to exclude: the notes namespace is never auto-saved per// session, and the lane runs before this turn is archived, so there isdiff --git a/crates/openhuman-core/src/memory/ops/fallback.rs b/crates/openhuman-core/src/memory/ops/fallback.rsindex 46edfd7b31..d19caa907c 100644--- a/crates/openhuman-core/src/memory/ops/fallback.rs+++ b/crates/openhuman-core/src/memory/ops/fallback.rs@@ -64,7 +64,10 @@ pub(crate) fn entry_to_hit(entry: MemoryEntry, namespace: &str) -> NamespaceMemoscore,score_breakdown: RetrievalScoreBreakdown {keyword_relevance: 0.0,- vector_similarity: 0.0,+ // A remote engine reports one relevance score. It stands in for the+ // vector component so the relevance floors that gate auto-injected+ // context (`select_notes`, `recall_by_vector_over`) can still apply.+ vector_similarity: score,graph_relevance: 0.0,episodic_relevance: 0.0,freshness: 0.0,@@ -88,8 +91,8 @@ pub(crate) async fn namespace_names(guard: &MemoryGuard) -> Result<Vec<String>,}/// Ranked hits via `MemoryRecall::recall`, scoped to `namespace`.-pub(crate) async fn recall_hits(- guard: &MemoryGuard,+pub(crate) async fn recall_hits<P: MemoryRecall + ?Sized>(+ guard: &P,namespace: &str,query: &str,limit: usize,diff --git a/crates/openhuman-core/src/memory/preferences/mod.rs b/crates/openhuman-core/src/memory/preferences/mod.rsindex 4cdfd7aa8d..682b19fab2 100644--- a/crates/openhuman-core/src/memory/preferences/mod.rs+++ b/crates/openhuman-core/src/memory/preferences/mod.rs@@ -80,8 +80,7 @@ pub const CONTRADICTION_SIMILARITY: f64 = 0.6;/// This is the one body behind both doors into Lane B: the guard path/// ([`recall_by_vector`], used by the contradiction check) and the session's/// `Memory` handle (`DriverMemory::recall_relevant_by_vector`, #6041). A driver-/// without the retrieval family answers empty — the documented degradation —-/// while a driver that has it and fails answers `Err`, so each caller decides+/// without the retrieval family answers through the mandatory `recall`, while a driver that has it and fails answers `Err`, so each caller decides/// what an error means for its turn.pub(crate) async fn recall_by_vector_over(provider: &dyn MemoryProvider,@@ -90,13 +89,19 @@ pub(crate) async fn recall_by_vector_over(limit: usize,min_vector_similarity: f64,) -> Result<Vec<(String, String)>, MemoryError> {- let Some(retrieval) = provider.as_retrieval() else {- return Ok(Vec::new());- };let started = std::time::Instant::now();- let hits = retrieval- .recall_namespace_scored(namespace, query, limit, None)- .await?;+ let hits = match provider.as_retrieval() {+ Some(retrieval) => {+ retrieval+ .recall_namespace_scored(namespace, query, limit, None)+ .await?+ }+ // No retrieval family (a remote engine): the mandatory ranked recall+ // answers, so Lane B still works instead of injecting nothing.+ None => crate::memory::ops::fallback::recall_hits(provider, namespace, query, limit)+ .await+ .map_err(MemoryError::other)?,+ };// The floor is "tunable against live data", and this line is that data:// how close the best candidate came, whether or not it cleared. Keys and// scores only — never the preference text or the message.