GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(ci): rebuild better-sqlite3 after pnpm cache restore to fix Node ABI mismatch by onsclom · Pull Request #4938 · CopilotKit/CopilotKit

Conversation

@onsclom

@onsclom onsclom commented May 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Fixes a probabilistic CI failure in the test / unit matrix where Node 20.x and 22.x jobs would fail with Module did not self-register on better-sqlite3.

Root cause

setup-node's built-in cache: "pnpm" uses a cache key of node-cache-Linux-pnpm-{lockfileHash} — no Node.js version in the key. All three matrix jobs (Node 20, 22, 24) share one cache entry.

The failure is probabilistic, not always-present:

  • Cold run (first after cache reset): all three jobs install fresh and pass. Whichever job finishes first writes its ABI-specific better-sqlite3 binary to the shared cache key.
  • Warm run (all subsequent runs): all three jobs restore from the same cache entry. Only the job whose Node version matches the cached binary passes. The other two fail.

This explains the timing: failures started ~May 19 after the setup-node v4→v6 and pnpm/action-setup v4→v6 dependabot bumps (May 15, PRs #4857/#4858) reset the cold cache. The first warm run after that was broken for whichever two Node versions didn't win the write race.

This is a known upstream bug in setup-node (issue #1171, fix pending in PR #1172, not yet in any release).

Fix

Replace cache: "pnpm" in setup-node with a manual actions/cache step that scopes the key to the Node.js version:

key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('pnpm-lock.yaml') }}

Each Node version now has its own isolated pnpm store cache entry. An ABI-137 binary cached by a Node 24 job can never be served to a Node 20 or 22 job.

The step uses $GITHUB_OUTPUT (scoped step output) instead of $GITHUB_ENV per GitHub's security hardening guide.

Test plan

Local reproduction (primary evidence)

better-sqlite3 uses classic ABI (NODE_MODULE_INIT, not N-API), so its binaries are Node-version-specific. With a Node 24 binary in place, switching to Node 22 without reinstalling reproduces the exact CI failure:

# Binary compiled under Node 24 (ABI 137) — works fine:
$ node --version && node -e "new (require('better-sqlite3'))(':memory:').prepare('SELECT 1').get()"
v24.5.0
{ '1': 1 }

# Same binary, switched to Node 22 (ABI 127) without reinstalling — fails:
$ node-22 -e "new (require('better-sqlite3'))(':memory:')"
Error: The module was compiled against a different Node.js version using
NODE_MODULE_VERSION 137. This version of Node.js requires NODE_MODULE_VERSION 127.
Please try re-compiling or re-installing the module.

This is exactly what the shared cache was doing to Node 20/22 jobs: handing them a binary compiled for a different ABI.

CI validation

Two runs on this PR confirm the fix end-to-end:

  1. Cold-cache run (26185670340): all three jobs install fresh, each writes its own per-version cache entry, all pass.

  2. Warm-cache run (26187495270): each job restores from its own per-version cache entry — the exact scenario that was previously broken. All pass, with install times dropping from ~22s (cold, downloading) to 7–10s (warm, linking from store), confirming real cache hits were served.

Job Result Cache restore Install
unit (20.x) ✅ pass 12s (hit) 8s
unit (22.x) ✅ pass 12s (hit) 7s
unit (24.x) ✅ pass 14s (hit) 10s

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@onsclom
fix(ci): rebuild better-sqlite3 after pnpm cache restore to fix Node …
193629a
…ABI mismatch

The pnpm store cache key used by setup-node does not include the Node.js
version, so a cache entry written by a Node 24 job contains an ABI-137
better-sqlite3 binary. When Node 20 (ABI 115) or Node 22 (ABI 127) jobs
restore from the same cache key they get the wrong binary and all
sqlite-runner tests fail with "Module did not self-register".

Adding `pnpm rebuild better-sqlite3` after install re-runs prebuild-install
for the active Node version, downloading the correct prebuilt binary and
overwriting whatever ABI was in the restored cache.

Root cause first appeared after the setup-node v4→v6 and pnpm/action-setup
v4→v6 bumps (May 15, PRs #4857/#4858) reset the cold cache, allowing a
Node 24 binary to poison the shared store entry.
@onsclom
onsclom requested review from jpr5, marthakelly, mme, ranst91 and tylerslaton as code owners May 20, 2026 19:29
@vercel

vercel Bot commented May 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat-with-your-data Ready Ready Preview, Comment May 20, 2026 8:35pm
docs Ready Ready Preview, Comment May 20, 2026 8:35pm
form-filling Ready Ready Preview, Comment May 20, 2026 8:35pm
research-canvas Ready Ready Preview, Comment May 20, 2026 8:35pm
travel Ready Ready Preview, Comment May 20, 2026 8:35pm

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview – form-filling May 20, 2026 19:30
View deployment
@vercel
vercel Bot deployed to Preview – chat-with-your-data May 20, 2026 19:30
View deployment
@vercel
vercel Bot deployed to Preview – docs May 20, 2026 19:31
View deployment
@vercel
vercel Bot deployed to Preview – travel May 20, 2026 19:31
View deployment
@vercel
vercel Bot deployed to Preview – research-canvas May 20, 2026 19:31
View deployment
@onsclom
fix(ci): scope pnpm cache key to Node.js version to fix native ABI mi…
2140e64
…smatch

pnpm rebuild better-sqlite3 was a no-op — pnpm treats the arg as a
workspace package name and exits silently when none matches.

Root fix: replace setup-node's built-in cache: "pnpm" (whose key omits
the Node.js version) with a manual actions/cache step that includes
matrix.node-version in the key. Each Node version gets its own pnpm
store, so the ABI-137 better-sqlite3 binary cached from a Node 24 job
can no longer be served to Node 20 (needs ABI 115) or Node 22 (needs
ABI 127) jobs.
@vercel
vercel Bot deployed to Preview – chat-with-your-data May 20, 2026 19:43
View deployment
@vercel
vercel Bot deployed to Preview – docs May 20, 2026 19:43
View deployment
@vercel
vercel Bot deployed to Preview – form-filling May 20, 2026 19:43
View deployment
@vercel
vercel Bot deployed to Preview – travel May 20, 2026 19:43
View deployment
@vercel
vercel Bot deployed to Preview – research-canvas May 20, 2026 19:43
View deployment
@onsclom
fix(ci): polish cache step — use GITHUB_OUTPUT, fix hashFiles glob, e…
ed61ee5
…xpand ABI comment

