🌊 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): restore logging when database directory creation fails
Dragan Spiridonovdc9b25121bf3
diff --git a/v3/@claude-flow/cli/__tests__/memory-bridge-creates-db-dir-4132.test.ts b/v3/@claude-flow/cli/__tests__/memory-bridge-creates-db-dir-4132.test.tsindex 01c6f262e4..f3c5ff790e 100644--- a/v3/@claude-flow/cli/__tests__/memory-bridge-creates-db-dir-4132.test.ts+++ b/v3/@claude-flow/cli/__tests__/memory-bridge-creates-db-dir-4132.test.ts@@ -6,7 +6,7 @@* on the volatile fallback while every store reported success.*/import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { existsSync, mkdtempSync, realpathSync, rmSync } from 'node:fs';+import { existsSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { dirname, join } from 'node:path';@@ -38,6 +38,17 @@ afterEach(async () => {});describe('#4132 the bridge creates the AgentDB directory before opening it', () => {+ it('restores console.log when directory creation fails', async () => {+ const parent = join(root, 'not-a-directory');+ writeFileSync(parent, 'fixture');+ const originalLog = console.log;+ try {+ expect(await bridge.getControllerRegistry(join(parent, 'agentdb-memory.db'))).toBeNull();+ expect(bridge.getBridgeFailureReason(join(parent, 'agentdb-memory.db'))).toBeTruthy();+ expect(console.log).toBe(originalLog);+ } finally { console.log = originalLog; }+ });+it('opens a database whose .swarm directory does not exist yet', async () => {const db = join(root, 'fresh-worktree', '.swarm', 'agentdb-memory.db');expect(existsSync(dirname(db))).toBe(false);diff --git a/v3/@claude-flow/cli/src/memory/memory-bridge.ts b/v3/@claude-flow/cli/src/memory/memory-bridge.tsindex b3e80334e9..82ceb8ee8b 100644--- a/v3/@claude-flow/cli/src/memory/memory-bridge.ts+++ b/v3/@claude-flow/cli/src/memory/memory-bridge.ts@@ -274,9 +274,8 @@ async function getRegistry(dbPath?: string): Promise<any | null> {// fresh checkout or worktree `.swarm/` does not exist yet, so AgentDB// failed to open, the degraded registry was cached for the server's// lifetime and hierarchical memory silently ran volatile.- if (resolvedPath !== ':memory:') mkdirSync(path.dirname(resolvedPath), { recursive: true });-try {+ if (resolvedPath !== ':memory:') mkdirSync(path.dirname(resolvedPath), { recursive: true });await (registry as any).initialize({// #2786: use agentdb-memory.db (plaintext) so native better-sqlite3 doesn't hit the encrypted memory.db.dbPath: resolvedPath,