Stored vectors are only searchable with the model, dimension and prefixes that produced them, and nothing enforces that. Changing [embedding] in llm.toml, or the embed model behind llama-swap, without running reembed_embeddings silently breaks similarity search. Today the only guards are a comment and the per-row dim check.
Proposal
Store a fingerprint of the embedding contract (backend + model id + dim + hash of the query/document prefixes) once, in a small table or a user_ai_prefs-style single row, written by reembed_embeddings and on the first embed into an empty corpus.
At startup, compare it with the resolved [embedding] config. On a mismatch, log an error naming both sides and the fix (reembed_embeddings). Refuse to embed, or only warn? To decide.
model_version columns already carry per-row labels (LocalLlm::embedding_model_version). Decide whether the fingerprint replaces or complements them.
Notes
Follow-up from the llm.toml work (branch feat/llm-config-file, ADR-0003). That branch's startup check already warns when llama-swap's embed metadata.dim differs from embedding.dim. It doesn't catch prefix or model swaps of the same width.
Needs a migration. Back up the prod DB and prove the change on a copy first.
## Problem
Stored vectors are only searchable with the model, dimension and prefixes that produced them, and nothing enforces that. Changing `[embedding]` in `llm.toml`, or the `embed` model behind llama-swap, without running `reembed_embeddings` silently breaks similarity search. Today the only guards are a comment and the per-row dim check.
## Proposal
- Store a fingerprint of the embedding contract (backend + model id + `dim` + hash of the query/document prefixes) once, in a small table or a `user_ai_prefs`-style single row, written by `reembed_embeddings` and on the first embed into an empty corpus.
- At startup, compare it with the resolved `[embedding]` config. On a mismatch, log an error naming both sides and the fix (`reembed_embeddings`). Refuse to embed, or only warn? To decide.
- `model_version` columns already carry per-row labels (`LocalLlm::embedding_model_version`). Decide whether the fingerprint replaces or complements them.
## Notes
- Follow-up from the llm.toml work (branch `feat/llm-config-file`, ADR-0003). That branch's startup check already warns when llama-swap's embed `metadata.dim` differs from `embedding.dim`. It doesn't catch prefix or model swaps of the same width.
- Needs a migration. Back up the prod DB and prove the change on a copy first.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Stored vectors are only searchable with the model, dimension and prefixes that produced them, and nothing enforces that. Changing
[embedding]inllm.toml, or theembedmodel behind llama-swap, without runningreembed_embeddingssilently breaks similarity search. Today the only guards are a comment and the per-row dim check.Proposal
dim+ hash of the query/document prefixes) once, in a small table or auser_ai_prefs-style single row, written byreembed_embeddingsand on the first embed into an empty corpus.[embedding]config. On a mismatch, log an error naming both sides and the fix (reembed_embeddings). Refuse to embed, or only warn? To decide.model_versioncolumns already carry per-row labels (LocalLlm::embedding_model_version). Decide whether the fingerprint replaces or complements them.Notes
feat/llm-config-file, ADR-0003). That branch's startup check already warns when llama-swap's embedmetadata.dimdiffers fromembedding.dim. It doesn't catch prefix or model swaps of the same width.