Commit Graph
3 Commits
Author SHA1 Message Date
Dragan Spiridonov c536e77fda fix(memory): reroute the stale-lock retry AgentDB too; memory 3.0.4
Rebased onto main, where ControllerRegistry and AgentDBBackend build AgentDB
inside withAgentdbLockRecovery(); useHostSqliteDriver() now runs inside that
closure right after each `new AgentDB`, so the instance a stale-lock retry
creates also opens its handle with getHostSqliteDriver(). Tests drive the
retry path for both sites.

@claude-flow/memory 3.0.3 was published by 3.56.3 without the driver, so
this ships as 3.0.4 and the CLI pins 3.0.4. The #3693 memory-owner test
now reports a skip when no native addon is available instead of passing.
2026-10-10 09:49:07 +02:00
Dragan Spiridonov d4458abdff fix(memory,cli): keep the CLI's better-sqlite3 handles on AgentDB's copy
Follow-up to the AgentDB driver change. shared-sqlite.ts (#3693/#3883)
resolved better-sqlite3 from agentdb's location so CLI handles share
AgentDB's native copy. With AgentDB now opened through
@claude-flow/memory's better-sqlite3, that put graph-edge-writer, the
memory-initializer repair paths, backup restore, distillation, tuning and
the attestation log back on agentdb's nested 11.x: `hooks post-task` still
loaded both addons (and aborted on Node 24), and mixing copies on one file
can delete the -wal/-shm sidecars under AgentDB's live handle.

- @claude-flow/memory exports getHostSqliteDriver(), the one source of the
  constructor; useHostSqliteDriver() opens AgentDB with it and reports
  whether it replaced the loader.
- shared-sqlite resolves better-sqlite3 from @claude-flow/memory when the
  installed memory carries agentdb-native-driver.js, else from agentdb as
  before, so either memory version keeps one copy per process.
- @claude-flow/memory 3.0.3, CLI pin 3.0.3 (leaf-publish gate).

Tests: identity between AgentDB's handle constructor and
loadBetterSqlite3(); #3693 owner model for the memory holder and the
pre-3.0.3 fallback; both AgentDB construction sites; routing against a
real nested copy; a drift guard on agentdb's initializeDatabase contract.
2026-10-10 09:44:50 +02:00
ruv 67261ac049 fix(memory): honest agentdb_pattern-store failures; share AgentDB's better-sqlite3 for graph writer (#3691, #3693)
- bridgeStorePattern no longer turns a bridgeStoreEntry {success:false} into a success receipt
- agentdb_pattern-store checks storeEntry's result in the registry-null fallback and refuses failed writes
- hooks pattern-store falls back to the direct store when the bridge write was refused
- graph writer, native recovery/repair and attestation open SQLite via the better-sqlite3 copy AgentDB resolves, so the idle close cannot strip a live AgentDB handle's WAL/SHM sidecars

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-10-07 00:28:39 -04:00