From f137299b9e148c03e7c5832ef1857dbc97233360 Mon Sep 17 00:00:00 2001 From: gg Date: Thu, 12 Feb 2026 10:14:41 +0100 Subject: [PATCH] fix: keep all auth options for multi-account --- index.ts | 7 +------ test/auth-login-workflow.test.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/index.ts b/index.ts index a4b95cb..5b68f89 100644 --- a/index.ts +++ b/index.ts @@ -787,9 +787,6 @@ export const OpenAIAuthPlugin: Plugin = async ({ client }: PluginInput) => { } }; - const storedAccountsForMethods = await loadAccounts(); - const hasStoredAccounts = (storedAccountsForMethods?.accounts.length ?? 0) > 0; - const oauthMethod = { label: AUTH_LABELS.OAUTH, type: "oauth" as const, @@ -865,9 +862,7 @@ export const OpenAIAuthPlugin: Plugin = async ({ client }: PluginInput) => { const apiKeyMethod = { label: AUTH_LABELS.API_KEY, type: "api" as const }; - const authMethods = hasStoredAccounts - ? [oauthMethod] - : [oauthMethod, manualOauthMethod, apiKeyMethod]; + const authMethods = [oauthMethod, manualOauthMethod, apiKeyMethod]; return { auth: { diff --git a/test/auth-login-workflow.test.ts b/test/auth-login-workflow.test.ts index 03e6943..00c4b36 100644 --- a/test/auth-login-workflow.test.ts +++ b/test/auth-login-workflow.test.ts @@ -87,16 +87,21 @@ describe("auth login workflow", () => { expect(AUTH_LABELS.OAUTH_MANUAL).toBe("Codex Oauth (headless)"); }); - it("exposes only oauth login when accounts exist", async () => { + it("retains oauth/manual/api login when accounts exist", async () => { mockLoadAccounts.mockResolvedValueOnce(fixture); const OpenAIAuthPlugin = await loadPlugin(); const plugin = await OpenAIAuthPlugin(createPluginInput()); const labels = plugin.auth?.methods.map((method) => method.label) ?? []; - expect(labels).toContain(AUTH_LABELS.OAUTH); - expect(labels).not.toContain(AUTH_LABELS.API_KEY); - expect(labels).toHaveLength(1); + expect(labels).toEqual( + expect.arrayContaining([ + AUTH_LABELS.OAUTH, + AUTH_LABELS.OAUTH_MANUAL, + AUTH_LABELS.API_KEY, + ]), + ); + expect(labels).toHaveLength(3); }); it("exposes oauth/manual/api login when no accounts exist", async () => {