perf(skills): use embed_batch in embed_skills_with_timeout#6532
Merged
Conversation
embed_skills_with_timeout looped over skills one at a time, paying N sequential network round trips even against providers with a native batch embeddings endpoint. It now tries LlmProvider::embed_batch first under a single timeout for the whole batch, falling back to the original per-item sequential loop on batch error, timeout, or a mismatched result count, so the existing partial-failure tolerance is preserved. Closes #6481
bug-ops
enabled auto-merge (squash)
July 20, 2026 00:59
bug-ops
force-pushed
the
fix/6481-embed-batch-skills
branch
from
July 20, 2026 00:59
4560edd to
6df9ef7
Compare
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
embed_skills_with_timeout(crates/zeph-skills/src/embedding.rs) now triesLlmProvider::embed_batchfirst, wrapped in a singletimeoutfor the whole batch, instead of embedding each skill sequentially — providers with a native batch endpoint (e.g. OpenAI) now cost one round trip instead of N.embed_skills_sequential) on batch error, timeout, or a mismatched result count, preserving the existing partial-failure tolerance (one bad or slow skill no longer loses the rest).SkillMiner, trace-based skill extraction) are unaffected — the public function signature is unchanged.Adversarial critique confirmed the result set is byte-identical to the original in every traced case; two minor, non-blocking notes worth surfacing:
(N+1)×timeout(fresh budget for the fallback) instead ofN×timeout.Note: found a pre-existing, unrelated rustdoc broken-intra-doc-link issue in
crates/zeph-skills/src/matcher.rs([Self::Qdrant]referencing a variant absent under some feature combinations), confirmed to exist on unmodifiedmainviagit stash. Out of scope here; filing as a separate follow-up issue.Closes #6481
Test plan
cargo nextest run -p zeph-skills— 573/573 passed (5 new tests, including a regression test proving partial-failure tolerance survives the batch→fallback transition)cargo +nightly fmt --checkcleancargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscleancargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 14805/14805 passedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"cleangitleaks protect --staged --no-banner --redact— no leaks