Skip to content

Bug: SearXNG provider ignores Hermes config env values for SEARXNG_URL #34290

@bsbofmusic

Description

@bsbofmusic

Summary

The SearXNG web search provider currently reads SEARXNG_URL only from the process environment via os.getenv(). In Hermes, env values may be supplied through Hermes config / .env handling and are available through hermes_cli.config.get_env_value(), but not necessarily present in the raw process environment.

This can make SearXNG appear unavailable even when it is configured correctly through Hermes' normal config/env mechanism.

Expected behavior

If SEARXNG_URL is configured through Hermes config/env handling, SearXNG should be available and web_search should use it.

Actual behavior

The SearXNG provider can report unavailable / SEARXNG_URL is not set because it only checks:

os.getenv("SEARXNG_URL", "")

This affects both availability checks and the actual search call.

Affected areas

Current source shape uses process env directly in the SearXNG provider:

def is_available(self) -> bool:
    return bool(os.getenv("SEARXNG_URL", "").strip())

base_url = os.getenv("SEARXNG_URL", "").strip().rstrip("/")

tools/web_tools.py has a similar config/env boundary concern for choosing and configuring the web search backend.

Suggested fix

Use Hermes' config-aware env lookup first, then fall back to process env:

def _get_env_value(name: str) -> str:
    try:
        from hermes_cli.config import get_env_value
        val = get_env_value(name)
    except Exception:
        val = None
    if val is None:
        val = os.getenv(name)
    return (val or "").strip()

Then use _get_env_value("SEARXNG_URL") in both is_available() and search().

Why this matters

This is not about a user preference such as default result count. It is a configuration consistency bug: a backend configured through Hermes' own config/env system should not be invisible to the provider because only raw process env is checked.

Local verification

I have a local patch with regression coverage for:

  • SearXNG availability using config-aware env lookup
  • search call reading SEARXNG_URL through the same helper
  • existing process-env fallback still working

No secrets or private URLs are included in this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/toolsTool registry, model_tools, toolsetstool/webWeb search and extractiontype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions