memorix icon indicating copy to clipboard operation
memorix copied to clipboard

background start can launch a different unpatched memorix from ~/node_modules

Open RaviTharuma opened this issue 3 months ago • 2 comments

Description

background start used process.argv[1] as cliEntry. Bun/npm shims can set that to a different install than the CLI the user thinks they ran.

On a Linux host, bun add from $HOME added memorix to ~/package.json. ~/.cache/.bun/bin/memorix background start then spawned:

node /home/<user>/node_modules/memorix/dist/cli/index.js serve-http

That copy was stock 1.6.0 (unpatched), while the global bun install had the large-store fixes. The unpatched binary hydrated 64k observations on the HTTP thread and pegged a core.

Steps to Reproduce

  1. cd $HOME && bun add memorix (or any flow that creates $HOME/node_modules/memorix).
  2. Also have a global memorix on PATH.
  3. cd /path/to/git/project && memorix background start
  4. ps the child: it may be $HOME/node_modules/memorix, not the global package.

Expected Behavior

The daemon is always this package's dist/cli/index.js (the module that is executing background start).

Actual Behavior

A second, often older, tree is spawned. Health/init then regress to the bugs in that tree.

Environment

  • Linux, bun global + $HOME/node_modules/memorix
  • Memorix 1.6.0

Additional Context

#214 prefers import.meta.url → dist/cli/index.js over argv[1]. Operators should still avoid bun add memorix in $HOME.

Related: #214, background-stdio issue (sibling).

RaviTharuma avatar Aug 17 '26 13:08 RaviTharuma

Fix is in PR https://github.com/AVIDS2/memorix/pull/214 — not on main yet, so leaving this issue open until that PR merges.

Relevant work:

  • 13142d320f / 35358a1a4c — background start resolves the packaged CLI entry instead of a different memorix from ~/node_modules
  • Files: src/cli/commands/background.ts, tests/cli/background-launcher.test.ts

RaviTharuma avatar Aug 17 '26 16:08 RaviTharuma

Fixed by #214 and released in v1.6.2. Background mode resolves this package's compiled CLI instead of rediscovering an unrelated Memorix install under the launch directory. Closing as shipped.

AVIDS2 avatar Aug 18 '26 10:08 AVIDS2