Skip to content

Re-land hybrid web cascade (SerpAPI→browser) dropped by #322 squash-merge#323

Merged
lingduoduo merged 1 commit into
mainfrom
fix/hybrid-web-cascade-relanded
Jun 23, 2026
Merged

Re-land hybrid web cascade (SerpAPI→browser) dropped by #322 squash-merge#323
lingduoduo merged 1 commit into
mainfrom
fix/hybrid-web-cascade-relanded

Conversation

@lingduoduo

Copy link
Copy Markdown
Owner

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 touching app.py on main is still #315, and _fetch_web_with_fallback / test_hybrid_web_fallback.py are 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_search now cascades the web leg: try SerpAPI first; if it yields no usable (non-error) results, fall back to the browser provider (when browser_search_url is set). Local retrieval runs in parallel; the existing _finalize_hybrid dedupe + rerank + MMR top-k picks the final set. Explicit single-provider and all modes are unchanged; degrades to unreachable/empty when no web backend is available.

Without this, auto silently collapses to local-only when SERP_API_KEY is 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.
  • 28 web + execution-fallback + browser-pipeline tests pass.

🤖 Generated with Claude Code

…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>
@lingduoduo lingduoduo merged commit 34203e1 into main Jun 23, 2026
5 of 6 checks passed
@lingduoduo lingduoduo deleted the fix/hybrid-web-cascade-relanded branch June 23, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant