agentmemory icon indicating copy to clipboard operation
agentmemory copied to clipboard

agentmemory status prints "Embeddings: bm25-only" while vector search is active

Open Rex57 opened this issue 1 month ago • 1 comments

Current-main boundary

On main 007a1a7 (0.9.30), the CLI status command compares embeddingProvider from GET /agentmemory/config/flags with the literal string "embeddings". The server never sends that value: it sends the provider description ("openrouter (1536 dims)") or "none". So the CLI always prints bm25-only.

Reproduction and results

$ agentmemory status
  Provider:     ✓ llm
  Embeddings:   bm25-only

$ curl -s localhost:3111/agentmemory/config/flags -H "Authorization: Bearer …"
{"provider":"llm","embeddingProvider":"openrouter (1536 dims)", ...}

GET /agentmemory/status shows index.vectorDocuments > 0 at the same time, so vector search works. The CLI line sends operators to debug a problem that does not exist.

Required behavior

Embeddings: shows ✓ <description> when the server reports a provider, and bm25-only only for a missing value or "none".

Acceptance checks

A CLI test with embeddingProvider = "openrouter (1536 dims)", "none" and absent.

Source and existing work

CLI comparison, config/flags response, describeEmbeddingProvider.

Environment: agentmemory 0.9.30, Node v26.10.0, macOS 27.0.1 (arm64).

Rex57 avatar Oct 08 '26 06:10 Rex57

Two gaps on a real 0.9.30 install that this issue and PR #1499 don't cover.

1. agentmemory doctor has an independent copy of the same dead comparison

This issue and #1499 fix the status path (src/cli.ts:2257). The doctor flow has its own copy in runDoctor:

// src/cli.ts:2518
const hasEmbed = flags?.embeddingProvider === "embeddings";

So even after #1499 merges, agentmemory doctor keeps printing this on installs where vector search is active:

✗ Embedding provider
   Running BM25-only. Set EMBEDDING_PROVIDER=local for on-device semantic
   search, or add OPENAI_API_KEY / VOYAGE_API_KEY / COHERE_API_KEY / OLLAMA_HOST

Worth routing that call through the same embeddingStatusLabel helper so both commands agree.

2. The proposed rule reintroduces a false positive

embeddingStatusLabel in #1499 treats any non-"none" string as active. But describeEmbeddingProvider() emits two different shapes:

// src/triggers/api.ts
function describeEmbeddingProvider(): string {
  const active = getEmbeddingProvider();
  if (active) return `${active.name} (${active.dimensions} dims)`;  // genuinely active
  return detectEmbeddingProvider() ?? "none";                      // may not be active
}

The (N dims) suffix is the only signal that a provider actually came up, because detectEmbeddingProvider() returns the raw env value before any validation:

// src/config.ts
const forced = source["EMBEDDING_PROVIDER"];
if (forced) return forced;

and createEmbeddingProvider() drops anything unrecognized (default: return null).

So when EMBEDDING_PROVIDER is set to an unsupported value, or to local while the Xenova model fails to load, /config/flags returns a bare name with no dims suffix. Under the current PR that renders as ✓ local while search is BM25-only — the exact false positive this issue exists to remove, and the same symptom operators already report in #395 and #931.

Suggested handling: treat the (N dims) suffix as the active marker, e.g. only return a label when the value matches / \(\d+ dims\)$/, and let a bare provider name fall through to bm25-only.

Acceptance check to add

embeddingProvider = "local" (no dims suffix) → bm25-only, so a configured-but-inactive provider cannot render as active.

Environment

agentmemory 0.9.30 (npm), Node v24.21.0, Linux 6.18 WSL2 x64. Verified against a live daemon reporting "openai (1536 dims)" with a non-empty vector index, zero missing observations, and zero pending backfill — i.e. the bm25-only output is purely a display defect.

Rokurolize avatar Oct 11 '26 08:10 Rokurolize