Re-land hybrid web cascade (SerpAPI→browser) dropped by #322 squash-merge#323
Merged
Conversation
…arch returns results The "instead of searching, it showed unrelated local results" report: in auto (internal + web) mode the web leg fanned out to SerpAPI only, so with no SERP_API_KEY the hybrid collapsed to local-only and an absent query (GRPO) surfaced nothing useful. _run_hybrid_search now cascades the auto web leg: try SerpAPI first; if it yields no usable (non-error) docs, fall back to the browser provider when browser_search_url is set. Local retrieval still runs in parallel; the existing _finalize_hybrid dedupe + rerank + MMR picks the final top_k. Explicit single-provider and 'all' modes are unchanged; degrades to unreachable/empty when no web backend is available. Adds test_hybrid_web_fallback.py (fallback-to-browser, skip-when-serpapi-usable, no-web-backend). 153 web/fallback/retrieval tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
PR #322 was squash-merged but only its first commit landed on
main(the zero-relevance filter + BEIR converter). The second commit — the auto-mode hybrid web cascade — never made it: the last commit touchingapp.pyonmainis still#315, and_fetch_web_with_fallback/test_hybrid_web_fallback.pyare absent from master.This PR re-lands that dropped commit (
261d3f3, cherry-picked cleanly onto current main).What
In
auto("internal + web") mode,_run_hybrid_searchnow cascades the web leg: try SerpAPI first; if it yields no usable (non-error) results, fall back to the browser provider (whenbrowser_search_urlis set). Local retrieval runs in parallel; the existing_finalize_hybriddedupe + rerank + MMR top-k picks the final set. Explicit single-provider andallmodes are unchanged; degrades tounreachable/emptywhen no web backend is available.Without this,
autosilently collapses to local-only whenSERP_API_KEYis unset — the original "GRPO shows unrelated local results instead of searching" bug.Testing
tests/unit/servers/web/test_hybrid_web_fallback.py— fallback-to-browser, skip-browser-when-SerpAPI-usable, no-web-backend → unreachable.🤖 Generated with Claude Code