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): disable unsafe native bridge on Windows (#3024)

ruv3f285bfb26f3
diff --git a/v3/@claude-flow/cli/__tests__/memory-bridge-failure-diagnostics.test.ts b/v3/@claude-flow/cli/__tests__/memory-bridge-failure-diagnostics.test.ts
index 23b8f194d7..e56bae226c 100644
--- a/v3/@claude-flow/cli/__tests__/memory-bridge-failure-diagnostics.test.ts
+++ b/v3/@claude-flow/cli/__tests__/memory-bridge-failure-diagnostics.test.ts
@@ -78,6 +78,39 @@ describe('bridge failure diagnostics', () => {
});
});
+describe('#3024 Windows native-bridge safety gate', () => {
+ it('disables the native bridge on Windows by default', async () => {
+ const { shouldDisableNativeBridge } = await import('../src/memory/memory-bridge.js');
+
+ expect(shouldDisableNativeBridge('win32', {})).toBe(true);
+ });
+
+ it('allows an explicit Windows diagnostic opt-in', async () => {
+ const { shouldDisableNativeBridge } = await import('../src/memory/memory-bridge.js');
+
+ expect(shouldDisableNativeBridge('win32', {
+ CLAUDE_FLOW_ENABLE_NATIVE_BRIDGE_ON_WINDOWS: '1',
+ })).toBe(false);
+ });
+
+ it('keeps the explicit disable flag authoritative on every platform', async () => {
+ const { shouldDisableNativeBridge } = await import('../src/memory/memory-bridge.js');
+
+ expect(shouldDisableNativeBridge('linux', { CLAUDE_FLOW_DISABLE_BRIDGE: '1' })).toBe(true);
+ expect(shouldDisableNativeBridge('win32', {
+ CLAUDE_FLOW_DISABLE_BRIDGE: '1',
+ CLAUDE_FLOW_ENABLE_NATIVE_BRIDGE_ON_WINDOWS: '1',
+ })).toBe(true);
+ });
+
+ it('leaves the native bridge enabled by default off Windows', async () => {
+ const { shouldDisableNativeBridge } = await import('../src/memory/memory-bridge.js');
+
+ expect(shouldDisableNativeBridge('linux', {})).toBe(false);
+ expect(shouldDisableNativeBridge('darwin', {})).toBe(false);
+ });
+});
+
describe('init log suppression', () => {
it('should suppress a noisy init banner', async () => {
const { shouldSuppressInitLog } = await import('../src/memory/memory-bridge.js');
diff --git a/v3/@claude-flow/cli/src/memory/memory-bridge.ts b/v3/@claude-flow/cli/src/memory/memory-bridge.ts
index 5d3a75f1f1..fe4761f5eb 100644
--- a/v3/@claude-flow/cli/src/memory/memory-bridge.ts
+++ b/v3/@claude-flow/cli/src/memory/memory-bridge.ts
@@ -42,6 +42,21 @@ const ACTIVE_MEMORY_ROW_SQL = `(status = 'active' OR status IS NULL)`;
*/
let bridgeFailureReason: string | null = null;
+/**
+ * #3024: AgentDB's optional native controller stack can abort the whole Node
+ * process on Windows during registry initialization (a Rust allocation panic),
+ * which cannot be caught by JavaScript. Keep the CLI/MCP server on the
+ * sql.js + local-embedding path there until the native dependency is proven
+ * safe. Advanced users and CI can opt back in explicitly for diagnosis.
+ */
+export function shouldDisableNativeBridge(
+ platform: NodeJS.Platform = process.platform,
+ env: NodeJS.ProcessEnv = process.env,
+): boolean {
+ if (env.CLAUDE_FLOW_DISABLE_BRIDGE === '1') return true;
+ return platform === 'win32' && env.CLAUDE_FLOW_ENABLE_NATIVE_BRIDGE_ON_WINDOWS !== '1';
+}
+
/**
* ADR-323: reuse memory-initializer's provenance-type allowlist rather than
* duplicating it (drift risk). Lazy CJS require for the same circular-ESM-
@@ -158,6 +173,12 @@ export function shouldSuppressInitLog(msg: string): boolean {
* Returns null if @claude-flow/memory is not available.
*/
async function getRegistry(dbPath?: string): Promise<any | null> {
+ if (shouldDisableNativeBridge()) {
+ bridgeFailureReason = process.platform === 'win32'
+ ? 'AgentDB native bridge disabled on Windows after #3024; set CLAUDE_FLOW_ENABLE_NATIVE_BRIDGE_ON_WINDOWS=1 to opt in'
+ : 'AgentDB native bridge disabled by CLAUDE_FLOW_DISABLE_BRIDGE=1';
+ return null;
+ }
if (bridgeAvailable === false) return null;
if (registryInstance) return registryInstance;