You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tech-debt(rag): two hybrid-search implementations — one reachable only from a validator #17599
HybridSearchEngine (autobot-backend/utils/hybrid_search.py:133, 507 lines) has exactly one
caller: autobot-backend/utils/system_validator.py:894 — a validator, not a production path.
The live RAG path uses a different hybrid implementation, the BM25 route in autobot-backend/advanced_rag_optimizer.py:475 landed by #10600.
So we carry two implementations of one concept, and the more elaborate one is wired only to a
self-check. Per consolidate, never fork, one of these is unwired machinery.
Note its keyword scorer is a hand-rolled word-frequency map
(_build_word_frequency_map, line 67) — naive TF, not BM25 — so it is also the weaker of the two.
Acceptance criteria
One hybrid-search implementation remains, named once, reachable from the production path
The retained implementation uses BM25, not substring TF
system_validator validates the retained implementation, not a private copy
No behaviour is deleted — capability in the dropped copy is carried over or explicitly
recorded as unwanted with a reason
Closure evidence (merged in merge train #18358, 13be1b4; constituent #18348 plus a train fix). Verified against main.
One hybrid implementation, named once, on the production path: the validator-only HybridSearchEngine (utils/hybrid_search.py) is deleted, after a zero-code-callers check. The canonical path is KnowledgeBase.search in hybrid mode (HybridSearcher).
The retained implementation uses BM25: the canonical HybridSearcher fuses BM25 with semantic results (RRF).
system_validator validates the retained implementation: this needed a train fix (a060ea5). The original call kb.search(..., top_k=5, mode=HYBRID) took _search_basic, which drops mode, so the validator never reached HybridSearcher. It now passes limit=5, which selects the enhanced path, and reads results from the dict response (autobot-backend/utils/system_validator.py, validate_hybrid_search). CodeRabbit found the gap on the train PR; the merger verified it against knowledge/search.py's dispatch.
Activity
fix(validator): the hybrid-search check runs the enhanced path, so it…
mrveiss commentedon Oct 12, 2026
Closure evidence (merged in merge train #18358, 13be1b4; constituent #18348 plus a train fix). Verified against
main.HybridSearchEngine(utils/hybrid_search.py) is deleted, after a zero-code-callers check. The canonical path isKnowledgeBase.searchin hybrid mode (HybridSearcher).HybridSearcherfuses BM25 with semantic results (RRF).system_validatorvalidates the retained implementation: this needed a train fix (a060ea5). The original callkb.search(..., top_k=5, mode=HYBRID)took_search_basic, which dropsmode, so the validator never reachedHybridSearcher. It now passeslimit=5, which selects the enhanced path, and readsresultsfrom the dict response (autobot-backend/utils/system_validator.py,validate_hybrid_search). CodeRabbit found the gap on the train PR; the merger verified it againstknowledge/search.py's dispatch.explain_searchandextract_keywords.