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)
Symptom
Section titled “Symptom”检查配置文件,**发现 web_search 字段已被删除**。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).
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).
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 未给出具体字段示例)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"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.
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).
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 5 real issues
- #3620修改API key保存后重新进入依旧显示为旧的sk-xxxxxxxxxxxxxxxxx
- #4071你用 cc-switch 切换模型时,实际上是修改了 config.toml 里的 model_provider 和 model 字段(比如从 openai / gpt-5.5 切到 custom / qwen3.7-max)。Codex 客户端重启后,侧边栏只展示与当前 model_provider 匹配的线程,所以你之前用 GPT 创建的对话就被"隐藏"了——数据还在磁盘上,只是界面上看不到了。
- #5345codex的oauth和api的切换不能用
- #5891重启ccswitch后启动codex,里面插件技能状态被重置
- #5910Issue: web_search = "disabled" 配置被意外删除,导致依赖该配置的功能失效
- 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.
Related problems
Section titled “Related problems”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.