Conversation
… unknown backends _is_backend_available() is a hardcoded whitelist of backend names. Any plugin-registered backend (crawl4ai, future extract-only providers) is silently rejected because the function doesn't recognize its name. Add a fallthrough check: when the backend name doesn't match any hardcoded entry, ask the provider registry if a plugin has registered a provider for that name, and delegate to provider.is_available(). This makes the gatekeeper plugin-aware without adding per-backend special cases — one change covers every current and future plugin.
Duplicate of #36987 — both add the same plugin-registry fallthrough ( |
|
Superseded by #57779, which fixes this same bug class (plugin-registered web providers invisible to the tool-availability gate) as a single chokepoint in Your PR targeted the same gate and informed the approach — thanks for the contribution, credited in the merged PR body. Closing as superseded. #57779 |
Problem
_is_backend_available()inweb_tools.pyis a hardcoded whitelist of backend names. Any plugin-registered backend (e.g., crawl4ai, future extract-only providers) is silently rejected because the function doesn't recognize its name — even though the plugin has already registered viaPluginContext.register_web_search_provider()with its ownis_available()check.This means setting
web.extract_backend: crawl4aiin config has no effect unless someone first patches_is_backend_available()to add a per-backend block. Every new extract-only plugin would need its own hardcoded entry.Fix
Add a fallthrough at the bottom of
_is_backend_available(): when the backend name doesn't match any hardcoded entry, ask the provider registry whether a plugin has registered a provider for that name, and delegate toprovider.is_available().Why this approach
register_web_search_provider()works automatically.is_available()(which it implements via theWebSearchProviderABC) is the authority — core doesn't need to know about specific packages or env vars.ddgsalready checks package importability. This is the same idea, generalized to the plugin registry.Tested
Verified end-to-end on a host with the crawl4ai plugin registered. Backward-compatible: the hardcoded checks run first and are unchanged. The fallthrough only fires for names not already recognized.