memorix icon indicating copy to clipboard operation
memorix copied to clipboard

Dashboard Config Provenance page ignores the TOML config lane and skips .env loading when unbound

Open limbo947 opened this issue 3 months ago • 1 comments

Summary

The Dashboard Config Provenance page (/api/config endpoint) does not reflect the actual runtime configuration on a TOML-first setup (the flow produced by memorix init --global, i.e. ~/.memorix/config.toml + secrets in ~/.memorix/.env, no legacy files). Two distinct problems:

  1. The endpoint reads config through the legacy YAML loader only, so every value that actually comes from config.toml is misreported as default (or missing entirely).
  2. When the dashboard is unbound (no project root), the endpoint skips loadDotenv() entirely, so even .env-sourced keys display as not set.

Environment

  • memorix 1.7.3 (also verified the code paths on main)
  • Windows 10, Node v24.14.1
  • Setup: ~/.memorix/config.toml (TOML only) + ~/.memorix/.env with MEMORIX_LLM_API_KEY / MEMORIX_EMBEDDING_API_KEY / MEMORIX_RERANK_API_KEY. No memorix.yml, no config.json.

Problem 1: TOML lane is not wired into the provenance endpoint

src/dashboard/server.ts, case '/config' (~line 577):

const { loadYamlConfig } = await import('../config/yaml-loader.js');
yml = configProjectRoot ? loadYamlConfig(configProjectRoot) : loadYamlConfig(null);

loadYamlConfig() (src/config/yaml-loader.ts:160) resolves only getGlobalYamlPath() / getProjectYamlPath() — i.e. memorix.yml files. It never reads getGlobalConfigTomlPath() / getProjectConfigTomlPath() (src/config/config-paths.ts), even though the helpers exist and the runtime resolution chain (resolved-config.ts / toml-loader.ts) is TOML-first.

Observed on a bound dashboard (run memorix dashboard inside a git repo):

Dashboard row Shows Actual (per memorix status)
embedding.provider off / default api / qwen3.7-text-embedding (hybrid search active)
git.autoHook false / default true — the post-commit hook is actually installed in the repo
llm.model / llm.provider row absent configured in TOML
server.* default explicitly set in TOML
rerank lane not tracked at all http rerank configured
File matrix only 5 legacy files config.toml / memorix.toml never listed

memorix status in the same project correctly reports Active config sources: TOML: ~/.memorix/config.toml, all four lanes, and git behavior — so the dashboard page is the outlier, not the resolution chain.

Problem 2: unbound dashboards skip .env loading

src/dashboard/server.ts (~line 592):

if (configProjectRoot) {
    const { loadDotenv } = await import('../config/dotenv-loader.js');
    loadDotenv(configProjectRoot);
}

loadDotenv() itself (src/config/dotenv-loader.ts:77-82) loads the project .env and then unconditionally falls back to the user-level ~/.memorix/.env — but the endpoint only calls it when a project root is bound. On an unbound dashboard (e.g. opened via the background control plane / HTTP server without a project binding):

  • The file matrix correctly shows user .env as existing ✓
  • Yet llm.apiKey renders as not set / none, because the key was never loaded into process.env

On the same machine, a bound dashboard shows the row correctly (****XXXX / .env (MEMORIX_LLM_API_KEY)), which isolates the gate on configProjectRoot as the cause.

Repro

# TOML-only setup: ~/.memorix/config.toml with [memory.llm]/[embedding]/[git], keys in ~/.memorix/.env
memorix dashboard          # unbound → llm.apiKey: not set; all TOML values: default
cd <any-git-repo> && memorix dashboard   # bound → llm.apiKey OK; TOML values still default
memorix status             # shows the real resolved config

Suggested fixes

  1. Make /api/config use the TOML-aware resolved configuration (same chain as memorix status), keeping YAML only as the compatibility fallback it already is at runtime; label sources config.toml / memorix.toml accordingly.
  2. Load the user-level .env even when no project root is bound (drop the gate, or call the loader with null so its user-level fallback still runs).
  3. Nice to have: track the [rerank] lane, and add config.toml / memorix.toml rows to the file matrix. The page hint "memorix.yml = behavior config" is also outdated for TOML-first flows.

Happy to provide more traces if useful — thanks for the project, the memory model has been working well otherwise.

limbo947 avatar Aug 22 '26 18:08 limbo947

Memorix 1.8.0 is now released, including the TOML/.env/rerank provenance fix from this report. Please upgrade with npm install -g [email protected], reopen the Dashboard, and verify the Config Provenance page again. Thanks for the detailed reproduction and the clear traces.

AVIDS2 avatar Aug 23 '26 14:08 AVIDS2