v3.13.1
ruvnet/ruflov3.13.1Jun 22, 2026by ruvnet
AI Summary
Fixes critical memory leaks and database corruption issues related to sql.js MEMFS usage and graph-edge dual-write race conditions.
Key Highlights
- Fixes unbounded sql.js MEMFS leak (~36 GB observed)
- Fixes graph-edge dual-write corruption causing malformed databases
- Switches edge writes from sql.js to better-sqlite3 with WAL mode
New Features
- Memory leak fix (MEMFS)
- Database corruption fix
- Migration to better-sqlite3 for edge writes
Full Release Notes
## š§ Bug-fix release ### #2432 ā Unbounded sql.js MEMFS leak (HIGH, ~36 GB observed) \`ControllerRegistry.initController()\` was calling \`controllers.set(name, ...)\` without closing the prior instance. \`SqlJsRvfBackend\` wrappers held an Emscripten MEMFS file (~11 MB each = sizeof \`memory.db\`) that only releases on explicit \`.close()\` ā JS GC of the wrapper does NOT reclaim MEMFS because the sql.js module is a process singleton. **Fix:** added \`closePriorIfAny(name)\` helper, called before every \`controllers.set()\` site. Best-effort close (catches errors so replacement always proceeds). ### #2431 ā graph-edge-writer dual-write corrupts memory.db (HIGH, ADR-130 regression) \`graph-edge-writer.ts\` opened sql.js, did in-memory writes, then called \`fs.writeFileSync(dbPath, db.export())\` after every edge insert. The whole-file flush overwrote \`memory.db\` while the better-sqlite3 bridge was actively writing through its WAL ā the exact dual-write race ADR-068 (#1257) removed. **Symptom:** \`PRAGMA integrity_check\` returns \`database disk image is malformed (11)\` after one \`memory_store\` + \`causal-edge\` sequence. **Fix:** ported from sql.js to better-sqlite3 + WAL mode. Same native engine as the bridge ā no whole-file fsync ā no race. Public API unchanged. Smoke-tested: 50 concurrent \`insertGraphEdge()\` calls + \`PRAGMA integrity_check\` ā \`ok\`. > Note: this is the minimum-safe fix. The architecturally cleaner fix (route edge writes through the bridge's controller layer per ADR-068) is deferred to a future ADR. ### Distribution | Package | latest | alpha | v3alpha | |---|---|---|---| | \`@claude-flow/memory\` | 3.0.0-alpha.21 | 3.0.0-alpha.21 | 3.0.0-alpha.21 | | \`@claude-flow/cli\` | 3.13.1 | 3.13.1 | 3.13.1 | | \`claude-flow\` | 3.13.1 | 3.13.1 | 3.13.1 | | \`ruflo\` | 3.13.1 | 3.13.1 | 3.13.1 | ### Upgrade \`\`\`bash npx ruflo@latest # picks up 3.13.1 npx claude-flow@latest # picks up 3.13.1 \`\`\` ### Cross-references - š PR #2444 (this release) - š Issue #2432 (MEMFS leak, closed) - š Issue #2431 (dual-write corruption, closed) - š Companion #2443 (v3.13.0 doctor fix, merged) - š Related ADR-068 / ADR-130 (architectural context) --- š¤ Generated with [RuFlo](https://github.com/ruvnet/ruflo)