Repository navigation
refactor(core): one way to ask for an embedding (#1538) - #1546
Merged
Merged
Conversation
Lazy init, the embedder lock and the retry live in embedding.rs; the ten call sites ask it and the five expect() panics are gone. Query, document and room embedding now retry like writes.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Oct 22, 2026
Closed
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.
What
embedding.rs:Uteke::embed(lazy init + retry),embed_once(no retry) andembedder_max_seq_len. The embedder lock is held for one call, never across a loop.embed_text, writes, reembed) use it; the fiveexpect("embedder ensured above")are gone and nothing outsideembedding.rslocks the embedder.reembedtakes the lock per row instead of for the whole loop and still makes one attempt per row. Writes keep their policy: init failure is an error, generation failure is FTS5-only with a warning.Why
#1538, part of #1543. Four patterns for the same call meant retry on writes only, panics that were safe only by call order, and a lock held across the reembed loop.
Testing
embed_textretry once; a persistent failure errors after 3 attempts;embed_oncedoes not retry; a write that cannot embed is FTS5-only with a warning; reembed makes one attempt per row.cargo test --workspace(core lib 877 passed, 0 ignored), clippy-D warnings, fmt.