Skip to content

Bug: auto-sync daemon silently fails because packaged runtime is missing chokidar #57

Description

@Jerry-jwz

Summary

The automatic Git sync daemon can silently fail in the packaged Linux x64 runtime because chokidar is not present in the extracted runtime. Manual mindos sync now still works, so the configured sync can appear healthy while file watching and periodic pulls are not running.

I reproduced the end-to-end behavior with MindOS 1.1.60 and also verified the missing dependency against the latest published @geminilight/mindos-linux-x64@1.1.61 artifact.

Environment

  • OS: Linux x64
  • Installed CLI used for the end-to-end reproduction: mindos/1.1.60 node/v24.18.0 linux-x64
  • Latest artifact checked separately: @geminilight/mindos-linux-x64@1.1.61
  • Sync config: Git provider, enabled: true, 30-second auto-commit interval, 300-second auto-pull interval

Observed behavior

With sync configured and MindOS running:

  • mindos sync now succeeds.
  • Editing the knowledge base does not trigger the expected automatic sync.
  • The periodic pull does not run.
  • MindOS startup does not report that the sync daemon failed.

The extracted 1.1.60 runtime was located at:

~/.mindos/runtime-cache/1.1.60/linux-x64

It did not contain node_modules/chokidar.

Latest artifact reproduction (1.1.61)

I downloaded the published @geminilight/mindos-linux-x64@1.1.61 package, ran its binary with an isolated MINDOS_BINARY_CACHE_DIR, and inspected the extracted runtime:

RUNTIME_ROOT_PRESENT=yes
CHOKIDAR_PRESENT=no

Calling startSyncDaemon() with sync enabled and a temporary Git repository produces:

SYNC_DAEMON_START_ERROR_CODE=ERR_MODULE_NOT_FOUND
SYNC_DAEMON_START_ERROR_MESSAGE=Cannot find package 'chokidar' imported from .../runtime-cache/1.1.61/linux-x64/bin/lib/sync.js

Likely cause

packages/mindos/bin/lib/sync.js dynamically imports chokidar:

const chokidar = await import('chokidar');

Although packages/mindos/package.json declares chokidar, the embedded platform runtime does not materialize it at the runtime root. The generated platform package manifest also has no runtime dependencies.

The failure is then hidden in packages/mindos/bin/commands/start.js by calls such as:

startSyncDaemon(mindRoot).catch(() => {});

The same empty catch is used by the product server's sync-daemon lifecycle callbacks, so users receive no visible error.

Verified workaround

As a local test, I linked the globally installed package's chokidar into the extracted runtime:

~/.mindos/runtime-cache/1.1.60/linux-x64/node_modules/chokidar
  -> <global @geminilight/mindos>/node_modules/chokidar

After restarting MindOS:

  • the file watcher updated lastSync after the configured 30-second interval;
  • the periodic pull updated lastPull after 5 minutes;
  • lastError remained null and no conflicts were reported.

Suggested fix

  1. Include chokidar and its runtime dependency closure in packaged/extracted runtimes that execute bin/lib/sync.js.
  2. Add a packaging regression check that starts the sync daemon, or at least resolves/imports chokidar from the extracted runtime root.
  3. Report sync-daemon startup failures instead of silently swallowing them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions