fix(web_tools): honor plugin-registered provider availability at the tool gate - #57779
Merged
kshitijk4poor merged 4 commits intoJul 3, 2026
Merged
Conversation
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).
Second contributor identity from 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.
This was referenced Jul 3, 2026
Closed
13 tasks
|
Tron said it best. <3 #31873 (comment) |
1 task
This was referenced Jul 13, 2026
Closed
This was referenced Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plugin-registered web providers now light up
web_search/web_extracteven 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()intools/web_tools.pyonly knew the built-in backends. Sincecheck_web_api_key()(thecheck_fnfor 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_BACKENDSto the registered provider'sis_available()viaagent.web_search_registry, falling back to the legacy built-in probes otherwise. Because_get_backend(),_get_capability_backend(), andcheck_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 lightscheck_web_api_key,_get_backend,_is_backend_availableregistry 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
web_search/web_extractfiltered outweb.extract_backend: <plugin>is_available()raisesHERMES_HOME): positive, negative-control (no provider → dark), capability-dispatch ([Bug]: web_extract gives dead-end error with only SearXNG configured #32698), broken-provider robustness, and built-in-priority-preserved scenarios all pass.origin/main.Credit
Salvaged onto current
mainfrom 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