fix(web): xAI tool gating and search dispatch fallback - #29425
fix(web): xAI tool gating and search dispatch fallback#29425crazywriter1 wants to merge 5 commits into
Conversation
Include xai in check_web_api_key() so web_search/web_extract register when web.backend is xai or only xAI credentials exist. Fall back to get_active_search_provider() when the named search backend is registered but is_available() is false (e.g. default firecrawl with xAI OAuth only).
|
Thanks for identifying the xAI-only dispatch path. The dispatch issue remains reproducible by inspection on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
Keep main's registry-based check_web_api_key; retain unavailable-provider search dispatch fallback and drop the xAI availability whitelist.
Thanks @teknium1 Addressed as requested after merging current
Ready for another look. |
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Two PRs address the xAI web-tool path but cover distinct causes: #36802 added xAI to the former availability whitelist, while #29425 makes search dispatch reject an unavailable named provider and fall back to the active registry provider, with xAI gate and dispatch regression coverage.
Related pull requests
- #29425
related— (+81/-14) — keep open / merge candidate: The production diff adds the missing unavailable-provider fallback, preventing a default-but-unavailable Firecrawl provider from intercepting xAI-only setups; it also adds regression tests for dispatch and xAI availability gating without replacing the current generalized registry-based gate. This is consistent with the keep_open review on #29425, which specifically requests salvaging the dispatch fix while retaining that generalized gate. - #36802 [closed]
related— (+2/-2) — merged reference implementation: This closed PR only added xAI to the earlier hardcoded check_web_api_key() lists, addressing the original tool-gating gap; contributor discussion records that it was reapplied and merged via #37146 with authorship preserved.
Suggested consolidation
Merge #29425 after confirming the current generalized registry-based check_web_api_key() gate remains intact; its visible implementation change fixes the still-reproducible unavailable-provider dispatch path, while its gate tests provide regression coverage rather than reintroducing the old whitelist. #36802 is not a duplicate of the current #29425 diff and needs no closure action because it is already closed and its change was merged via #37146.
Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 10 kB of PR diffs, 2 kB of issue/PR text, 4 kB of discussion (5 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
Summary
xaiincheck_web_api_key()soweb_search/web_extractare not gated off whenweb.backend: xaior only xAI credentials (OAuth /XAI_API_KEY) are present._get_search_backend()names a registered provider that is notis_available()(e.g. defaultfirecrawlwith no Firecrawl creds but xAI configured), fall back toget_active_search_provider()instead of callingsearch()on the dead backend.Problem
After the bundled xAI web search plugin landed (
a0c031299), two wiring gaps remained intools/web_tools.py:check_web_api_key()—_is_backend_available("xai")worked, but the helper’s configured/scan lists still listed only the original seven backends.web.backend: xaialways evaluated to “not configured,” so the tools never registered.web_search_tooldispatch — Fallback toget_active_search_provider()ran only when the provider was missing or did not support search, not when it was unavailable. Users with only xAI creds often hit the defaultfirecrawlname first and got a Firecrawl configuration error instead of registry resolution picking xAI.Changes
tools/web_tools.py— add_WEB_AVAILABILITY_BACKENDS(includesxai); extendcheck_web_api_key(); gate dispatch onis_available()before delegating.tests/tools/test_web_tools_config.py— xAI-only and configured-xaicases forcheck_web_api_key().tests/tools/test_web_providers_xai.py— regression for configured-backend unavailable → active provider fallback.Test plan
pytest tests/tools/test_web_tools_config.py::TestCheckWebApiKey -q -o addopts=''pytest tests/tools/test_web_providers_xai.py::TestXAIBackendWiring -q -o addopts=''Notes
Does not change
_get_backend()auto-detect candidate order (xAI intentionally excluded there; seetest_xai_not_in_legacy_backend_candidate_chain).