fix(search): API 后端失败兜底从 DuckDuckGo 换成 Bing - #35
Merged
Conversation
4 tasks
DuckDuckGo 在中国大陆网络下被 DNS 污染 + SNI 重置,完全不可达; API 后端失败后撞 DDG 兜底等于必然整体失败。Bing 是唯一全球与 中国大陆均免 key 可达的引擎,链尾按可达性选择,不做地理探测。 全链失败错误补充 API 后端配置建议。 Signed-off-by: pinvou3-dev <dev@pinvou3.local>
h3c-hexin
force-pushed
the
feat/search-keyless-tail-bing
branch
from
August 28, 2026 09:13
2e429c3 to
33a37ed
Compare
This was referenced Sep 2, 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.
概述
API 后端(Tavily/Bocha/Metaso/Baidu/SearXNG/Volcengine/Sofya)运行失败或空结果后的免 key 链尾兜底,由 DuckDuckGo 换成 Bing;全链失败的错误补充 API 后端配置建议。
背景
实测(广州·中国移动出口):
html.duckduckgo.com解析到 Facebook 段2a03:2880:...face:b00c),且用真实 IP 直连 TLS 握手 0.07s 即被 SNI 重置,双层封锁。DDG 链尾会把 API 后端故障放大为必然整体失败:先撞死 DDG 挂满超时再报错。www.bing.com/search由必应按出口 IP 自动 302 到cn.bing.com,返回标准b_algo结构;现有解析器对两版页面均兼容。国外出口直接返回国际版结果。链尾按可达性选择,引擎不做地理探测(与既有 "does not guess geography" 原则一致)。Bing 与 DuckDuckGo 自身仍为单后端链:DDG 保留其内部挑战页/空结果的 Bing 回退,私有 DDG 兼容搜索服务(
provider = "duckduckgo" + base_url)不受影响。变更
SearchBackendChain::from_context:非 Bing/DDG 后端追加的免 key 兜底改为 Bing。not_available错误追加configure an API-backed [search] provider (...)建议;仍只含 backend id,不泄 provider 私有响应体(负向断言保留)。forkguard_api_provider_chain_tail_is_bing行为测试:7 个 API 后端链尾均为 Bing、Bing/DDG 保持单后端链。config/search.rs枚举文档与docs/CONFIGURATION.mdWeb Search Provider 一节同步。验证
cargo test -p codewhale-tui --lib tools::web::backend --locked:9 passedcargo test -p codewhale-tui --lib tools::web_search --locked:63 passedcargo fmt --all -- --check通过./scripts/fork-guard.sh全量四层通过(含 57 条 forkguard 回归)Checklist
No-Issue: 与父仓 Pinvou/pinvou-agent 的配套 PR(gitlink + fork 登记)同批提交。