Skip to content

fix(web): honor plugin-registered backend availability - #38375

Closed
leeska wants to merge 1 commit into
NousResearch:mainfrom
leeska:fix/web-plugin-backend-availability
Closed

fix(web): honor plugin-registered backend availability#38375
leeska wants to merge 1 commit into
NousResearch:mainfrom
leeska:fix/web-plugin-backend-availability

Conversation

@leeska

@leeska leeska commented Jun 3, 2026

Copy link
Copy Markdown

What does this PR do?

Makes web backend availability checks plugin-aware. Today _is_backend_available() only recognizes a hardcoded set of built-in backend names. A third-party web provider can register successfully through PluginContext.register_web_search_provider(), but if a user sets web.search_backend or web.extract_backend to that provider name, _get_capability_backend() filters it out before dispatch reaches the provider registry.

This PR keeps the existing fast paths for built-in backends, then falls back to the web provider registry for unknown backend names after plugin discovery. That lets user-installed web backend plugins decide their own availability via provider.is_available() instead of requiring every provider name to be hardcoded in core.

Related Issue

Fixes #31873
Fixes #35970

Related open PRs found before opening this one:

This PR differs by including a focused regression test and using the repository PR template/checklist.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • tools/web_tools.py: for unknown backend names, trigger plugin discovery and consult agent.web_search_registry.get_provider(backend), returning the provider's own is_available() result when registered.
  • tests/tools/test_web_providers.py: add a regression test proving a custom registry-backed extract provider is selected via web.extract_backend, while an unregistered custom name still returns unavailable.

How to Test

  1. Configure a user web backend plugin that calls ctx.register_web_search_provider() and returns a provider named custom-extract.
  2. Set web.extract_backend: custom-extract.
  3. Run web_extract and verify it routes to the custom provider instead of falling back to web.backend / a built-in backend.

Automated test run:

/root/.hermes/hermes-agent/venv/bin/python -m pytest tests/tools/test_web_providers.py tests/plugins/web/test_web_search_provider_plugins.py -q
# 66 passed, 1 warning in 5.13s

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Debian 13 / Linux 6.12

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

Screenshots / Logs

Targeted tests:

..................................................................       [100%]
=============================== warnings summary ===============================
tests/tools/test_web_providers.py::TestWebSearchUsesSearchBackend::test_search_tool_calls_search_backend
  /root/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/player.py:30: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
    import audioop

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
66 passed, 1 warning in 5.13s

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Superseded by #57779, which fixes this same bug class (plugin-registered web providers invisible to the tool-availability gate) as a single chokepoint in _is_backend_available() on current main — cascading to _get_backend(), _get_capability_backend(), and check_web_api_key().

Your PR targeted the same gate and informed the approach — thanks for the contribution, credited in the merged PR body. Closing as superseded. #57779

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

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have tool/web Web search and extraction type/bug Something isn't working

Projects

None yet

3 participants