Repository navigation
Description
Problem
Web search has one backend in main: firecrawl_search (HTTP 402 since the credit ran out). PR #3900 (#3876) adds a DuckDuckGo fallback but keeps Firecrawl first and adds a second counter. The owner asked on 2026-11-07 for a local SearXNG. Each provider added as one more except branch makes the code worse. The owner chose not to use the Brave Search API (its terms forbid storing results and it has no free tier), so the chain has no keyed provider for now.
Expected
One entry point web_search(query, *, limit) over a list of providers, in a new module of src/devops_cli/ai/. A SearchHit with url, title, snippet and provider. A SearchProvider protocol with name, configured(settings) and search(query, *, limit). Providers in this item: duckduckgo (the function duckduckgo_search of #3900, moved) and firecrawl (the function firecrawl_search, moved). The next item adds searxng. A later provider with a key needs only a new class and a name in the list.
Settings: new section search with providers (default [searxng, duckduckgo, firecrawl], an unknown name is a validation error) and language (default en). The section joins the section table in config/constants.py. search.searxng_url comes with its provider item.
Order and failover: a provider that is not configured is skipped; a provider that fails (timeout, connect error, 402, 429, 5xx, 401, 403, other 4xx, a reply that is not JSON or has no list) passes the search on at once, with no retry and no sleep; a healthy empty reply also passes it on; the first provider with at least one hit wins; if none answered, SearchFailed is raised; if some answered empty and the rest failed, the result is an empty list. A total deadline of 60 s ends the chain. Dedup of one answer by the normalized URL (the key function of alternatives.py, moved here), the URL scheme must be http or https.
Guard on the query before any provider: refuse an empty query, a query over 400 characters or 50 words, a query that starts with ! or :, and a query that holds a secret (mask_secrets), an e-mail address, a private IP address or an internal host name. SearchQueryRefused is raised and no provider runs.
Callers: cited_web_search, InvestigationTools, AlternativesTools, WebSearch and web_search_of lose the key argument (a provider reads its own credential). The gate: web search is on for a public repository when at least one provider is configured. request_plan.py lists the request of the first configured provider in the dry run and makes no request.
Metric: one counter devops_cli_web_searches_total{backend,result} replaces devops_cli_firecrawl_searches_total and devops_cli_web_search_fallbacks_total (no shim). backend is a provider name or none; result is ok, empty, degraded, error, refused, exhausted or an HTTP status. Change in the same pull request: the alerts RoadmapServiceFirecrawlRefused (rename to RoadmapServiceWebSearchRefused) and RoadmapServiceAlternativesNotSearching, their rule tests, docs/TELEMETRY.md, k8s/README.md, docs/roadmap/alternatives.md, docs/roadmap/refine.md, the messages in lang/en/messages.py, and any dashboard that reads the old names.
Acceptance criteria
- Tests with the HTTP fake fail on the base: the first provider answers and the others do not run; a 402, a 429, a 5xx and a timeout each pass the search to the next provider and count the backend and the result; a healthy empty reply passes on; all providers fail and
SearchFailedis raised; an empty list returns when one answered empty and the rest failed. - A test: an unconfigured provider is skipped and not counted.
- A test: each refused query (secret, e-mail address, private address, leading
!, over the cap) raisesSearchQueryRefusedand sends no request. - A test: a caller (
cited_web_search) turnsSearchFailedandSearchQueryRefusedinto a text answer and does not stop the run. - A test: a log line of a failed attempt holds the backend and the status or class, and never the key or the query.
tests/roadmap/test_roadmap_dry_runs.pystill passes: the dry run makes zero requests.- The Prometheus rule tests for the renamed and changed alerts fail on the base and pass;
git grepfinds nodevops_cli_firecrawl_searches_totaland nodevops_cli_web_search_fallbacks_totaloutsideopenspec/changes/archive. - The generated docs (
devops docs generate --sync-readme) list the sectionsearch, its environment variables and the counter.
Existing tool considered
The code of #3900 (ddgs engine parts through http_client) and the existing firecrawl_search are moved, not rewritten. pydantic-ai search tools are not used: they take no transport, so they skip the egress check (the finding of the #3876 comment of 2026-11-07, SECURITY.md rule 2). No failover library: the rules are 30 lines and the project's HTTP entry point already gives timeouts and the egress check.
Related
Related: #3876 (merge PR #3900 first), #2398, #2650, #3243, #3915, #3877, #2475. Next: the SearXNG provider item.
Part of the search provider plan of 2026-11-07 (SearXNG; the Brave Search API was dropped by the owner on 2026-11-07).
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(ai)scope of the title gives the scope.The current single backend is degraded (HTTP 402), but the system still runs. This is a planned architectural improvement, not a blocking defect.Multiple providers with failover make web search reliable and ready for future providers such as SearXNG and Brave.New module, protocol, settings section, failover logic, query guards, metrics migration, caller updates, alert renames, and tests span many files.Both change web search in src/devops_cli/ai/. #3876 adds a single fallback; the candidate builds a full provider chain with protocol, settings, failover, guards, and metrics.devops-cli-service commentedon Nov 7, 2026
Released in v0.80.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.80.0
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 13:09 UTC
feat(ai): search the web through SearXNG (#3980)