memorix icon indicating copy to clipboard operation
memorix copied to clipboard

memorix background start can spawn dist/index.js stdio instead of the HTTP CLI

Open RaviTharuma opened this issue 3 months ago • 2 comments

Description

memorix background start is supposed to spawn node <cli-entry> serve-http --port 3211. After tsup bundles the CLI into dist/cli/index.js, a naive path.resolve(dirname(import.meta.url), '..', 'index.js') resolves to dist/index.js — the library stdio MCP entry, not the HTTP CLI.

The child logs MCP Server running on stdio and stdin closed — exiting (stdio is ignore). The control plane never stays up. This reproduced on macOS and Linux after a rebuild.

Steps to Reproduce

  1. Install a built memorix where dist/index.js and dist/cli/index.js both exist.
  2. From a git project: memorix background start
  3. Read ~/.memorix/background.log.

Expected Behavior

Child command is node …/dist/cli/index.js serve-http --port 3211. /health becomes {"status":"ok","mode":"control-plane"}.

Actual Behavior

[memorix] MCP Server running on stdio (project: …)
[memorix] stdin closed — exiting
[ERROR] Background process exited unexpectedly.

Environment

  • Memorix 1.6.0 built with tsup
  • macOS (MacBook 13/16) and Linux (dev-001)

Additional Context

#214 resolves the bundled CLI file when basename(here) === 'index.js' and basename(dir) === 'cli', and never treats dist/index.js as the daemon entry.

Related: #69, #70, #214.

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 — memorix background start spawns dist/cli/index.js (HTTP CLI), not library dist/index.js (stdio)
  • 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 now launches the compiled HTTP CLI entry rather than the stdio library entry. Closing as shipped.

AVIDS2 avatar Aug 18 '26 10:08 AVIDS2