fix(skills): normalize :latest suffix in embedding model name comparison#2910
Merged
fix(skills): normalize :latest suffix in embedding model name comparison#2910
Conversation
EmbeddingRegistry::sync used string equality to compare the stored embedding model name against the config value. Ollama silently appends :latest when no tag is specified, so configs with "model" and collections populated with "model:latest" triggered a full collection recreation and re-embedding of all skills on every startup (~3-4 minutes for 123 skills). Three-part fix: - Add normalize_model_name() that strips :latest before comparison (Ollama-specific, applied at comparison time only, no stored data change) - Replace sequential embed loop with buffer_unordered(4) and add concurrency: usize field (default 4, clamped to 1 minimum) - Add on_progress callback to EmbeddingRegistry::sync; wire to session.status_tx in agent/mod.rs to emit "Syncing skills: N/M" in real time during re-embedding (TUI spinner compliance) Closes #2894
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2894 — TUI hangs 3-4 minutes at startup when the config specifies
nomic-embed-text-v2-moebut the Qdrantzeph_skillscollection was populated withnomic-embed-text-v2-moe:latest.Root cause:
EmbeddingRegistry::syncused string equality for model name comparison. Ollama silently appends:latestwhen no tag is specified, so a bare model name in config always mismatched the stored tag, triggering a full collection recreation and sequential re-embedding of all skills.Changes
normalize_model_name()strips:latestsuffix before comparison (Ollama-specific, documented in comment). Applied at comparison time only; stored Qdrant payloads are not modified, no migration needed.buffer_unordered(concurrency)whereconcurrency: usizedefaults to 4, clamped to minimum 1. Each future returns(key, hash, Result)in completion order; individual failures warn+skip without aborting the batch.on_progress: Option<Box<dyn Fn(usize, usize) + Send>>callback added toEmbeddingRegistry::sync, called in real time inside the streaming loop (not after collect). Wired inagent/mod.rsviasession.status_txto emit"Syncing skills: N/M"to the TUI spinner. No Channel trait changes.Test plan
normalize_model_name("model:latest")→"model"— unit test addednormalize_model_name("model:v2")→"model:v2"— unit test added (only:lateststripped)model_has_changed_latest_vs_bare_is_false— root cause of tui hangs at startup due to full skill re-embedding when embedding model name lacks :latest suffix #2894 covered by unit testconcurrency_zero_clamped_to_one— guard unit test addedon_progressand partial failure marked#[ignore](require Qdrant)cargo nextest run --workspace --features full --lib --bins— 8166 passedcargo clippy --workspace --features full -- -D warnings— cleancargo +nightly fmt --check— clean