Skip to content

fix: degrade to cached and image results when the search engines are down - #2484

Merged
felladrin merged 1 commit into
mainfrom
degrade-gracefully-on-searxng-outage
Aug 28, 2026
Merged

fix: degrade to cached and image results when the search engines are down#2484
felladrin merged 1 commit into
mainfrom
degrade-gracefully-on-searxng-outage

Conversation

@felladrin

@felladrin felladrin commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Description

Currently, when every text-search engine fails (a rate limit or CAPTCHA suspends a SearXNG engine for an hour to a day), the search fails outright, even if the exact same query has a cached result, and the AI response has nothing to ground on.

This PR does three things:

  • Serves the cached results of the same query when the live search fails, flagged stale (a banner in the results list and a disclaimer in the LLM prompt, so the model knows the results may be out of date).
  • Falls back to the image search when the text search fails and image search is on: the answer waits for the image results and grounds on their titles and URLs, tagged (image) in the prompt.
  • Makes the server fail fast (1 request, no backoff) when every unresponsive engine is under a long suspension, since they will not recover within the retry window.

Where to start

Most of the diff is tests (11 new ones, +354 lines). The behavior changes are in client/modules/search.ts (stale fallback plus a read-time age check), client/modules/textGeneration.ts (the image-fallback grounding, and a guard so an older search cannot repopulate a newer one's grounding channel), server/webSearchService.ts (the fail-fast) and the banner in client/components/Search/Results/Textual/TextSearchResults.tsx.

How to test

  1. Run npm test (the new tests cover the stale fallback, the image grounding and the fail-fast).
  2. Run npm run lint.
  3. Note: a real outage needs the engines rate-limited or CAPTCHA'd, which cannot be forced locally, so the degraded UI is covered by tests only for now (the cases are in the docs/failure-injection.md matrix).

@felladrin
felladrin marked this pull request as ready for review August 28, 2026 11:39
@felladrin
felladrin merged commit 04aaa92 into main Aug 28, 2026
6 of 7 checks passed
@felladrin
felladrin deleted the degrade-gracefully-on-searxng-outage branch August 28, 2026 11:39
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