feat: fixed-alpha weighted-RRF on the warm search path#587
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_902cc7f1-2f04-4ae0-9875-86ac38db6998) |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
|
You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d11c9f2575
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| profile_scope=profile_scope, | ||
| brainbar_helper_fast_profile=brainbar_helper_fast_profile, | ||
| consumer_scope=consumer_scope, | ||
| warm_rrf=True, |
There was a problem hiding this comment.
Route smart brain_search calls through warm RRF
Adding warm_rrf=True here only covers the generic _search path. For brain_search queries that match the smart-route signals, such as “previously …” or “history of …”, _brain_search_dispatch returns _think/_recall before reaching this call, and those engine paths still call store.hybrid_search without warm_rrf, so a subset of warm MCP brain_search traffic keeps the legacy trigram/three-leg fusion instead of the new fixed-alpha two-leg behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in recovery PR #588. Engine think/recall now accept and forward warm_rrf, and the smart MCP dispatch enables it for both routes; route-level tests assert the flag.
Summary
brain_searchtraffic only0.25and add call-timeBRAINLAYER_RRF_ALPHAoverride with finite validation/clampingdegraded: truewhile preservingsearch_modeandfallback_reasonStack
This PR is stacked on #584 (
feat/boost-confound-optin). Merge #584 first, then retarget/rebase this PR tomainbefore deleting the base branch.Test plan
Note
Medium Risk
Changes ranking for all warm MCP search traffic and removes trigram recall on that path; mis-tuned
BRAINLAYER_RRF_ALPHAcould skew vector vs lexical balance, though legacy paths are unchanged.Overview
Introduces a warm interactive search path for MCP
brain_search(standard hybrid and entity KG hybrid) by passingwarm_rrf=Trueintohybrid_search.When
warm_rrfis on, fusion is vector + FTS only: trigram FTS retrieval, candidate union, and trigram scoring are skipped; RRF uses a shared_weighted_rrf_scorehelper with default vector weight 0.25, overridable viaBRAINLAYER_RRF_ALPHA(validated and clamped to [0, 1]). Non-warm callers keep the legacy trigram leg and prior fusion behavior.Hybrid cache keys now include
warm_rrfand the effective alpha so warm vs legacy results do not collide.When embedding fails or times out and search runs as FTS fallback, structured responses add
degraded: truealongside existingsearch_modeandfallback_reason(empty, compact, and full result shapes).Reviewed by Cursor Bugbot for commit d11c9f2. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add fixed-alpha weighted RRF fusion to
hybrid_searchwarm search pathwarm_rrfflag toSearchMixin.hybrid_searchin search_repo.py that switches scoring to a two-leg (semantic + FTS) weighted RRF, dropping the trigram leg entirely.BRAINLAYER_RRF_ALPHAenvironment variable at runtime, clamped to [0.0, 1.0], with a fallback to the existingRRF_VECTOR_ALPHAconstant.warm_rrf=Trueinto allhybrid_searchcalls and into the KG hybrid search dispatcher.degraded: Truealongsidefallback_reason.warm_rrfand the effective alpha value, so existing warm-path cache entries will miss after this change.Macroscope summarized d11c9f2.