Skip to content

fix(proxy): preserve Codex OAuth auth token on takeover#3789

Open
codeasier wants to merge 2 commits into
farion1231:mainfrom
codeasier:fix/codex-oauth-auth-token-takeover
Open

fix(proxy): preserve Codex OAuth auth token on takeover#3789
codeasier wants to merge 2 commits into
farion1231:mainfrom
codeasier:fix/codex-oauth-auth-token-takeover

Conversation

@codeasier
Copy link
Copy Markdown
Contributor

@codeasier codeasier commented Jun 5, 2026

Summary / 概述

修复 Claude Code + Codex OAuth + Claude takeover 场景下,ANTHROPIC_AUTH_TOKEN 被 managed account takeover 强制删除后导致 Claude Code 弹出登录提示的问题。

本 PR 保持现有 ManagedAccount / 非 ManagedAccount 两态分流不变,仅在 managed 分支内对 Codex OAuth 做最小特例处理:

  • GitHub Copilot 行为不变:继续删除 ANTHROPIC_AUTH_TOKEN,并写入 ANTHROPIC_API_KEY = PROXY_MANAGED
  • Codex OAuth 行为调整:如果 live config 已存在 ANTHROPIC_AUTH_TOKEN,则保留该字段并将值替换为 PROXY_MANAGED
  • 非 managed provider 行为不变
  • 更新 Codex OAuth takeover 测试断言,保留 Copilot 回归断言

Related Issue / 关联 Issue

Fixes #3784

Screenshots / 截图

  • Step 1. 选择一个非codex账号(非ManagedAccount场景),开启takeover及本地路由,查看settings.json
image image
  • Step 2. 更换选择为codex provider,保持takeover及本地路由,查看settings.json, 正确注入auth占位符
image image
  • Step3. 启动cc
image image

日志如下
image

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • cargo clippy passes (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)
  • Updated i18n files if user-facing text changed / 如修改了用户可见文本,已更新国际化文件

Additional verification / 额外验证:

  • cargo test managed_account_claude_takeover --manifest-path src-tauri/Cargo.toml
  • End-to-end Codex OAuth scenario tested manually

@farion1231
Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Claude takeover removes ANTHROPIC_AUTH_TOKEN for Codex OAuth and triggers Claude Code login prompt

2 participants