fix: worker-service missing sqlite/SessionStore.js + observations/files.js (#3092)#3102
Open
bionicbutterfly13 wants to merge 1 commit into
Conversation
…es.js (thedotmack#3092) ChromaSync.ts loads SessionStore and parseFileList through a runtime createRequire(import.meta.url)(...) call instead of a static import, so tsup's cmem-sdk build doesn't follow them and drag bun:sqlite into SDK consumers. But esbuild's worker-service bundle doesn't follow that same indirection either, so worker-service.cjs shipped without these two modules entirely — every worker startup logged "Backfill failed (non-blocking)" from a Cannot find module '../sqlite/SessionStore.js' error, and Chroma vector-search backfill silently never ran. - scripts/build-hooks.js: emit both modules as loose files next to the worker bundle (plugin/sqlite/SessionStore.js, plugin/sqlite/observations/files.js) - package.json: add plugin/sqlite to the npm files whitelist so the published package actually ships them - tests/worker-service-lazy-sqlite-modules.test.ts: regression test asserting both modules are emitted and resolve the same way ChromaSync.ts requires them at runtime - CHANGELOG.md: Unreleased entry per contribution guidelines
Contributor
Greptile SummaryThis PR fixes missing lazy SQLite modules in the worker package. The main changes are:
Confidence Score: 5/5The changes are narrowly scoped to packaging the lazy-loaded SQLite worker modules and adding a regression test for the runtime resolution path. No code issues were identified in the reviewed changes, and the added test directly covers the failure mode described by the package build fix.
What T-Rex did
Reviews (1): Last reviewed commit: "fix: worker-service missing sqlite/Sessi..." | Re-trigger Greptile |
Contributor
|
T-Rex pricing update — T-Rex was free through June 2026. Effective July 1, 2026, T-Rex adds 2 credits on top of the standard 1-credit review (3 total). T-Rex settings |
5 tasks
This was referenced Jul 5, 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
Fixes Bug 1 from #3092: the Chroma backfill pipeline failed on every worker startup with
Cannot find module '../sqlite/SessionStore.js'.ChromaSync.tsloadsSessionStoreandparseFileListthrough a runtimecreateRequire(import.meta.url)(...)call instead of a staticimport, intentionally, so the cmem-sdk (tsup) build doesn't follow them and dragbun:sqliteinto SDK consumers. But esbuild's worker-service bundle inscripts/build-hooks.jsdoesn't follow that same indirection either — it only inlines modules reached through a literalrequire(...)call, not one made via a locally-createdrequirereference — soworker-service.cjsshipped without either module. Every worker startup loggedBackfill failed (non-blocking)from the resultingCannot find moduleerror, and Chroma vector-search backfill silently never ran.scripts/build-hooks.js: after the existingworker-service.cjsbuild step, add a build pass that emits both modules as loose files next to the bundle (plugin/sqlite/SessionStore.js,plugin/sqlite/observations/files.js), matching the relative pathChromaSync.ts's lazyrequire()expects at runtime.package.json: addplugin/sqliteto the npmfileswhitelist — without this the fix builds and tests clean locally but the published package still wouldn't ship the emitted files.tests/worker-service-lazy-sqlite-modules.test.ts: regression test that resolves both modules the same wayChromaSync.tsdoes at runtime. Verified locally that it reproduces the exact#3092error when the fix is reverted, and passes with it applied.CHANGELOG.md:[Unreleased]entry per the contribution guidelines indocs/public/development.mdx.Out of scope: Bug 2 from #3092 (the
.install-versionmarker / "runtime not yet set up" message) is a separate, architecturally distinct issue — it's about the Claude Code marketplace install path never invoking the npx installer that writes that marker, not a build-pipeline gap. Left for a follow-up so this PR stays scoped to one concern.Test plan
bun test tests/worker-service-lazy-sqlite-modules.test.ts— 4/4 pass with the fix applied#3092error text whenplugin/sqlite/is removed (proves it's a real regression guard, not a tautology)npm pack --dry-run --jsonthat the newplugin/sqlitefilesentry recursively packs the nestedplugin/sqlite/observations/files.jsnpm run build && npm run typecheck && bun test— not run locally (heavy toolchain: tree-sitter-cli, onnxruntime-node, Chroma); relying on this repo's own CI (.github/workflows/ci.yml) to run these on the PR