Skip to content

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

fix(memory): fall back to default chip for unknown brain values

Steven Enamakelec6e4cc01bb5
diff --git a/app/src/pages/Memory.tsx b/app/src/pages/Memory.tsx
index 9ac0ce8b2c..063e9136cc 100644
--- a/app/src/pages/Memory.tsx
+++ b/app/src/pages/Memory.tsx
@@ -102,9 +102,14 @@ export default function Memory() {
// Rewrite a legacy (or unknown) `?brain=` value to its canonical chip so the
// address bar, history and analytics all see the v2 name.
useEffect(() => {
- if (rawChip === null) return;
- if (requested && requested !== rawChip) setChip(requested, true);
- }, [rawChip, requested, setChip]);
+ if (!rawChip) return;
+ if (requested) {
+ if (requested !== rawChip) setChip(requested, true);
+ } else if (engine) {
+ // Unknown value: land on the default chip once it is known.
+ setChip('engine', true);
+ }
+ }, [rawChip, requested, engine, setChip]);
const headers: Record<MemoryChip, { title: string; description: string }> = {
engine: { title: t('memoryPage.tabs.engine'), description: t('memoryPage.header.engine') },
diff --git a/crates/openhuman-core/src/threads/ops/search_tests.rs b/crates/openhuman-core/src/threads/ops/search_tests.rs
index 9360dda948..ea2c32e434 100644
--- a/crates/openhuman-core/src/threads/ops/search_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/search_tests.rs
@@ -24,6 +24,16 @@ fn snippet_without_a_verbatim_match_is_the_start() {
assert!(out.ends_with('…'));
}
+#[test]
+fn snippet_matches_a_query_with_irregular_whitespace() {
+ let content = format!("{} needle nearby {}", "a".repeat(200), "b".repeat(200));
+ for q in ["needle nearby", "needle\nnearby"] {
+ let out = snippet(&content, q);
+ assert!(out.contains("needle nearby"), "{q:?} -> {out}");
+ assert!(out.starts_with('…'), "{q:?} should centre on the match: {out}");
+ }
+}
+
#[test]
fn request_limit_is_optional() {
let parsed: ThreadSearchRequest =