mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 19:35:28 -06:00
fix(auth): skip legacy OAuth repair when destination profile already exists (#97541)
When doctor --fix runs legacy OAuth profile id repair, it picks the single non-legacy OAuth profile as the migration target. If that target profile already exists as a separate user-configured account, the repair unconditionally overwrites it, destroying the account's config (displayName, email) and collapsing two distinct accounts into one. Add a guard: if the destination profile id already exists in cfg.auth.profiles, skip the repair entirely to preserve both accounts. Also pass cfg to resolveAuthProfileMetadata so config-set displayName is preserved when the repair does proceed. Fixes #97522
This commit is contained in:
@@ -123,7 +123,16 @@ export function repairOAuthProfileIdMismatch(params: {
|
||||
return { config: params.cfg, changes: [], migrated: false };
|
||||
}
|
||||
|
||||
// Skip repair if destination profile already exists as a separate
|
||||
// user-configured account. Overwriting it would destroy the existing
|
||||
// account's config (displayName, email, etc.) and collapse two distinct
|
||||
// accounts into one. See #97522.
|
||||
if (params.cfg.auth?.profiles?.[toProfileId]) {
|
||||
return { config: params.cfg, changes: [], migrated: false };
|
||||
}
|
||||
|
||||
const { email: toEmail, displayName: toDisplayName } = resolveAuthProfileMetadata({
|
||||
cfg: params.cfg,
|
||||
store: params.store,
|
||||
profileId: toProfileId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user