feat(codex): preserve OAuth login state during third-party provider switching

Codex provider switches now only write config.toml for third-party providers,
injecting the API key as experimental_bearer_token. The user's auth.json
(ChatGPT OAuth tokens) is preserved. Official providers with login material
still write auth.json normally. Backfill restores bearer tokens into stored
provider auth.OPENAI_API_KEY to maintain canonical shape.
This commit is contained in:
Jason
2026-05-25 17:46:23 +08:00
parent 88ba908bc4
commit 95f2dd4126
17 changed files with 1664 additions and 154 deletions
+2 -1
View File
@@ -82,7 +82,8 @@ pub async fn get_config_status(
}
AppType::Codex => {
let auth_path = codex_config::get_codex_auth_path();
let exists = auth_path.exists();
let config_text = codex_config::read_codex_config_text().unwrap_or_default();
let exists = auth_path.exists() || !config_text.trim().is_empty();
let path = codex_config::get_codex_config_dir()
.to_string_lossy()
.to_string();