Repository navigation
fix(embeddings): persist model cache outside node_modules - #179
Open
HengYangDS wants to merge 4 commits into
Open
HengYangDS wants to merge 4 commits into
HengYangDS wants to merge 4 commits into
Conversation
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
node_modules(fixes Embedding model cache lives inside node_modules/@huggingface/transformers/.cache/ — every version bump or repair install orphans the 34 MB model and silently requires a fresh Hugging Face download #173).EPISODIC_MEMORY_MODEL_CACHE_DIRoverride for pre-seeded/shared caches.EPISODIC_MEMORY_OFFLINE=1disables remote model loading and reports a clear missing-cache error; default fresh installs may still download the model.env_varsallowlist.Clean Node 22 / Node 26 qualification at
e5a4672This repository intentionally ignores
package-lock.jsonand CI usesnpm install. An isolated resolver comparison showed that^4.2.0selects Transformers.js 4.3.0,onnxruntime-node1.30.0, andonnxruntime-web1.31.0-dev; the one-line exact 4.2.0 constraint selectsonnxruntime-node1.24.3 andonnxruntime-web1.26.0-dev. No lockfile, host path, or runtime fallback was added.Two independent
git archivesnapshots from this PR HEAD started withoutnode_modulesor a lockfile. On macOS arm64, Node 22.23.3 (ABI 127) and Node 26.10.0 (ABI 147) each completed one standardnpm install --no-audit --no-fund --foreground-scriptsin about 12 seconds using a warmed package cache. In each tree,better-sqlite3andsqlite-vecinstantiated successfully, the hash-verified pre-seeded embedding model loaded with remote loading disabled,npm run buildand bundle syntax passed, and the full suite passed 359/359 tests. The checked-in MCP bundle also completed isolatedsearchandreadcalls against a synthetic fixture with those clean dependencies. Node 22 reported an optionalfseventsbuild warning; the install exited zero and all validators passed. These runs do not prove an empty-cache network install or Ubuntu CI.Node 24 qualification: not green
At the previous PR head
21988fa, an earlier Node 24.21.0 (ABI 137) run passed native loading, build, bundle syntax, and the four Codex manifest tests, but the full suite stopped after 313/359 tests when six workers aborted inbetter-sqlite3cleanup. Its cloned dependency tree contained Vitest 5.0.0 even though this branch declares^3.2.4, so that run is not a valid clean-install qualification. That earlier Node 22 run is superseded by the current-head clean qualification above. Earlier clean Node 22/24 runs on the parent commit used Vitest 3.2.7, but do not establish a current-head Node 24 full-suite pass.One bounded, empty-
node_modulesinstall from the previous HEAD21988fawas attempted on Node 24.21.0. It did not complete within 600 seconds while resolving/fetchingonnxruntime-node@1.30.0after@huggingface/transformersresolved to 4.3.0. No second unchanged cold-install attempt was made, and a clean full-suite pass is not claimed. The partial resolver tree did contain the manifest-compatible Vitest 3.2.7 andbetter-sqlite312.11.1; the latter was built from source against the installed Node 24.21.0 headers and instantiated successfully withsqlite-vec.The native abort is independently reproducible without Episodic Memory, Transformers.js, Vitest, or sqlite-vec. With
better-sqlite3@12.11.1compiled against Node 24.21.0 headers, the following standalone script aborts innode::RemoveEnvironmentCleanupHookfromDatabase::~Database()(ABI 137). The identical script passes on Node 26.10.0 after rebuilding the same addon version against ABI 147:Node's built-in test runner and Vitest 3.2.7 also reproduce the same assertion. This matches nodejs/node#65446 and WiseLibs/better-sqlite3#1515: a Node 24
node::ObjectWrapcleanup-hook regression. The proposed 24.x backport is closed without merge as of 2026-09-27. A Node 24 release containing the upstream fix is the external prerequisite for a green Node 24 qualification; until then, Node 22 or 26 can be qualified separately. We will not hide this with a host-specific path or header workaround in the plugin.Other limits
dist/mcp-server.jsdiff is generated bundle churn from the unpinned transitive dependency graph. Source changes are confined to cache policy, Codex environment forwarding, dependency policy, sync status, tests, and docs.