From 33909f48d72c584cc30e05ce552b0d416a60091a Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:41:31 -0500 Subject: [PATCH] fix(core): label migrated credentials by auth type (#45369) --- ...0260805200742_import_legacy_credentials.ts | 3 +- packages/core/test/database-migration.test.ts | 29 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/packages/core/src/database/migration/20260805200742_import_legacy_credentials.ts b/packages/core/src/database/migration/20260805200742_import_legacy_credentials.ts index 01950cf4e9a..3a6507540f7 100644 --- a/packages/core/src/database/migration/20260805200742_import_legacy_credentials.ts +++ b/packages/core/src/database/migration/20260805200742_import_legacy_credentials.ts @@ -80,10 +80,11 @@ export function importLegacyCredentials(tx: Parameters { const content = JSON.stringify({ openai: { type: "oauth", refresh: "refresh", access: "access", expires: 123, accountId: "account" }, anthropic: { type: "api", key: "legacy-key", metadata: { region: "us" } }, + google: { type: "api", key: "google-key", metadata: { region: "us" } }, + "github-copilot": { type: "oauth", refresh: "refresh", access: "access", expires: 123 }, + "custom-provider": { type: "api", key: "custom-key" }, "https://example.com/": { type: "wellknown", key: "TOKEN", token: "wellknown-key" }, invalid: { type: "unknown" }, }) @@ -402,6 +405,7 @@ describe("DatabaseMigration", () => { yield* db.run(sql`DELETE FROM migration WHERE id = ${legacyCredentialsMigration.id}`) yield* DatabaseMigration.applyOnly(db, [legacyCredentialsMigration]) + yield* DatabaseMigration.applyOnly(db, [legacyCredentialsMigration]) expect(yield* db.all(sql`SELECT integration_id, label, value FROM credential ORDER BY integration_id`)).toEqual( [ @@ -410,14 +414,35 @@ describe("DatabaseMigration", () => { label: "Existing", value: JSON.stringify({ type: "key", key: "current-key" }), }, + { + integration_id: "custom-provider", + label: "API key", + value: JSON.stringify({ type: "key", key: "custom-key" }), + }, + { + integration_id: "github-copilot", + label: "OAuth", + value: JSON.stringify({ + type: "oauth", + methodID: "device", + refresh: "refresh", + access: "access", + expires: 123, + }), + }, + { + integration_id: "google", + label: "API key", + value: JSON.stringify({ type: "key", key: "google-key", metadata: { region: "us" } }), + }, { integration_id: "https://example.com", - label: "default", + label: "API key", value: JSON.stringify({ type: "key", key: "wellknown-key" }), }, { integration_id: "openai", - label: "default", + label: "OAuth", value: JSON.stringify({ type: "oauth", methodID: "chatgpt-browser",