Repository navigation
fix(core): no panics on embedder-less or missing-RRF recall paths; no retry of validation errors - #1443
Merged
Conversation
ensure_embedder only returns Ok once the slot holds an embedder and nothing resets it to None, so the expect was unreachable today. Return an Embedding error instead so a future change cannot turn it into a panic. Adds a test that vector recall on a store with no usable embedder errors rather than panics.
recall_rrf fills rrf_scores and memories in the same loops, so the expect could not fire today. Use filter_map and skip a missing id with a warning instead of panicking if that invariant ever breaks. take(limit) stays before the filter, so the normal path is unchanged.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Oct 13, 2026
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
Defensive hardening in
crates/uteke-core/src/operations.rs, from the #1439 audit:retry_embed, empty embedder slot. It returnsError::Embedding("No embedder configured; the memory was not embedded") instead of panicking onexpect("embedder ensured above").retry_embed, validation errors.Error::Validationis returned at once instead of being retried three times (about 600 ms of sleeps). This matches the existing rule inindex_sync.rs(!matches!(e, Error::Validation(_))).recall_inner. The sameexpectbecomesError::embed_msg("No embedder configured; semantic recall is unavailable").recall_rrf. A scored id missing from the fused memory map is skipped with awarn!instead of panicking..take(limit)stays before the filter.Why
The audit flagged these
expects as panics on user-reachable paths. Investigation showed none of them is reachable in the current code:ensure_embedderreturningOkalways leaves the slotSome.recall_rrffills its score map and its memory map in the same loops.Validationfromembed(); that only happens at construction.So this PR changes nothing on any reachable path. It turns invariants that live in comments and callers' heads into errors, so a future change that breaks them degrades instead of crashing the server.
Benchmark safety. The normal recall/remember paths are unchanged:
takecomes beforefilter_map, which yields the same items when every lookup succeeds.retry_embedis unchanged.Testing
cargo test --workspace: all green (uteke-core 728 passed, 33 ignored ONNX-only).cargo fmt --all -- --checkandcargo clippy --workspace --all-targets -- -D warnings: clean.retry_embed_tests:Error::Embeddingand no panicValidationis called exactly onceembed_msgerror is retried and then succeeds (2 calls)recall_no_embedder_tests::recall_without_embedder_returns_error:recall()on a custom backend with no embedder returns an error, not a panic.ok_or_elsearm inrecall_innerand the RRF skip arm are unreachable today, so they have no tests by design.remember_embedding_status_testsnow returnembed_msginstead ofValidation. They simulate transient and outage failures, which must stay retryable.