Lazy corpus mode (>10k observations) silently disables all new vector writes, and vector-backfill reports success without embedding anything
Summary
Once a project's observation store crosses the Orama hydration threshold (10,000 durable rows), every process runs in "lazy" corpus mode. In that mode no new observation can ever receive a vector, and the queued vector-backfill maintenance job always reports success without embedding anything. Semantic recall silently degrades to lexical-only for all new memories while search keeps working, so nothing surfaces the problem except a stderr line.
Environment
- memorix v1.10.2 (global npm install), Node v24.15.0, Windows 11
- Observation store backend: SQLite, with the persistent lexical (FTS) index present
- Embedding:
api-qwen3-embedding:8bvia an OpenAI-compatible endpoint, 4096d - Persistent vector table (Lance):
observations_e6c8f449f7452a637d49— 46,058 rows,FixedSizeList[4096] - Corpus: 55.6k observations total, 36.5k in a single project
Symptom
[memorix] Embedding dimension mismatch for obs-64396: provider returned 4096d, index expects unknown (kept in backfill queue)
New observations are missing from the Lance vector table, and the queue that is supposed to fix them stays quiet.
Root-cause chain
Line numbers are from the bundled dist/index.js of 1.10.2.
-
Lazy mode never hydrates Orama.
DEFAULT_ORAMA_HYDRATION_THRESHOLD = 1e4(:154990). WhendurableCount >= threshold && store.hasLexicalIndex()(:154055-154066) the in-memory corpus is dropped, andprepareSearchIndex()short-circuits without touching Orama (:154750-154758):if (largeCorpusLazyMode && getObservationStore().hasLexicalIndex?.()) { searchIndexPrepared = true; ... return 0; } -
So the embedding schema is never present.
getVectorDimensions()returnsnullbecauseembeddingEnabledisfalse(:9103) — this is theindex expects unknownin the log. Every write therefore failsisVectorCompatibleWithCurrentIndex(). -
The self-heal path is unreachable in exactly this mode.
upgradeVectorSchemaAfterFirstEmbedding()(:154029-154040) callsreindexObservations()(:154673), whose first statement isif (observations.length === 0) return 0;(:154674). In lazy modeobservationsis always empty, so the schema upgrade is a no-op and the mismatch repeats on every write. -
The backfill is a no-op too (the important part).
getVectorStatus()derivesmissingfrom the in-memoryobservationsarray (:154800-154809).- The maintenance handler does
const before = getVectorStatus2(projectId); if (before.missing === 0) { ... return { action: "complete" }; }(:153536-153540). backfillVectorEmbeddings()builds its candidate list from that same empty array (:154829-154842).
In lazy mode this means: handler sees
missing === 0→ completes in ~100 ms →vector-backfilljobs are recorded ascompletedwhile zero vectors are written. -
The only working path is never launched by default.
executeVectorBackfill()(:153790-153815) is correct — it callsinitObservations(dataDir, { forceCorpusLoad: true })— butqueueVectorBackfill()only spawns it whenembeddingWriteMode === "deferred"(:154079). With the defaultbackgroundmode nothing ever launches it.
Also related, mid-write transition: persistObservation() flips a process into lazy mode and calls resetDb() immediately after committing a write (:154286-154292), which strands that in-flight observation's embedding.
Measured impact (this instance)
Active observations vs. presence in the Lance table, matched by (project_id, observation_id):
| project | active | missing vector | ratio |
|---|---|---|---|
| media/x-spider | 1,910 | 782 | 41% |
| ai/skills | 736 | 147 | 20% |
| ai/understudy | 642 | 637 | 99% |
| local/zcode-profiler | 169 | 71 | 42% |
| ai/agent-sync | 53 | 46 | 87% |
Degradation was monotonic as lazy-mode processes took over, for the largest project (per day created):
| day | active created | missing |
|---|---|---|
| 10-27 | 99 | 2 |
| 10-28 | 38 | 4 |
| 10-29 | 25 | 3 |
| 10-30 | 12 | 4 |
| 10-31 | 24 | 5 |
| 11-01 | 97 | 39 |
| 11-02 | 232 | 228 |
| 11-03 | 497 | 490 |
The highest observation_id present in the vector table is 64,222 (2026-11-03T16:13:33Z); the next observation, 64,223 (16:14:00Z, hook-sourced), has none, and neither does anything after it.
A live CLI process confirms the state indirectly: memorix memory search --json reports retrieval.derivedViews.orama.generation = 0.
How to reproduce
- Prepare a store with > 10,000 durable observations and the SQLite lexical (FTS) index built, or force the state with
MEMORIX_ORAMA_HYDRATION_THRESHOLD=1after one observation + index build. - In a long-lived process (MCP server /
serve-http), write a new observation. - Observe
Embedding dimension mismatch ... index expects unknownon stderr. - Inspect the semantic vector table: row count does not grow.
- Inspect
maintenance_jobs: thevector-backfillrows transition tocompletedandgetVectorStatus().missingis0throughout.
Suggested directions
- Source backfill candidates from the store, not from the in-memory corpus: diff
getPersistentSemanticVectorIds(dataDir)(orstore.loadByProject) against observations lacking vectors, so lazy mode can still backfill. - Same for
getVectorStatus()—missingshould not be0merely because the corpus was not hydrated. - Let
upgradeVectorSchemaAfterFirstEmbedding()create the Orama embedding schema from the provider's dimensions without requiringreindexObservations()over a loaded corpus (the schema only needsembeddingDimensions, not the documents). - Consider not treating a
vector-backfilljob ascompletedwhen the process is in lazy mode and nothing was attempted; at minimum reportattempted: 0distinctly.
Fixed in main via PR #376. Lazy corpus mode now initializes the vector schema without hydrating the full Orama corpus, reconciles missing IDs from SQLite/Lance, tracks project ownership for missing vectors, and lets maintenance backfill directly from the durable store. The change is included in tag v1.10.3.