Fix Codex OAuth auth being cleared during preserve-mode takeover

When "preserve official auth on switch" is enabled, proxy takeover routes
the PROXY_MANAGED placeholder into config.toml's experimental_bearer_token
and leaves auth.json (the ChatGPT OAuth login) untouched. Takeover detection
only inspected auth.json's OPENAI_API_KEY, so it never recognized this state
and returned a false negative, which led downstream paths to clobber the
preserved OAuth login.

- Detection: is_codex_live_taken_over now also matches a config.toml
  experimental_bearer_token equal to the placeholder, fixing detect/cleanup/
  restore/startup-recovery in one place.
- Cleanup: remove the config.toml bearer token only when it equals the
  placeholder (new remove_codex_experimental_bearer_token_if predicate), so a
  real third-party key is never stripped.
- Write: under preservation, the None-provider takeover path writes only
  config.toml and keeps auth.json intact, matching the provider path.
- Settings: rename the section to "Codex App Enhancements" and reword the
  description across all four locales.
- Add tests covering OAuth preservation on takeover and placeholder-only
  cleanup.
This commit is contained in:
Jason
2026-05-30 22:56:36 +08:00
parent 60a9b330e5
commit c9cadd6e09
7 changed files with 224 additions and 25 deletions
+2 -2
View File
@@ -242,11 +242,11 @@ export function SettingsPage({
handleAutoSave({ skillSyncMethod: method })
}
/>
<WindowSettings
<CodexAuthSettings
settings={settings}
onChange={handleAutoSave}
/>
<CodexAuthSettings
<WindowSettings
settings={settings}
onChange={handleAutoSave}
/>