- Switch STORE_PATH from $GITHUB_ENV to $GITHUB_OUTPUT (step-scoped,
  per GitHub Actions security hardening guide)
- Narrow hashFiles glob from '**/pnpm-lock.yaml' to 'pnpm-lock.yaml'
  (root-only, avoids spurious cache busts from docs/examples lockfiles)
- Reword comment to show ABI mismatch is symmetric across all versions
- Document that actions/cache is equally fork-safe (GitHub platform guarantee)
@vercel
vercel Bot deployed to Preview – form-filling May 20, 2026 20:07
View deployment
@vercel
vercel Bot deployed to Preview – docs May 20, 2026 20:07
View deployment
@vercel
vercel Bot deployed to Preview – research-canvas May 20, 2026 20:08
View deployment
@vercel
vercel Bot deployed to Preview – travel May 20, 2026 20:08
View deployment
@onsclom
fix(ci): clarify fork-safety comment — forks can't write (not read-only)
e353565
@vercel
vercel Bot deployed to Preview – chat-with-your-data May 20, 2026 20:08
View deployment
@vercel
vercel Bot deployed to Preview – chat-with-your-data May 20, 2026 20:10
View deployment
@vercel
vercel Bot deployed to Preview – form-filling May 20, 2026 20:10
View deployment
@vercel
vercel Bot deployed to Preview – docs May 20, 2026 20:11
View deployment
@vercel
vercel Bot deployed to Preview – research-canvas May 20, 2026 20:11
View deployment
@vercel
vercel Bot deployed to Preview – travel May 20, 2026 20:11
View deployment
@onsclom
ci: retrigger to validate fix under warm-cache conditions
15df1a4
@vercel
vercel Bot temporarily deployed to Preview – form-filling May 20, 2026 20:17 Inactive
@vercel
vercel Bot temporarily deployed to Preview – chat-with-your-data May 20, 2026 20:17 Inactive
@vercel
vercel Bot deployed to Preview – travel May 20, 2026 20:20
View deployment
@vercel
vercel Bot deployed to Preview – research-canvas May 20, 2026 20:20
View deployment
@vercel
vercel Bot deployed to Preview – docs May 20, 2026 20:20
View deployment
@onsclom
onsclom marked this pull request as draft May 20, 2026 20:22
@onsclom
onsclom marked this pull request as ready for review May 20, 2026 20:32
@onsclom
Merge branch 'main' into worktree-fix+ci-sqlite-native-module-abi
85eef0d
@vercel
vercel Bot deployed to Preview – chat-with-your-data May 20, 2026 20:34
View deployment
@vercel
vercel Bot deployed to Preview – form-filling May 20, 2026 20:34
View deployment
@vercel
vercel Bot deployed to Preview – travel May 20, 2026 20:35
View deployment
@vercel
vercel Bot deployed to Preview – docs May 20, 2026 20:35
View deployment
@vercel
vercel Bot deployed to Preview – research-canvas May 20, 2026 20:35
View deployment
tylerslaton
tylerslaton approved these changes May 20, 2026
View reviewed changes
@onsclom
onsclom merged commit 1bd5936 into main May 20, 2026
14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@onsclom
onsclom deleted the worktree-fix+ci-sqlite-native-module-abi branch May 20, 2026 21:39

This branch was successfully deployed

5 active deployments
Preview – research-canvas — 85eef0db Deployed May 20, 2026 by vercel[bot]
View deployment
Preview – docs — 85eef0db Deployed May 20, 2026 by vercel[bot]
View deployment
Preview – travel — 85eef0db Deployed May 20, 2026 by vercel[bot]
View deployment
Preview – form-filling — 85eef0db Deployed May 20, 2026 by vercel[bot]
View deployment
Preview – chat-with-your-data — 85eef0db Deployed May 20, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tylerslaton tylerslaton tylerslaton approved these changes
@jpr5 jpr5 Awaiting requested review from jpr5 jpr5 is a code owner
@ranst91 ranst91 Awaiting requested review from ranst91
@marthakelly marthakelly Awaiting requested review from marthakelly
@mme mme Awaiting requested review from mme mme is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@onsclom @tylerslaton
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.