Skip to content

fix(web_tools): honor plugin-registered provider availability at the tool gate - #57779

Merged
kshitijk4poor merged 4 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/28652-web-registry-gating
Jul 3, 2026
Merged

fix(web_tools): honor plugin-registered provider availability at the tool gate#57779
kshitijk4poor merged 4 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/28652-web-registry-gating

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Plugin-registered web providers now light up web_search / web_extract even when no built-in backend has credentials. The availability gate was a hardcoded env-var if-chain that returned False for any name outside the eight built-in backends, so a working custom provider left both tools filtered out of the toolset.

Root cause: _is_backend_available() in tools/web_tools.py only knew the built-in backends. Since check_web_api_key() (the check_fn for both tools) resolves through it, an available-but-unregistered-in-the-if-chain provider disabled the tools entirely.

Changes

  • tools/web_tools.py: single chokepoint fix — _is_backend_available() delegates any name outside _LEGACY_WEB_BACKENDS to the registered provider's is_available() via agent.web_search_registry, falling back to the legacy built-in probes otherwise. Because _get_backend(), _get_capability_backend(), and check_web_api_key() all resolve availability through this one function, the fix cascades to every caller. The two remaining hardcoded whitelist early-returns now also accept registered names and walk registered providers as a final fallback.
  • tests/tools/test_web_tools_config.py: regression tests (contributed by @m0n5t3r) — custom provider lights check_web_api_key, _get_backend, _is_backend_available registry delegation, per-capability extract selection, and the tool registry entries stay active.
  • scripts/release.py: AUTHOR_MAP mapping for @m0n5t3r's second identity.

Built-in backend priority is preserved unchanged: the registry is consulted only for names outside _LEGACY_WEB_BACKENDS.

Validation

Before After
Custom provider registered, no built-in creds web_search/web_extract filtered out tools available, resolve to custom provider
web.extract_backend: <plugin> dead-end "search-only" error (#32698) resolves to plugin provider
Built-in key present (e.g. TAVILY) tavily wins tavily wins (unchanged)
Provider is_available() raises n/a treated unavailable, no crash

Credit

Salvaged onto current main from the community cluster fixing this bug class. Primary: @m0n5t3r (reporter of #28651, PR #28652) — regression tests carry their authorship. The chokepoint approach and structure also draw on sibling PRs #32465 (@stardust-mem), #35327 (@what-name), #31887 (@hclsys), #38375 (@leeska), #56761 (@Josh-OK), #31829 (@ngsalmon), which all targeted the same gate. Closing those as superseded with credit on merge.

Closes #28651
Closes #31873
Closes #32698

kshitijk4poor and others added 4 commits July 3, 2026 19:54
Plugin-registered web providers (registered via agent.web_search_registry)
were invisible to the tool-availability gate: _is_backend_available() was a
hardcoded env-var if-chain that returned False for any name outside the eight
built-in backends. Because check_web_api_key() is the check_fn for both
web_search and web_extract, a working custom provider with no built-in creds
left both tools filtered out of the toolset entirely.

Fix at the single chokepoint: _is_backend_available() now delegates non-legacy
backend names to the registered provider's is_available(), falling back to the
legacy built-in probes for known names and unregistered providers. Because
_get_backend(), _get_capability_backend(), and check_web_api_key() all resolve
availability through this one function, the fix cascades to every caller —
including the per-capability extract selection that produced a dead-end
'search-only' error (NousResearch#32698). The two remaining hardcoded whitelist
early-returns (_get_backend, check_web_api_key) now also accept registered
names, and both walk registered providers as a final fallback so a custom
backend still resolves when no built-in has credentials.

Built-in backend priority is preserved unchanged: the registry is consulted
only for names outside _LEGACY_WEB_BACKENDS.

Fixes NousResearch#28651
Fixes NousResearch#31873
Fixes NousResearch#32698
A plugin-registered WebSearchProvider with no built-in provider credentials
must light up web_search / web_extract and be discoverable by the backend
selectors. Covers check_web_api_key(), _get_backend(), _is_backend_available()
registry delegation, per-capability extract selection (NousResearch#32698), and that the
web_search / web_extract tool registry entries are not filtered out.

Tests contributed by @m0n5t3r (PR NousResearch#28652, issue NousResearch#28651).
…ailability

Self-review follow-up. check_web_api_key() had a hand-rolled 'walk all
registered providers and probe each' fallback that duplicated the registry's
own availability-filtered resolvers (get_active_search_provider /
get_active_extract_provider, backed by _resolve()) — a second resolution path
that could diverge (the hand-rolled walk ignored capability, so a search-only
custom provider was handled inconsistently). Delegate to the registry's
resolvers so there is one authority for 'is a custom provider usable'.

Also: _get_backend()'s tail walk now probes provider.is_available() directly
instead of round-tripping through _is_backend_available(provider.name), which
redundantly re-did the registry get_provider() lookup on a provider object
already in hand. Both fallback loops guard is_available() against exceptions.

Documented that _LEGACY_WEB_BACKENDS intentionally includes 'xai' (probed via
has_xai_credentials, not a registered provider) while the registry's
_LEGACY_PREFERENCE excludes it, so the two built-in sets don't silently drift.
@Pauliehedron

Copy link
Copy Markdown

Tron said it best. <3 #31873 (comment)

@kshitijk4poor
kshitijk4poor deleted the salvage/28652-web-registry-gating branch August 5, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins 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

4 participants