Default Codex auth preservation to off (opt-in)

Flip preserve_codex_official_auth_on_switch from true to false so
third-party Codex switches overwrite auth.json by default, matching the
expectation that switching providers also swaps credentials. Users who
rely on keeping the ChatGPT login in auth.json while on a third-party
provider (for official plugins / remote login) can enable it in
Settings -> Codex Authentication.

The toggle field ships for the first time here (it is not in v3.16.0),
so no existing settings.json holds an explicit value -- every user lands
on the new default and no migration is required.

Also set the flag explicitly in the preservation unit test instead of
relying on the global default, keeping it valid now that the default is
false.
This commit is contained in:
Jason
2026-05-30 21:04:23 +08:00
parent ee69c83687
commit 3f59ab3746
4 changed files with 16 additions and 7 deletions
@@ -25,7 +25,7 @@ export function CodexAuthSettings({
icon={<KeyRound className="h-4 w-4 text-emerald-500" />}
title={t("settings.preserveCodexOfficialAuthOnSwitch")}
description={t("settings.preserveCodexOfficialAuthOnSwitchDescription")}
checked={settings.preserveCodexOfficialAuthOnSwitch ?? true}
checked={settings.preserveCodexOfficialAuthOnSwitch ?? false}
onCheckedChange={(value) =>
onChange({ preserveCodexOfficialAuthOnSwitch: value })
}
+3 -3
View File
@@ -117,7 +117,7 @@ export function useSettingsForm(): UseSettingsFormResult {
silentStartup: data.silentStartup ?? false,
skipClaudeOnboarding: data.skipClaudeOnboarding ?? false,
preserveCodexOfficialAuthOnSwitch:
data.preserveCodexOfficialAuthOnSwitch ?? true,
data.preserveCodexOfficialAuthOnSwitch ?? false,
claudeConfigDir: sanitizeDir(data.claudeConfigDir),
codexConfigDir: sanitizeDir(data.codexConfigDir),
geminiConfigDir: sanitizeDir(data.geminiConfigDir),
@@ -142,7 +142,7 @@ export function useSettingsForm(): UseSettingsFormResult {
useAppWindowControls: false,
enableClaudePluginIntegration: false,
skipClaudeOnboarding: false,
preserveCodexOfficialAuthOnSwitch: true,
preserveCodexOfficialAuthOnSwitch: false,
language: readPersistedLanguage(),
} as SettingsFormState);
@@ -181,7 +181,7 @@ export function useSettingsForm(): UseSettingsFormResult {
silentStartup: serverData.silentStartup ?? false,
skipClaudeOnboarding: serverData.skipClaudeOnboarding ?? false,
preserveCodexOfficialAuthOnSwitch:
serverData.preserveCodexOfficialAuthOnSwitch ?? true,
serverData.preserveCodexOfficialAuthOnSwitch ?? false,
claudeConfigDir: sanitizeDir(serverData.claudeConfigDir),
codexConfigDir: sanitizeDir(serverData.codexConfigDir),
geminiConfigDir: sanitizeDir(serverData.geminiConfigDir),