#7700·cc 开关

在切换 Codex 官方 OAuth 帐户后,app-server 守护进程仍使用旧的令牌

作者: spancerxing创建于 2026年9月26日更新于 2026年9月28日
标签bug

CC Switch Version / 版本号

3.20.4

Operating System / 操作系统

macOS

Related App / 涉及应用

Codex

Steps to Reproduce / 重现步骤

  1. Environment: cc-switch 3.20.4 (macOS arm64) + codex-cli 0.157.1 (npm installation)
  2. Log in to the "Authentication Center" with two ChatGPT accounts, and bind them to two Codex "OpenAI Official" cards.
  3. Switch to account A, open the terminal and run codex, which is normal.
  4. Switch to account B, and then open codex → the login is still account A.
  5. The content of ~/.codex/auth.json is also the correct account B — the file-level switch is correct, but the codex process still uses the old account.

Expected Behavior / 期望行为

After switching accounts, open codex and use the new account directly.

Actual Behavior / 实际行为

After switching, opening codex continues to use the old account. The root cause is that the codex app-server daemon (codex app-server --managed-daemon, which is automatically installed when installing codex with npm) caches the OAuth token in memory, and cc-switch only modifies ~/.codex/auth.json, so the daemon does not re-read, and continues to use the old token. Restoring normal operation immediately after executing codex app-server daemon stop (or pkill -f "codex app-server").

Additional Context / 补充信息

  • In ~/.codex/config.toml, setting daemon_auto_start = false only prevents the daemon from starting automatically, which does not solve the problem of "the running daemon caches the old token".
  • Recommendation: After switching the Codex official OAuth account with cc-switch, detect and restart the app-server daemon (such as calling codex app-server daemon restart), or at least prompt the user to restart.

内容来源: farion1231/cc-switch