Skip to content

fix(memory): use db.loadExtension() instead of sqliteVec.load() for n… - #74435

Closed
googlerest wants to merge 1 commit into
openclaw:mainfrom
googlerest:fix/sqlite-vec-node-sqlite-compat
Closed

googlerest wants to merge 1 commit into
openclaw:mainfrom
googlerest:fix/sqlite-vec-node-sqlite-compat

Conversation

@googlerest

Copy link
Copy Markdown
Contributor

Problem

sqliteVec.load(db) is a better-sqlite3 API. OpenClaw 2026.4.26 switched to node:sqlite (DatabaseSync), which does not support this method. This causes sqlite-vec to silently fail on all platforms, degrading vector recall to BM25-only.

Fix

Remove the sqliteVec.load(db) branch. Both code paths now call db.loadExtension(extensionPath), which node:sqlite supports natively.

Also removed the unused load method from the SqliteVecModule type definition.

Fixes #74401

…ode:sqlite compat

sqliteVec.load() is a better-sqlite3 API and is incompatible with the
node:sqlite DatabaseSync used in 2026.4.26. Both code paths now use
db.loadExtension(extensionPath) which node:sqlite supports.

Fixes openclaw#74401
@greptile-apps

greptile-apps Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a regression introduced in OpenClaw 2026.4.26 where switching from better-sqlite3 to node:sqlite (DatabaseSync) caused sqliteVec.load(db) to silently fail, degrading vector recall to BM25-only. The fix removes the conditional branch that called the better-sqlite3-only sqliteVec.load() method and always uses db.loadExtension(extensionPath) instead, which node:sqlite supports natively.

Confidence Score: 5/5

This PR is safe to merge — it correctly removes a dead code path that relied on a better-sqlite3-only API incompatible with the current node:sqlite backend.

The change is minimal (removing a single dead branch and updating the type definition), the logic is sound, and the fix directly addresses the described regression with no side effects.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(memory): use db.loadExtension() inst..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as duplicate/superseded: the PR targets the same degraded macOS sqlite-vec symptom already routed to open issue #66977, and its stated root cause is not supported by the current dependency contract. The published sqlite-vec helper already delegates to DatabaseSync.loadExtension(), so this one-file change does not address the remaining node:sqlite/macOS extension-loading boundary.

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Review details

Best possible solution:

Keep #66977 as the canonical macOS sqlite-vec/node:sqlite load tracker and solve that issue by validating a supported macOS runtime, changing the SQLite binding/loading strategy, or documenting the limitation and fallback behavior; this PR should not be the fix path.

What I checked:

  • PR diff surface: The branch changes only src/memory-host-sdk/host/sqlite-vec.ts, replacing the conditional sqliteVec.load/default-path branch with a direct loadExtension call and not touching workflows, dependency metadata, lockfiles, install scripts, or release scripts. (src/memory-host-sdk/host/sqlite-vec.ts:5, e96be1a09dfb)
  • Current main loader: Current main already enables extension loading and uses db.loadExtension for configured extensionPath overrides; the default path goes through sqliteVec.load(params.db). (src/memory-host-sdk/host/sqlite-vec.ts:27, a0300378d6ac)
  • Package-owned helper remains unchanged: The package-owned memory-host SDK helper has the same default-path sqliteVec.load(params.db) branch, so the PR's single src/ edit is not a complete package-surface cleanup even if maintainers wanted that refactor. (packages/memory-host-sdk/src/host/sqlite-vec.ts:25, a0300378d6ac)
  • sqlite-vec dependency contract: [email protected] declares load(db) for any object with loadExtension(file), and its published index.mjs implements load(db) as db.loadExtension(getLoadablePath()).
  • node:sqlite live shape: A local node:sqlite DatabaseSync instance exposes loadExtension and enableLoadExtension functions; the relevant OpenClaw boundary is extension loading support, not a missing DatabaseSync.load method.
  • Memory DB construction: Builtin memory opens DatabaseSync with the allowExtension option controlled by vector enablement, so the remaining macOS report belongs to node:sqlite/loadable-extension behavior rather than this sqliteVec.load wrapper. (extensions/memory-core/src/memory/manager-db.ts:10, a0300378d6ac)

Likely related people:

  • @steipete: Available history shows be8c246 adding the current memory-core manager DB path, sqlite-vec helper, and related sqlite-vec test coverage around the v2026.4.26 release snapshot. (role: introduced behavior and release-path maintainer; confidence: medium; commits: be8c24633aaa; files: extensions/memory-core/src/memory/manager-db.ts, packages/memory-host-sdk/src/host/sqlite-vec.ts, src/memory-host-sdk/host/sqlite-vec.ts)
  • @BunsDev: Current-main blame for the sqlite-vec helper, vector loader path, and sqlite-vec KNN test lines points to 88101e8 in the available history. (role: recent current-main maintainer; confidence: medium; commits: 88101e81efd4; files: extensions/memory-core/src/memory/manager-sync-ops.ts, packages/memory-host-sdk/src/host/sqlite-vec.ts, src/memory-host-sdk/host/sqlite-vec.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against a0300378d6ac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: sqlite-vec unavailable on node:sqlite — vector recall degraded (macOS ARM64, v2026.4.26)

1 participant