feat(retrieval): wire the cross-encoder reranker into kb.context#441
feat(retrieval): wire the cross-encoder reranker into kb.context#441nickmopen wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
vouch already fuses lexical + semantic hits by reciprocal-rank fusion and already ships a cross-encoder reranker, but the reranker was only reachable from `vouch search --rerank`. the context-pack path that actually feeds agents (build_context_pack -> _retrieve -> kb.context) never reranked, and there was no config to turn it on. add retrieval.rerank.enabled (default false) and retrieval.rerank.top_k (default: the query's context limit) in config.yaml. when enabled, fused hybrid hits are reordered by embeddings.rerank.rerank before scoping filters run, mirroring the existing --rerank cli path. degrades to the fused order if the reranker extra isn't installed. off by default, so existing rankings are unaffected. Fixes vouchdev#429
a20cca0 to
7ab4f5a
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
What changed
Wires the existing cross-encoder reranker (
embeddings/rerank.py, already used byvouch search --rerank) into thekb.context/kb.searchhybrid retrieval path incontext._retrieve, behind a newretrieval.rerankconfig block.Why
vouch already fuses lexical + semantic hits by reciprocal-rank fusion (
embeddings/fusion.py:rrf_fuse, wired intocontext._retrieve) and already ships a finished cross-encoder reranker, but the reranker was only reachable from one place —vouch search --rerankincli.py. The context-pack path that actually feeds agents (build_context_pack→_retrieve→kb.context) never reranked, and there was no config to turn it on. Fixes #429.What might break
retrieval.rerank.enableddefaults tofalse, sokb.context/kb.searchordering is byte-identical to today until a kb opts in. When enabled, only the ordering of hybrid-backend hits changes (never membership — archived/superseded claims stay excluded as before); if the optional reranker extra (sentence-transformers) isn't installed, it silently degrades to the unreranked fused order rather than raising.VEP
Not a surface change — no new
kb.*method, no object-model or on-disk-layout change, no audit-log-shape change.kb.context/kb.searchgain an internal, opt-in reordering stage.Tests
make check(lint + mypy + pytest) — clean on the touched files. Full local suite: 1012/1020 passed (excludingtests/embeddings); the 8 pre-existing failures and 2 excluded modules (test_http_server.py,test_http_server_mcp.py, which bind real sockets) are Windows-local environment artifacts unrelated to this change — identical failure set before and after this diff.tests/test_retrieval_backend.py, following that file's existing monkeypatch pattern so they run under the base CI install without thesentence-transformersextra:test_rerank_disabled_by_default_ordering_unchanged(asserts the reranker is never even constructed when off),test_rerank_enabled_reorders_by_cross_encoder_score(on/off parity plus reordering via a stub reranker),test_rerank_missing_extra_degrades_to_fused_order(ImportError degrades cleanly).CHANGELOG.mdupdated under## [Unreleased].Fixes #429