Skip to content

fix: restore missing sqlite/observations/files.js shipped module#3273

Open
E0993599799 wants to merge 1 commit into
thedotmack:mainfrom
E0993599799:fix/missing-sqlite-observations-files-module
Open

fix: restore missing sqlite/observations/files.js shipped module#3273
E0993599799 wants to merge 1 commit into
thedotmack:mainfrom
E0993599799:fix/missing-sqlite-observations-files-module

Conversation

@E0993599799

Copy link
Copy Markdown

Summary

  • worker-service.cjs dynamically requires ../sqlite/observations/files.js via createRequire(__IMPORT_META_URL__), sourced from src/services/sqlite/observations/files.ts. This file is intentionally excluded from the main esbuild/bundler output (it's loaded lazily at runtime instead of being statically bundled), but the build does not currently copy/compile it into the shipped plugin/ output directory.
  • As a result, every Chroma backfill and live observation sync fails at formatObservationDocsjce() with:
    ResolveMessage: Cannot find module '../sqlite/observations/files.js' from '.../plugin/scripts/worker-service.cjs'
    
  • This silently breaks Chroma vector sync for all users on affected installs — primary SQLite storage and FTS5 full-text search keep working, but semantic/vector search over memories never gets populated.

Fix

Adds the missing module at the exact path worker-service.cjs resolves it to:

  • plugin/sqlite/observations/files.js — minimal, dependency-free CommonJS reimplementation of parseFileList (the only export this call site needs). Left dependency-free (no utils/logger.js import) since that module isn't shipped in plugin/ either.
  • plugin/sqlite/package.json{ "type": "commonjs" }, so Node/Bun parse the .js file as CommonJS despite the parent plugin/package.json declaring "type": "module" (Node resolves module type from the nearest package.json up the directory tree).

This is a packaging-only fix at the shipped-output level. The real fix likely belongs in the build pipeline (src/build) so this file gets compiled/copied automatically on release — flagging that as the more durable long-term fix, but wanted to get a working patch out first.

Test plan

  • Reproduced: confirmed the exact Cannot find module '../sqlite/observations/files.js' error in a live worker's logs, across every project during backfill.
  • Simulated the exact createRequire(pathToFileURL(worker-service.cjs).href)("../sqlite/observations/files.js") call directly with bun — resolves and returns parseFileList correctly after the fix.
  • Restarted the worker for real with the fix applied: Chroma backfill succeeded end-to-end for multiple projects (Dheva-oracle-deploy, aeimathes-oracle, aris-oracle, captain-maid/*, ...) with zero module-resolution errors, where previously every single project failed at this step.

🤖 Generated with Claude Code

worker-service.cjs dynamically requires ../sqlite/observations/files.js
via createRequire(__IMPORT_META_URL__) (source: src/services/sqlite/
observations/files.ts), but this file was never copied into the shipped
plugin/ output. Every Chroma backfill and live observation sync failed
with:

  ResolveMessage: Cannot find module '../sqlite/observations/files.js'
    from '.../plugin/scripts/worker-service.cjs'

Added a minimal, dependency-free CommonJS reimplementation of
parseFileList at the exact path worker-service.cjs expects, plus a
nested package.json (type: commonjs) so Node/Bun parse it as CJS
despite the parent plugin/package.json declaring type: module.

Verified locally: restarted the worker and watched Chroma backfill
succeed end-to-end across multiple projects with zero module-resolution
errors (previously every project failed at this step).
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores a missing shipped helper used by Chroma observation sync. The main changes are:

  • Adds plugin/sqlite/observations/files.js with a dependency-free CommonJS parseFileList export.
  • Adds plugin/sqlite/package.json to make files under plugin/sqlite/ load as CommonJS despite the parent ESM package.
  • Restores the runtime path resolved by worker-service.cjs for observation document formatting.

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is narrowly scoped to adding a missing packaged runtime module and local module-type boundary. The helper mirrors the existing source behavior needed by Chroma observation formatting. No new external dependencies or security-sensitive data flow were introduced.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • The initial smoke-check run showed a module-resolution failure for the sqlite/observations/files.js path when it was missing, exiting with code 1.
  • After shipping the updated plugin, the smoke-check succeeded and reported the expected module-resolution outputs, including exportedKeys parseFileList and parseFileListType, with exit code 0.
  • The parse-file-list tests under tests/services/sqlite passed in Bun, totaling 9 passing and 0 failing, with exit code 0.
  • A smoke-check script named plugin_sqlite_resolution_smoke.cjs was generated to encapsulate the module-resolution check and enable reproducible validation.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
plugin/sqlite/observations/files.js Adds the shipped CommonJS parseFileList helper at the runtime path resolved by worker-service.cjs; behavior matches the source helper except for omitted debug logging.
plugin/sqlite/package.json Adds a scoped type: commonjs package boundary so the shipped helper is loaded as CommonJS under the ESM plugin package.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Worker as plugin/scripts/worker-service.cjs
participant ChromaSync as ChromaSync.formatObservationDocs
participant Loader as createRequire(import.meta.url)
Loader->>Helper: Resolve under plugin/sqlite package boundary
participant Helper as plugin/sqlite/observations/files.js

Worker->>ChromaSync: Backfill/live observation sync
ChromaSync->>Loader: require('../sqlite/observations/files.js')
Helper-->>ChromaSync: parseFileList export
ChromaSync->>Helper: parseFileList(files_read/files_modified)
Helper-->>ChromaSync: normalized string arrays
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Worker as plugin/scripts/worker-service.cjs
participant ChromaSync as ChromaSync.formatObservationDocs
participant Loader as createRequire(import.meta.url)
Loader->>Helper: Resolve under plugin/sqlite package boundary
participant Helper as plugin/sqlite/observations/files.js

Worker->>ChromaSync: Backfill/live observation sync
ChromaSync->>Loader: require('../sqlite/observations/files.js')
Helper-->>ChromaSync: parseFileList export
ChromaSync->>Helper: parseFileList(files_read/files_modified)
Helper-->>ChromaSync: normalized string arrays
Loading

Reviews (1): Last reviewed commit: "fix: restore missing sqlite/observations..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant