Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(memory): drop agentdb's stale "Falling back to mock embeddings" warning cluster

ruv844f68dbe5f2
diff --git a/v3/@claude-flow/cli/bin/cli.js b/v3/@claude-flow/cli/bin/cli.js
index 5896e492ca..7991e152d7 100755
--- a/v3/@claude-flow/cli/bin/cli.js
+++ b/v3/@claude-flow/cli/bin/cli.js
@@ -45,14 +45,42 @@ const _STDERR_REDIRECT_PREFIXES = [
'πŸš€ Initializing ',
'βœ… ',
];
+// agentdb's EmbeddingService.initialize() prints this cluster when
+// `@xenova/transformers` fails to load (commonly: macOS arm64 without
+// `brew install vips` β€” sharp can't resolve libvips). The warnings claim
+// agentdb is "falling back to mock embeddings", but memory-bridge.ts's
+// rescueAgentdbEmbedder swaps the embedder over to ruvector ONNX in
+// that exact case, so the user is NOT on mocks. The warnings are stale
+// and misleading; drop them. Match anchored to exact upstream prefixes
+// (agentdb/dist/controllers/EmbeddingService.js:48–56) so unrelated
+// warnings always flow through.
+const _AGENTDB_MOCK_FALLBACK_DROP_PREFIXES = [
+ 'Transformers.js initialization failed:',
+ ' Falling back to mock embeddings for testing',
+ ' This is normal if:',
+ ' - Running offline/without internet access',
+ ' - Model not yet downloaded',
+ ' - Network connectivity issues',
+ ' To use real embeddings:',
+ ' - Ensure internet connectivity for first',
+ ' - Or pre-download: npx agentdb',
+];
const _shouldRedirectToStderr = (msg) => {
for (const prefix of _STDERR_REDIRECT_PREFIXES) {
if (msg.startsWith(prefix)) return true;
}
return false;
};
+const _isAgentdbMockFallbackNoise = (msg) => {
+ for (const prefix of _AGENTDB_MOCK_FALLBACK_DROP_PREFIXES) {
+ if (msg.startsWith(prefix)) return true;
+ }
+ return false;
+};
console.warn = (...args) => {
- if (_isCosmeticAgentdbPatchNoise(String(args[0] ?? ''))) return;
+ const head = String(args[0] ?? '');
+ if (_isCosmeticAgentdbPatchNoise(head)) return;
+ if (_isAgentdbMockFallbackNoise(head)) return;
_origWarn.apply(console, args);
};
console.log = (...args) => {
diff --git a/v3/@claude-flow/cli/src/log-filters.ts b/v3/@claude-flow/cli/src/log-filters.ts
index 4807f64699..4eee3ff81b 100644
--- a/v3/@claude-flow/cli/src/log-filters.ts
+++ b/v3/@claude-flow/cli/src/log-filters.ts
@@ -1,5 +1,5 @@
/**
- * Console filter installed at the top of every entry point. Two jobs:
+ * Console filter installed at the top of every entry point. Three jobs:
*
* 1. Suppress the cosmetic "[AgentDB Patch] Controller index not found"
* warning emitted by agentic-flow's runtime patch (it expects agentdb
@@ -13,15 +13,26 @@
* parallel embedder) to stderr. The libraries use `console.log` for
* progress messages like "Loading model:" and " Downloading: ...",
* which corrupts MCP JSON-RPC stdio (#2253) and is generally noise on
- * stdout. We never want these on stdout β€” stderr is the right channel
- * for progress to a TTY user, and the MCP stdio framer reads stdout
- * only, so this keeps the protocol clean without dropping useful
- * diagnostics.
+ * stdout.
+ *
+ * 3. Suppress agentdb's mock-embedder-fallback warning cluster emitted by
+ * `agentdb/dist/controllers/EmbeddingService.js` lines 48–56 when
+ * transformers.js initialisation fails (commonly: macOS arm64 without
+ * `brew install vips` β€” sharp can't load `libvips-cpp.42.dylib`). The
+ * warnings advertise that agentdb is "falling back to mock embeddings"
+ * β€” but `memory-bridge.ts::rescueAgentdbEmbedder` monkey-patches
+ * agentdb's embedder to delegate to our working ruvector ONNX pipeline
+ * in that exact case, so the user is NOT actually on mock embeddings.
+ * Letting the warning through is misleading and gets reported as a
+ * bug (user-reported 2026-06-02, no GH issue). Suppression is safe
+ * because the rescue handles the underlying condition; if the rescue
+ * itself fails, the user still sees `[WARN] No results found` from
+ * the calling command which surfaces the real symptom.
*
* This file MUST be imported as the first side-effect import in any entry
- * point so the patch is in place before agentic-flow / ruvector (and
- * anything that transitively imports them) loads. ES module imports are
- * evaluated before the file's own top-level code, so putting this in
+ * point so the patch is in place before agentic-flow / ruvector / agentdb
+ * (and anything that transitively imports them) loads. ES module imports
+ * are evaluated before the file's own top-level code, so putting this in
* src/index.ts directly would race with transitive eager imports.
*/
@@ -44,6 +55,23 @@ const STDERR_REDIRECT_PREFIXES = [
' Disk cache hit: ', // ruvector-onnx-embeddings-wasm parallel-embedder.mjs
];
+// (3) Suppress the agentdb mock-embedder-fallback cluster. Each entry below
+// matches the EXACT prefix `console.warn` argument from
+// agentdb/dist/controllers/EmbeddingService.js:48–56. Keep this list
+// pinned to upstream lines, not broadened heuristically β€” broader filters
+// risk hiding real signals (audit_1776483149979 lesson).
+const AGENTDB_MOCK_FALLBACK_DROP_PREFIXES = [
+ 'Transformers.js initialization failed:', // line 48 β€” multi-line because the error has multi-line .message
+ ' Falling back to mock embeddings for testing', // line 49
+ ' This is normal if:', // line 50
+ ' - Running offline/without internet access', // line 51
+ ' - Model not yet downloaded', // line 52
+ ' - Network connectivity issues', // line 53
+ ' To use real embeddings:', // line 54
+ ' - Ensure internet connectivity for first', // line 55
+ ' - Or pre-download: npx agentdb', // line 56
+];
+
const shouldRedirectToStderr = (msg: unknown): boolean => {
const s = String(msg ?? '');
for (const prefix of STDERR_REDIRECT_PREFIXES) {
@@ -52,12 +80,21 @@ const shouldRedirectToStderr = (msg: unknown): boolean => {
return false;
};
+const isAgentdbMockFallbackNoise = (msg: unknown): boolean => {
+ const s = String(msg ?? '');
+ for (const prefix of AGENTDB_MOCK_FALLBACK_DROP_PREFIXES) {
+ if (s.startsWith(prefix)) return true;
+ }
+ return false;
+};
+
const origWarn = console.warn.bind(console);
const origLog = console.log.bind(console);
const origError = console.error.bind(console);
console.warn = (...args: unknown[]) => {
if (isCosmeticAgentdbPatchNoise(args[0])) return;
+ if (isAgentdbMockFallbackNoise(args[0])) return;
origWarn(...args);
};
console.log = (...args: unknown[]) => {