mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-09 22:13:39 +09:00
* fix(agentdb): surface degraded:true on the pattern-search/store fallback path Fixes #3288. agentdb_pattern-search and agentdb_pattern-store both return {success: true} (or a results array with no error field) when they've silently fallen back to the memory-store-fallback / substring-match path because the ReasoningBank controller is unavailable — the only signal was a free-text `note` string, which a caller has no structural reason to check on an apparently-successful response. Add degraded:true to both fallback return paths, matching the existing {degraded: true, reason} convention already used by agentbbs-tools.ts. The healthy ReasoningBank path is unaffected (no degraded field). Regression tests added to bug-cluster-2219-2226.test.ts, alongside the existing #2226 test for the same two handlers: assert degraded:true when controller === 'memory-store-fallback', and degraded === undefined otherwise. Both skip gracefully when the backend can't initialize in isolation, matching the file's existing convention. Does not address the underlying reason vectorBackend/reasoningBank are disabled in a given deployment (tracked separately in #1228/#2296) — this fix is scoped to making that state observable from the tool response shape, per the report's suggested fix direction. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01RYP825phHMjPRmmjkcAWpq * fix(agentdb): flag degraded at the controller boundary, not per fallback block Review caught a real gap in the first commit: bridgeStorePattern and bridgeSearchPatterns (memory-bridge.ts) return non-null with controller: 'bridge-fallback' when the registry exists but reasoningBank itself is unusable — this is the degraded state #3288 actually reported. That result flows through `if (result) return result;` / the results.length>0 early-return in agentdb-tools.ts, both of which sit BEFORE the memory-store-fallback blocks the previous commit patched, so agentdb_pattern-store never got flagged at all, and agentdb_pattern-search only got flagged when bridge-fallback happened to return zero results. Fix: check `result.controller === 'reasoningBank'` at both return boundaries instead of patching specific fallback-label blocks. Any other label — bridge-fallback, memory-store-fallback, or one added later — is degraded by definition, so this can't silently reopen the gap the way per-block matching just did. Also adds a `reason` field (stable, machine-checkable) alongside the existing `note` (human-readable), matching agentbbs-tools.ts's {degraded, reason} shape exactly rather than degraded-only. Tests inverted to match: assert degraded:true for every controller value EXCEPT 'reasoningBank', instead of asserting undefined for everything except the one label the previous commit patched — the old assertion would have made bridge-fallback's un-flagged state an enforced invariant, failing CI on a later correct fix. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01RYP825phHMjPRmmjkcAWpq