feat(codex): add per-provider option to disable hosted web search - #409
feat(codex): add per-provider option to disable hosted web search#409ChanthMiao wants to merge 3 commits into
Conversation
|
Thanks for the PR! The TUI direction looks consistent, but there are a few blockers:
Please add lifecycle coverage for switch-away/back, temporary capture, and takeover restore. |
|
Ok, I will fix them later. But, my laptop failed to boot for unknown problem. I need some time to fix it first. |
…ifecycle Address maintainer review (PR SaladDay#409): - Align with upstream d380b410: native /responses gateways on the host/model blacklist (xiaomimimo.com, longcat.chat, minimax.io, minimaxi.com; model prefixes mimo/longcat/minimax) now get web_search = "disabled" automatically, with an optional top-level base_url fallback for legacy flat configs. The disableWebSearch toggle remains as a force-disable override (additive only). - Preserve settingsConfig.disableWebSearch when Codex snapshots are rebuilt during provider backfill or temporary-launch capture, so the option survives a normal switch cycle. - Proxy takeover restore no longer strips web_search = "disabled" from native providers: verbatim restores keep the captured field, and takeover writes evaluate the blacklist against the provider's stored pre-rewrite config (the live base_url is rewritten to the local proxy). - Lifecycle tests: switch-away/back, temporary capture, backfill, takeover restore, and blacklist verdict override.
|
All review points are addressed in commit
Test status: |
|
@SaladDay Any other problems to fix ? |
|
Thanks for the update! I re-reviewed commit
Also, the takeover restore coverage is still helper-level only. Please add a real takeover/restore assertion under I also checked the #415 cross-reference: it covers the separate Claude-to-Responses WebSearch bridge and does not add scope to this PR. The PR merges cleanly with current |
…wen3-Coder blacklist Address maintainer round-2 review (PR SaladDay#409): - restore_codex_settings_for_backfill now restores disableWebSearch alongside modelCatalog, so refresh_provider_snapshot keeps the option on the newly active provider after a real switch (verified by a full ProviderService::switch seed->away->back lifecycle test using a non-blacklisted host, proving the disable comes from the option). - Add qwen3-coder to the web_search reject model prefixes (upstream 26f0d221): DashScope rejects built-in tools for the coder series. qwen3-coder-plus is now blacklisted (incl. behind aggregator vendor/ prefixes), while general Qwen models (qwen-max, qwen3-max) stay enabled. - Add a real takeover assertion under proxy_takeover.rs: activating a managed proxy session for a host-blacklisted native gateway keeps web_search = "disabled" after the live base_url is rewritten to the local proxy.
|
All three round-2 blockers are fixed in commit
Verification: |
Add a "禁用内置联网搜索" toggle for native Responses (openai_responses) Codex providers. When enabled, live config.toml generation writes web_search = "disabled"; otherwise the field is left untouched except for removing the exact "disabled" value previously written by cc-switch, preserving user-owned settings such as "live". Anthropic gateways keep forcing the disabled value (the bridge cannot carry the hosted tool); Chat formats are unaffected (the proxy converts the tool). The option is stored in settingsConfig.disableWebSearch and round-trips through SQLite/import-export/WebDAV without schema changes.
…ifecycle Address maintainer review (PR SaladDay#409): - Align with upstream d380b410: native /responses gateways on the host/model blacklist (xiaomimimo.com, longcat.chat, minimax.io, minimaxi.com; model prefixes mimo/longcat/minimax) now get web_search = "disabled" automatically, with an optional top-level base_url fallback for legacy flat configs. The disableWebSearch toggle remains as a force-disable override (additive only). - Preserve settingsConfig.disableWebSearch when Codex snapshots are rebuilt during provider backfill or temporary-launch capture, so the option survives a normal switch cycle. - Proxy takeover restore no longer strips web_search = "disabled" from native providers: verbatim restores keep the captured field, and takeover writes evaluate the blacklist against the provider's stored pre-rewrite config (the live base_url is rewritten to the local proxy). - Lifecycle tests: switch-away/back, temporary capture, backfill, takeover restore, and blacklist verdict override.
…wen3-Coder blacklist Address maintainer round-2 review (PR SaladDay#409): - restore_codex_settings_for_backfill now restores disableWebSearch alongside modelCatalog, so refresh_provider_snapshot keeps the option on the newly active provider after a real switch (verified by a full ProviderService::switch seed->away->back lifecycle test using a non-blacklisted host, proving the disable comes from the option). - Add qwen3-coder to the web_search reject model prefixes (upstream 26f0d221): DashScope rejects built-in tools for the coder series. qwen3-coder-plus is now blacklisted (incl. behind aggregator vendor/ prefixes), while general Qwen models (qwen-max, qwen3-max) stay enabled. - Add a real takeover assertion under proxy_takeover.rs: activating a managed proxy session for a host-blacklisted native gateway keeps web_search = "disabled" after the live base_url is rewritten to the local proxy.
e95a391 to
fa56a7a
Compare
|
Rebased onto latest upstream main to resolve conflicts (branch now at fa56a7a). Upstream advanced past the PR's original base (v5.10.3 release, Pi support, provider presets, skills rework), so the PR was rebased onto the current main
Verification after rebase: codex_config 57 passed, services::provider 120, proxy_takeover/proxy_service 13/30, form tests 44, fmt clean, clippy warnings |
动机
Codex 供应商走原生
/responses(NativeResponses)格式直连网关时,部分网关不支持 hosted web-search 工具;此前 cc-switch 只能通过 model catalog 的supports_search_tool: false隐式抑制工具声明,无法在 config.toml 顶层显式禁用。本 PR 为这类供应商提供「禁用内置联网搜索」开关,控制web_search字段的生成。行为变化
openai_responses)格式的供应商显示;官方 OAuth 供应商同样可见web_search = "disabled""disabled"的值,用户手写的"live"等偏好保留settingsConfig.disableWebSearch(布尔),随 provider 经 SQLite / 导入导出 / WebDAV 同步往返,无需数据库迁移实现要点
prepare_codex_config_text_with_model_catalog_payload根据 profile + 选项推导 disable 条件,覆盖切换、同步、takeover、failover、恢复全部 live 写入入口build_effective_live_snapshot对 Codex 只投影{auth, config},新增merge_codex_provider_catalog_options在 proxy 侧三处写路径补齐选项测试
cargo test --lib web_search(9 个)、--lib provider_add_form_codex(43 个)全绿cargo fmt --check通过;改动文件无新增 clippy 警告