Skip to content

fix(k8s): SearXNG engines are throttled from the cluster #4141

Done

Description

@dan-petty

Problem or Motivation

The pinned SearXNG in namespace devops is throttled by several engines when it runs from the cluster. A web search through it often returns few hits or none, and the chain then falls through to DuckDuckGo (the ddgs library) and Firecrawl (src/devops_cli/ai/web_search.py).

Facts from the cluster on 2026-11-08 (read only, kubectl -n devops logs deploy/searxng --since=3h):

  • duckduckgo: 6 SearxEngineCaptchaException ("CAPTCHA (us-en)", suspended_time=0). With suspended_time=0 SearXNG does not suspend the engine, so the next query hits the CAPTCHA again.
  • superuser, stackoverflow, askubuntu and arxiv: "Too many request (suspended_time=180)". Each of these engines was suspended for 180 s.
  • stackoverflow, superuser and askubuntu: HTTP 400 from api.stackexchange.com/2.3/search/advanced (no key in the request). The reply body is not in the log, so the cause of the 400 is not proven. The Stack Exchange documentation names HTTP 400 for error 502, throttle_violation. This must be checked.
  • devops k8s searxng-check (PR feat(k8s): add the searxng-check command #4136) got 1 hit for the plain general category while DuckDuckGo was CAPTCHA-blocked, 50 hits for it and 10 for science.

Part of this load is self-inflicted: the live check and manual queries ran in the same window. A Service that runs refine and alternatives sends fewer queries. So the facts do not yet show if the cause is the query rate or a flag on the cluster egress address.

The engine set is in k8s/devops/searxng/configmap.yaml (keep_only: duckduckgo, wikipedia, github, stackoverflow, askubuntu, superuser, arxiv, mdn, docker hub). The decision not to add a retry loop (#4094, merged) stands. Related: #3929 and #4136 (searxng-check), #3877 (research ADR).

Proposed Solution

  1. Measure first, change nothing before. Read devops_cli_web_searches_total by backend and result for a few days of the real Service. Write the query rate for each backend and the share of each result in this issue. Split the rate into Service traffic and check or manual traffic.
  2. Tell the two causes apart. A throttle that follows the rate falls when the rate falls. A flag on the egress address does not. Compare the result share at a low-rate hour with the share at a high-rate hour. Send the same query once from a different egress address if a person can do it.
  3. Fix at the source. The choice depends on step 2. The options, from least to most work:
    • Remove an engine that needs a key-free scrape from one address and gives little (for example duckduckgo as an engine, because the chain already has ddgs, or the three Stack Exchange engines).
    • Set a per-engine suspension in the SearXNG settings so that a CAPTCHA suspends the engine and does not repeat at once.
    • Use a Stack Exchange API key. It is a Secret, so a person must create it.
    • Add a rate limit in the provider (web_search.py), at the Service side.
    • Accept the fallback and document it in the README.
  4. Add the check named under Acceptance.

Feasibility

Step 1 is feasible now: the metric exists (src/devops_cli/telemetry/instruments.py, devops_cli_web_searches_total). The log facts above were read from the live pod. The cause of the HTTP 400 and the split between rate and address are not yet known. The change to the cluster waits for the measure.

Acceptance Criteria

  • The issue holds the measure: the query rate for each backend and the result share, over at least 3 days.
  • A command or test that fails today, for example a test over the searxng-settings ConfigMap that checks the chosen engine set (no engine in keep_only that the measure shows as blocked by the cluster egress address), and a devops k8s searxng-check run that gets hits for the general category.
  • The cause is named: query rate or the cluster egress address.
  • No retry loop is added (fix(k8s): SearXNG engines time out or return no hit #4094).

Proposed design

Problem statement

Web search through the pinned SearXNG in namespace devops returns few hits or none. Several key-free engines are throttled or refused from the cluster egress address, and the chain falls through to ddgs and Firecrawl. The change removes the three Stack Exchange engines, which return HTTP 400 on every request without an API key, so the it results come only from engines that answer.

Acceptance criteria

Requirement: The settings keep no Stack Exchange engine

The searxng-settings ConfigMap SHALL keep none of stackoverflow, askubuntu and superuser in engines.keep_only.

Scenario: The rendered engine set

  • WHEN the invariant test renders k8s/devops/searxng/configmap.yaml and reads engines.keep_only
  • THEN the list holds duckduckgo, wikipedia, github, arxiv, mdn and docker hub, and holds none of the three Stack Exchange names

Requirement: The README lists the kept engines

k8s/README.md SHALL list the six kept engines and SHALL NOT list stackoverflow, askubuntu or superuser.

Scenario: The README agrees with the ConfigMap

  • WHEN the invariant test reads the engine paragraph of k8s/README.md
  • THEN each of the six kept names is present and none of the three removed names is present

Requirement: The ConfigMap comment records the cause

The comment of k8s/devops/searxng/configmap.yaml SHALL name the HTTP 400 of api.stackexchange.com and SHALL say that the three engines need an API key.

Scenario: The comment names the 400

  • WHEN the invariant test reads the comment block of the ConfigMap
  • THEN the comment holds HTTP 400, api.stackexchange.com and API key

Requirement: The provider chain keeps one attempt for each provider

web_search SHALL ask each provider at most once for one search.

Scenario: A failed provider passes the search on

  • WHEN the first provider raises an HTTP error and the second provider returns one hit
  • THEN the first provider is called once, the second provider is called once, and the search returns the hit

Existing Tool Considered

No alternatives check has run. SearXNG, pinned in k8s/devops/searxng/deployment.yaml, and the ddgs library already cover the need, and this change adds no code that the project keeps: it edits one ConfigMap, one README section and one invariant test. What they lack: a key-free engine that answers from the shared cluster egress address. stackoverflow, askubuntu and superuser need a Stack Exchange API key, and a person creates that Secret.

Key questions

  • Which engines leave keep_only now, before the measure?: Remove stackoverflow, askubuntu and superuser. Each returned HTTP 400 from api.stackexchange.com on every request in the 3-hour log, with no key in the request. A key is a Secret that a person creates, so the keyed engines wait. (best practice) [sources: k8s/devops/searxng/configmap.yaml:30, k8s/README.md:843, openspec/specs/searxng-service/spec.md]
    • Chosen: Remove the three Stack Exchange engines. They return no hit without an API key. The living spec requires that the settings keep no engine that never answers.
    • Rejected: Keep them and add an API key. The key is a Secret that a person creates, so the change waits on a person. The deferred issue holds it.
    • Rejected: Keep them unchanged. They add one request on each 180 s suspension and return no hit.
  • Does duckduckgo stay in keep_only?: Yes. It is the only general engine that returns hits. The engine raises its CAPTCHA with no suspension, so the next query repeats it. The deferred measure fixes that defect. (best practice) [sources: k8s/README.md:843, k8s/devops/searxng/configmap.yaml:31, src/devops_cli/ai/web_search.py]
    • Chosen: Keep duckduckgo. It is the only general engine with hits. The ddgs provider sends the same request from the same address, so a removal moves the load and does not cut it.
    • Rejected: Remove duckduckgo. The general category would return no hit from SearXNG, and the ddgs provider would send the same request.
    • Rejected: Set search.suspended_times for the CAPTCHA. The README records that the engine raises the CAPTCHA with no suspension, so the settings value does not apply. The deferred issue checks this against the pinned image.
  • How does the change prove the new engine set offline?: Extend tests/invariants/test_k8s_searxng.py. The test renders the ConfigMap and reads the README, so it needs no cluster. (best practice) [sources: tests/invariants/test_k8s_searxng.py, tests/commands/k8s/test_k8s_searxng_check.py]
    • Chosen: Extend the invariant test. It reads the ConfigMap and the README, so it runs offline and fails before the change.
    • Rejected: Rely on devops k8s searxng-check. It needs the live pod, so it is no offline check.
  • Does the change add a retry loop to the provider chain?: No. A provider that fails passes the search on at once, as fix(k8s): SearXNG engines time out or return no hit #4094 decided. A test holds this. (best practice) [sources: src/devops_cli/ai/web_search.py, tests/ai/test_web_search.py]
  • Which engines does keep_only hold today?: Nine: duckduckgo, wikipedia, github, stackoverflow, askubuntu, superuser, arxiv, mdn and docker hub. [sources: k8s/devops/searxng/configmap.yaml:30, k8s/README.md:843]
  • Which labels does devops_cli_web_searches_total hold?: backend and result. The backend is the provider name or none, and the result is ok, empty, an HTTP status, degraded, error, refused or exhausted. [sources: src/devops_cli/telemetry/instruments.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-18: in-use.
The repository already uses this tool.
Tool: searxng/searxng (https://github.com/searxng/searxng), AGPL-3.0, last activity 2026-11-18, maintained.
Reason: Searches found SearXNG, the metasearch engine the cluster already runs, as the maintained open tool that holds the whole fix: the engine allow-list, per-engine suspension and engine keys. The issue needs a settings change, not a new tool.

Covers:

  • Metasearch over many key-free engines from one endpoint
  • Engine allow-list through keep_only in the settings
  • Per-engine suspension and engine API-key settings
  • No key and no user store for the search path

Lacks:

  • No per-backend query-rate or result-share metric
  • CAPTCHA can repeat when an engine sets no suspension
  • No way to tell query rate from an egress-address flag
  • Stack Exchange engines need a Secret that a person creates

Activity

  1. added
    source/agent
    type/bug
    scope/k8s
    status/new
    value/medium
    effort/high
    on Nov 8, 2026
  2. dan-petty commented on Nov 8, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium.
    • Value: Medium.
    • Effort: High.
  3. added
    priority/p2-medium
    on Nov 8, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 9, 2026
  5. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 91ee652 (see proposed design in issue body).

    Moved to new items: #4201.

  6. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found SearXNG itself — an open, actively maintained metasearch engine that the project already pins in the cluster — which covers the need: it aggregates many key-free engines and lets its settings choose the engine set and the per-engine suspension. No maintained drop-in replacement turned up that would make the upstream engines answer from a shared egress address; the remaining gaps are the keyed Stack Exchange engines and the per-provider rate limit, which sit outside the engine.

    The item already names this tool.

    Tool: searxng/searxng (https://github.com/searxng/searxng)

    • License: AGPL-3.0
    • Last activity: 2026-11-09
    • Maintained: yes

    Covers:

    • Metasearch aggregation over many key-free engines from one self-hosted service, which is already the pinned backend in namespace devops
    • The engine set is chosen in settings (engines.keep_only), so the three key-less Stack Exchange engines leave with one ConfigMap edit and no code change
    • Per-engine suspension settings exist so an engine that raises a CAPTCHA or a too-many-requests reply can be suspended instead of repeating at once
    • The chain already falls back to the ddgs library for the general category, so removing an engine moves no load onto a new tool

    Lacks:

    • No key-free Stack Exchange access: stackoverflow, askubuntu and superuser need an API key, which is a Secret a person creates
    • Cannot make an upstream engine answer from a cluster egress address that the engine has flagged; that depends on query rate and the upstream service
    • No per-provider rate limit at the Service side; that belongs in web_search.py, not in the engine
    • No offline check of the chosen engine set; that needs a test over the rendered ConfigMap and README

    Tools considered:

    Searches run:

    • SearXNG engine suspended_time CAPTCHA duckduckgo configuration, results: 5
    • self-hosted metasearch engine alternative to SearXNG maintained, results: 5
    • SearXNG GitHub repository metasearch engine, results: 5
    • Whoogle Search 4get LibreY metasearch engine self-hosted, results: 5
    • duckduckgo search library python ddgs, results: 5
    • searxng, results: 5
    • metasearch, results: 5
    • ddgs, results: 5
    • librey, results: 5
    • Whoogle, results: 5

    Sources:

    Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.

  7. added
    owner/service
    and removed
    owner/service
    on Nov 20, 2026
  8. 8 remaining items

  9. added 5 commits that reference this issue on Nov 21, 2026
  10. added
    status/planned
    and removed
    status/ready
    on Nov 21, 2026
  11. added
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 25, 2026
  12. removed
    status/in-review
    on Nov 25, 2026
  13. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 04:21 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions