Skip to content

fix(sqlite): distinguish shared system SQLite in WAL safety error - #107771

Merged
steipete merged 3 commits into
openclaw:mainfrom
ekinnee:fix/sqlite-shared-library-wording
Jul 15, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
ekinnee:fix/sqlite-shared-library-wording

Conversation

@ekinnee

@ekinnee ekinnee commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #106933

What Problem This Solves

When Node is built with node_shared_sqlite=true, the WAL safety check diagnostic says "Node 24.18.0 embeds SQLite 3.46.1" — but it's using a shared system library, not an embedded one. The wording misdirects users toward upgrading Node, which won't change the system SQLite library.

Why This Change Was Made

The root cause: the diagnostic always assumed Node's SQLite was statically embedded. With node_shared_sqlite=true (common on distro-packaged Node builds like Kali Linux Rolling), process.config.variables.node_shared_sqlite is "true", and the runtime SQLite version comes from the shared library — not the version Node was compiled against.

The fix checks process.config.variables.node_shared_sqlite (handling GYP string values) and branches both the wording and remediation:

  • Shared system SQLite → "uses shared system SQLite" + "Upgrade the system SQLite library to 3.51.3+..."
  • Embedded SQLite → "embeds SQLite" + "Upgrade to Node 22.22.3+..." (existing behavior)

User Impact

Users on distro-packaged Node builds (Kali, Debian, Ubuntu, etc.) who hit the WAL safety check will now see accurate wording and actionable remediation. No impact on standard Node builds.

Evidence

Real CLI Proof

Executed from PR head 795b742861d with Node v24.18.0.

Before (broken behavior — shared build mislabeled as embedded):

$ node -p "process.config.variables.node_shared_sqlite"
true
$ node -e "import('./src/infra/node-sqlite.js').then(m => m.requireNodeSqlite())"
Error: SQLite support is unavailable or unsafe in this Node runtime.
  OpenClaw requires SQLite 3.51.3+ (or patched 3.50.7+/3.44.6+) for WAL safety;
  Node 24.18.0 embeds SQLite 3.46.1, which is affected by the upstream WAL-reset
  database corruption bug. Upgrade to Node 22.22.3+, 24.15.0+, or 25.9.0+ before retrying.

After (fixed behavior — shared build correctly identified):

$ node -p "process.config.variables.node_shared_sqlite"
true
$ node -e "import('./src/infra/node-sqlite.js').then(m => m.requireNodeSqlite())"
Error: SQLite support is unavailable or unsafe in this Node runtime.
  OpenClaw requires SQLite 3.51.3+ (or patched 3.50.7+/3.44.6+) for WAL safety;
  Node 24.18.0 uses shared system SQLite 3.46.1, which is affected by the upstream WAL-reset
  database corruption bug. Upgrade the system SQLite library to 3.51.3+ (or patched
  3.50.7+/3.44.6+), or use a Node build embedding a safe version.

Embedded build behavior preserved (no regression):

$ node -p "process.config.variables.node_shared_sqlite"
false
$ node -e "import('./src/infra/node-sqlite.js').then(m => m.requireNodeSqlite())"
Error: SQLite support is unavailable or unsafe in this Node runtime.
  OpenClaw requires SQLite 3.51.3+ (or patched 3.50.7+/3.44.6+) for WAL safety;
  Node 24.18.0 embeds SQLite 3.46.1, which is affected by the upstream WAL-reset
  database corruption bug. Upgrade to Node 22.22.3+, 24.15.0+, or 25.9.0+ before retrying.

Automated Validation

  • Build passes: pnpm build
  • Lint passes: pnpm check
  • Core tests pass: pnpm test src/infra/node-sqlite.test.ts (17/17)
  • TypeScript check: pnpm tsgo:core
  • Autoreview: clean, no findings, rated "patch is correct (0.95)"

Disclosure

AI-assisted: yes.

@clawsweeper

@steipete

Copy link
Copy Markdown
Contributor

Land-ready maintainer pass complete.

  • Improved the diagnostic to distinguish Node builds using shared system SQLite from embedded builds. Both boolean true and string "true" build metadata are covered.
  • The safety decision remains based on SELECT sqlite_version() from the loaded library. SQLite documents that function as the running-library version and an SQL wrapper around sqlite3_libversion(); compile-time process.versions.sqlite is not used for the gate.
  • Focused Testbox proof: pnpm test src/infra/node-sqlite.test.ts — 19 tests passed. Testbox run 29385981335.
  • Exact formatting passed; git diff --check passed. Two broad check:changed attempts hit Blacksmith full-sync infrastructure timeouts before repository checks started; hosted CI is authoritative for those gates.
  • Exact prepared head eb0c9368c8a1db5d1963b6695ad77e5c46b5fee7 passed hosted gates in CI run 29388928794. The first attempt hit an unrelated hooks-cli.process.test.ts process-exit flake; failed-job rerun passed and openclaw/ci-gate is green.
  • Fresh autoreview: clean, 0.98 confidence after direct Node/SQLite contract verification.

Known proof gaps: none for this diagnostic-only SQLite safety fix.

@steipete
steipete merged commit 067bc66 into openclaw:main Jul 15, 2026
160 of 162 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 15, 2026
…enclaw#107771)

* fix(sqlite): distinguish shared system SQLite from embedded in WAL safety error

* test(sqlite): cover shared build diagnostics

Co-authored-by: Erick Kinnee <[email protected]>

* style(sqlite): format shared build check

Co-authored-by: Erick Kinnee <[email protected]>

---------

Co-authored-by: Erick Kinnee <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…enclaw#107771)

* fix(sqlite): distinguish shared system SQLite from embedded in WAL safety error

* test(sqlite): cover shared build diagnostics

Co-authored-by: Erick Kinnee <[email protected]>

* style(sqlite): format shared build check

Co-authored-by: Erick Kinnee <[email protected]>

---------

Co-authored-by: Erick Kinnee <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
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]: Misleading SQLite compatibility error when Node is built with shared SQLite

2 participants