Repository navigation
fix(memory): replace node:sqlite with better-sqlite3 to enable sqlite-vec on macOS - #90323
googlerest wants to merge 3 commits into
Conversation
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes are blockedOpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph. Detected dependency graph changes:
Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:
Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed. To remove lockfile changes, restore them from the target branch: git fetch origin
git checkout 'origin/main' -- 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git pushIf this PR intentionally needs a dependency graph change, ask a repository admin or member of The action will approve the current head SHA ( |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Codex review: needs real behavior proof before merge. Reviewed June 21, 2026, 2:27 PM ET / 18:27 UTC. Summary PR surface: Source -14, Tests +46, Config +4, Other +168. Total +204 across 19 files. Reproducibility: yes. for the PR blockers: source and CI show dangling DatabaseSync references, an ExecDb type missing prepare(), and missing SDK exports. The original macOS sqlite-vec failure is source-plausible and supported by issue/proof comments, but this Linux checkout did not live-reproduce the macOS Node SQLite compile-option failure. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Maintainers should first approve or reject the better-sqlite3 backend direction, then require the branch to fix the SDK/type/package blockers, update the shipped dependency graph, and provide redacted macOS OpenClaw memory index/status/search proof. Do we have a high-confidence way to reproduce the issue? Yes for the PR blockers: source and CI show dangling DatabaseSync references, an ExecDb type missing prepare(), and missing SDK exports. The original macOS sqlite-vec failure is source-plausible and supported by issue/proof comments, but this Linux checkout did not live-reproduce the macOS Node SQLite compile-option failure. Is this the best way to solve the issue? No as currently shaped. Replacing node:sqlite with better-sqlite3 is a plausible mitigation, but the current patch is not the best mergeable form until the SDK/package/type blockers and native dependency approval path are resolved. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bda05dbc2f15. Label changesLabel justifications:
Evidence reviewedPR surface: Source -14, Tests +46, Config +4, Other +168. Total +204 across 19 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Updated real behavior proof — current head 8828988aeeEnvironment: macOS arm64 (M4), Node v25.9.0, branch Results: System: arm64 / Node v25.9.0. sqlite-vec loads into real better-sqlite3 on macOS arm64. vec_version() callable. This proves the fix: node:sqlite OMIT_LOAD_EXTENSION=1 no longer blocks extension loading. Note: Dependency Guard is still failing — needs @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@openclaw/openclaw-secops — this PR needs |
8828988 to
c4b2877
Compare
Preserves upstream/main additions (cleanupAgedMemoryReindexTempFiles, double-open safety, reindex lock, NFS WAL detection) while applying PR openclaw#90323 changes: - MemoryDb interface backed by better-sqlite3 - requireBetterSqlite3 replaces requireNodeSqlite in memory paths - Remove allowExtension param (better-sqlite3 always supports loadExtension) - Remove enableLoadExtension(true) call from sqlite-vec - Set allowBuilds.better-sqlite3 = true in pnpm-workspace.yaml
…e-vec on macOS Verifies that better-sqlite3 can call loadExtension() without needing enableLoadExtension(), and that vec_version() is callable after load.
bb34875 to
6e15dfb
Compare
|
Behavior addressed: re-verified whether Real environment tested: macOS arm64 (M4), Darwin 25.5.0, Node v25.9.0 — same environment and same Node version originally used for this PR's "Real behavior proof". Exact steps or command run after this patch: Evidence after fix: Observed result after fix: confirmed the bug reproduces exactly as described when
This PR's premise ("no runtime workaround exists") does not hold against current What was not tested: did not re-run the PR's own Closing as superseded by |
Summary
Fixes #66977.
node:sqliteon macOS is compiled withOMIT_LOAD_EXTENSION=1, makingenableLoadExtension(true)throw unconditionally at runtime. This preventssqlite-vecfrom loading, leaving all embedding arrays empty ([]) and disabling vector similarity search for all macOS users. FTS5 keyword search still works, but hybrid/vector ranking is completely unavailable.Root cause: compile-time SQLite flag — no runtime workaround exists.
Fix: replace
node:sqlitewithbetter-sqlite3in the memory subsystem.better-sqlite3ships its own SQLite binary compiled withoutOMIT_LOAD_EXTENSION, and exposesdb.loadExtension()directly without needing a separateenableLoadExtension()guard.Changes
packages/memory-host-sdk— addbetter-sqlite3dep; introduceMemoryDb/MemoryStatementinterfaces; addrequireBetterSqlite3(); removeenableLoadExtension(true)fromloadSqliteVecExtension()src/infra/sqlite-wal.ts— widendbparam fromDatabaseSyncto{ exec(sql): unknown }so both backends satisfy the typemanager-db,manager-sync-ops,manager-search,memory-schema,qmd-manager, and related) — replaceDatabaseSync/SQLInputValuerefs withMemoryDb/unknown[]pnpm-workspace.yaml— allowbetter-sqlite3build scriptsReal behavior proof
Behavior or issue addressed: On macOS,
node:sqliteis compiled withOMIT_LOAD_EXTENSION=1. Callingdb.enableLoadExtension(true)throwsError: This API is unavailable when SQLite is not compiled with OMIT_LOAD_EXTENSION=0. After this patch,better-sqlite3is used instead, which ships its own SQLite binary compiled without that restriction, allowingsqlite-vecto load successfully.Real environment tested: Local macOS M4 (darwin arm64, Node v25.9.0), branch
fix/memory-sqlite-vec-macos-extension-loading,~/openclaw-dev/.Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix:
sqlite-vecloads successfully into a real better-sqlite3 in-memory database on macOS.vec_version()is callable and returns the loaded extension version. The integration test that exercises the actual extension loading path passes.What was not tested: Live OpenClaw memory session with real conversation data (no live credentials in test environment). The
dependency-guardcheck blocks this PR due to policy requiring maintainer sign-off on new external dependencies (better-sqlite3inpackages/memory-host-sdk/package.json).