From 5926a98c52bb56eb9c485c03dcb9efbf14890bf4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 6 Jan 2026 09:25:36 +0100 Subject: [PATCH] =?UTF-8?q?fix(configure):=20don=E2=80=99t=20write=20auth.?= =?UTF-8?q?order=20by=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/onboard-auth.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/commands/onboard-auth.ts b/src/commands/onboard-auth.ts index 8151bfca3..f2032f8ad 100644 --- a/src/commands/onboard-auth.ts +++ b/src/commands/onboard-auth.ts @@ -44,16 +44,25 @@ export function applyAuthProfileConfig( ...(params.email ? { email: params.email } : {}), }, }; - const order = { ...cfg.auth?.order }; - const list = order[params.provider] ? [...order[params.provider]] : []; - if (!list.includes(params.profileId)) list.push(params.profileId); - order[params.provider] = list; + + // Only maintain `auth.order` when the user explicitly configured it. + // Default behavior: no explicit order -> resolveAuthProfileOrder can round-robin by lastUsed. + const existingProviderOrder = cfg.auth?.order?.[params.provider]; + const order = + existingProviderOrder !== undefined + ? { + ...cfg.auth?.order, + [params.provider]: existingProviderOrder.includes(params.profileId) + ? existingProviderOrder + : [...existingProviderOrder, params.profileId], + } + : cfg.auth?.order; return { ...cfg, auth: { ...cfg.auth, profiles, - order, + ...(order ? { order } : {}), }, }; }