Skip to content

web_search field deleted: cc-switch rewrites the Codex config, causing manual edits to be lost

Quick fix

cc-switch rewrites Codex config.toml/auth.json from its database on switch or launch, wiping unmanaged manual fields; upgrade and use "Common Config"… (AGENTS)

Error output
检查配置文件,**发现 web_search 字段已被删除**。
English translation

Checked the config file and **found that the web_search field had been deleted**.

Every time you switch providers in cc-switch, or fully launch Codex through it, it rewrites ~/.codex/config.toml and auth.json wholesale from the config stored in its own database, instead of merging with your manual edits. As a result, top-level fields you added manually (such as web_search = "disabled") are treated as invalid config and removed (#5910; the maintainer confirmed it is the same problem as #3824 and merged it for tracking). The enable/disable state in Codex's built-in plugin panel is also reset to defaults, even when no provider switch occurred (#5891, still open at time of report). Variants of the same rewrite mechanism: version 3.16.0 saved an API key without actually writing it to auth.json, while the UI still showed the old key (#3620; multiple takeover write paths fixed starting in 3.16.1); mixing OAuth and API Key login could not switch back, requiring manual edits to auth.json (#5345; improved after v3.17.0 added official login takeover, with the remaining behavior being the official-login retention capability in "Codex App Enhancements" as explained by the maintainer, which can be disabled); and after switching model_provider in config.toml, the Codex sidebar only shows threads matching the current provider, hiding old conversations (#4071; solved by the "Unified Codex session history" toggle in v3.16.3).

  1. First upgrade cc-switch to the latest version: 3.16.1 fixed multiple takeover write paths that failed to write auth.json correctly after editing and saving (resolving the API key not taking effect in #3620); v3.17.0 added Codex official login takeover, improving switching between official OAuth/API Key and third-party providers (#5345).

  2. If after upgrading to v3.17.0 the OAuth login still cannot switch back to API Key: this is caused by the official-login retention capability in "Codex App Enhancements"; disable that enhancement in settings. If it still fails, manually edit auth.json as described in the original issue.

    ~/.codex/auth.json
    (手动编辑此文件,将登录凭据改回 API key 形式;issue 未给出具体字段示例)
  3. Manual top-level fields such as web_search being deleted: the maintainer has merged this into #3824 for centralized tracking. Until it is fixed, you need to manually re-add the fields to config.toml after every switch or config update through cc-switch.

    ~/.codex/config.toml
    web_search = "disabled"
  4. Codex plugin panel state being reset (#5891, still open): as a workaround, document each plugin's usage restrictions in AGENTS.md; or, per user feedback, use the "Common Config" added in the latest version so multiple providers share the plugin state.

  5. History sessions hidden in the sidebar after switching model_provider (#4071): upgrade to >=3.16.3 and enable "Unified Codex session history" under "Settings -> Codex App Enhancements"; official and third-party sessions will share one resume history bucket. The dialog shown when enabling it also offers a checkbox to migrate existing official history sessions (with per-session backup).

ToolCodex
Version3.16.0 - 3.19.0(其中 API key 未写入在 3.16.1 修复、会话历史隐藏在 3.16.3 修复、OAuth/API 混切在 3.17.0 改善;字段删除与插件状态重置在 3.19.0 仍存在)
PlatformsWindowsmacOS
After the web_search field is deleted, can a config option be added so cc-switch does not proxy/clean this field?
A user raised the same request in #5910. The maintainer did not reply directly but marked the issue as a duplicate of #3824 and merged it for tracking; until it is fixed, you can only manually re-add the field after each switch.
After upgrading to v3.17.0, switching from OAuth to API key still does not take effect. What should I do?
The maintainer explained this is the official-login retention capability in "Codex App Enhancements" and is expected behavior; disabling that enhancement fixes it. You can also manually edit ~/.codex/auth.json.
Has the plugin state reset issue been resolved?
#5891 is still open. The workaround suggested by users is to restrict each plugin's usage in AGENTS.md; another user pointed out that the latest version has "Common Config", which lets multiple providers share the plugin state.
After switching models, the conversations I created with GPT disappeared. Is the data lost?
No. The Codex sidebar only shows threads matching the current model_provider; the data is still on disk. After upgrading to >=3.16.3 and enabling "Unified Codex session history", official and third-party sessions share the same history bucket and no longer hide each other when switching.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.