🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(memory): #2461 fall through when transformers fetch fails; null-guard generateLocalEmbedding; default namespace
ruvc22a12badbdf
diff --git a/v3/@claude-flow/cli/src/commands/memory.ts b/v3/@claude-flow/cli/src/commands/memory.tsindex fe0afe4fa4..23d0acaabf 100644--- a/v3/@claude-flow/cli/src/commands/memory.ts+++ b/v3/@claude-flow/cli/src/commands/memory.ts@@ -83,7 +83,9 @@ const storeCommand: Command = {action: async (ctx: CommandContext): Promise<CommandResult> => {const key = ctx.flags.key as string;let value = ctx.flags.value as string || ctx.args[0];- const namespace = ctx.flags.namespace as string;+ // #2461: without `|| 'default'`, omitting -n stores under the literal+ // string namespace "undefined" — silent data loss for first-time users.+ const namespace = (ctx.flags.namespace as string) || 'default';const ttl = ctx.flags.ttl as number;const tags = ctx.flags.tags ? (ctx.flags.tags as string).split(',') : [];const asVector = ctx.flags.vector as boolean;@@ -208,7 +210,9 @@ const retrieveCommand: Command = {],action: async (ctx: CommandContext): Promise<CommandResult> => {const key = ctx.flags.key as string || ctx.args[0];- const namespace = ctx.flags.namespace as string;+ // #2461: mirror the store-side default so `memory retrieve -k k` (no -n)+ // looks under "default" rather than the literal namespace "undefined".+ const namespace = (ctx.flags.namespace as string) || 'default';if (!key) {output.printError('Key is required');diff --git a/v3/@claude-flow/cli/src/memory/memory-initializer.ts b/v3/@claude-flow/cli/src/memory/memory-initializer.tsindex e6505f0c7c..def2180b90 100644--- a/v3/@claude-flow/cli/src/memory/memory-initializer.ts+++ b/v3/@claude-flow/cli/src/memory/memory-initializer.ts@@ -1733,24 +1733,42 @@ export async function loadEmbeddingModel(options?: {}if (pipelineFn && transformersSource) {- if (verbose) {- console.log(`Loading ONNX embedding model via ${transformersSource} (all-MiniLM-L6-v2)...`);- }- const embedder = await pipelineFn('feature-extraction', 'Xenova/all-MiniLM-L6-v2');+ // #2461: pipelineFn() can throw with `fetch failed` on Windows behind+ // a corporate proxy / strict firewall when transformers tries to pull+ // the model files from the HuggingFace CDN. Without the catch, that+ // throw escapes the outer try and aborts loadEmbeddingModel() with+ // success=false BEFORE we reach the (working) ruvector ONNX fallback+ // below — leaving embeddingModelState=null, which then crashes+ // generateLocalEmbedding() with "Cannot read properties of null+ // (reading 'model')" on every memory store / search call.+ try {+ if (verbose) {+ console.log(`Loading ONNX embedding model via ${transformersSource} (all-MiniLM-L6-v2)...`);+ }+ const embedder = await pipelineFn('feature-extraction', 'Xenova/all-MiniLM-L6-v2');- embeddingModelState = {- loaded: true,- model: embedder,- tokenizer: null,- dimensions: 384 // MiniLM-L6 produces 384-dim vectors- };+ embeddingModelState = {+ loaded: true,+ model: embedder,+ tokenizer: null,+ dimensions: 384 // MiniLM-L6 produces 384-dim vectors+ };- return {- success: true,- dimensions: 384,- modelName: 'Xenova/all-MiniLM-L6-v2',- loadTime: Date.now() - startTime- };+ return {+ success: true,+ dimensions: 384,+ modelName: 'Xenova/all-MiniLM-L6-v2',+ loadTime: Date.now() - startTime+ };+ } catch (err) {+ if (verbose) {+ console.warn(+ `${transformersSource} pipeline init failed (${err instanceof Error ? err.message : String(err)}); ` ++ 'falling through to ruvector ONNX / agentic-flow / hash fallback.'+ );+ }+ // Intentional fall-through to the next embedder branch.+ }}// Fallback: Check for agentic-flow ReasoningBank embeddings (v3)@@ -1923,7 +1941,18 @@ export async function generateLocalEmbedding(text: string): Promise<{await loadEmbeddingModel();}- const state = embeddingModelState!;+ // #2461: loadEmbeddingModel() can leave embeddingModelState null when an+ // earlier loader (transformers fetch, ruvector init) throws and we never+ // reach the hash-fallback assignment. Don't lie with a `!` non-null+ // assertion — fall back to a synthetic hash-fallback state so we degrade+ // to the deterministic 128-dim hash embedding instead of crashing the+ // entire memory store/search path with "reading property 'model' of null".+ const state = embeddingModelState ?? {+ loaded: true,+ model: null,+ tokenizer: null,+ dimensions: 128,+ };// Use ONNX model if availableif (state.model && typeof (state.model as any) === 'function') {