memorix icon indicating copy to clipboard operation
memorix copied to clipboard

Dashboard Deduplicate always reports "requires a configured memory LLM" — maintenance path never calls initLLM()

Open limbo947 opened this issue 3 months ago • 1 comments

Environment

  • memorix v1.8.0 (latest on npm), Windows 10, Node v24.14.1
  • Memory LLM fully configured and verified working:
    • ~/.memorix/config.toml → [memory.llm] with provider = "openai" and a custom OpenAI-compatible base_url
    • ~/.memorix/.env → MEMORIX_LLM_API_KEY (curl against the same endpoint/model returns completions fine)

Repro

  1. Run memorix dashboard (standalone) in a git project, open Observations, click Deduplicate.
  2. Preview is always unavailable: "Intelligent deduplication requires a configured memory LLM."

Direct API calls show config is visible to the same process, yet the gate fails:

$ curl -X POST .../api/maintenance/deduplicate/preview
{"action":"deduplicate","available":false,"reason":"Intelligent deduplication requires a configured memory LLM."}

$ curl .../api/config
[... {"key":"llm.apiKey","value":"****xxxx","source":".env"}, ...]

Reproduces identically on the control-plane dashboard (memorix serve-http → same endpoint with ?project=).

Root cause

  • previewDeduplicate() in src/dashboard/maintenance.ts gates on isLLMEnabled().
  • isLLMEnabled() only reflects currentConfig inside src/llm/provider.ts, which is set solely by initLLM().
  • Neither the standalone dashboard server nor the serve-http /api/maintenance/... routes ever call initLLM():
    • server.ts:389 (initLLM() inside initializeProjectRuntime()) only runs in the MCP session runtime path — maintenance APIs bypass it.
    • The lazy if (!isLLMEnabled()) initLLM(); in src/store/orama-store.ts only triggers on the thorough-search path, also not hit by maintenance.

So isLLMEnabled() is permanently false in dashboard processes regardless of configuration.

Suggested fix

Call initLLM() at the top of previewDeduplicate() (it is idempotent, and getLLMApiKey() → getResolvedMemoryLane() triggers loadDotenv(), so ~/.memorix/.env is picked up) — or initialize the LLM once at dashboard/serve-http startup.

Local workaround (verified)

Patching the CLI bundle so previewDeduplicate starts with initLLM(); immediately returns available: true and the preview works end-to-end with the same config.

(Context: #227 added the Deduplicate action.)

limbo947 avatar Aug 23 '26 17:08 limbo947

Fixed in Memorix 1.8.2.

The Dashboard deduplication maintenance path now idempotently initializes the selected project's memory LLM from its project TOML and .env for both standalone and HTTP dashboard APIs. With no configuration it remains clearly unavailable, and credentials are not exposed.

Upgrade with npm install -g [email protected], reopen the Dashboard, and run the deduplication preview to verify the configured project is used.

AVIDS2 avatar Aug 25 '26 02:08 AVIDS2