refactor: harden kilocode auth ordering and dedupe provider wiring

This commit is contained in:
Peter Steinberger
2026-02-23 23:37:07 +00:00
parent f52a0228ca
commit e6484cb65f
8 changed files with 131 additions and 79 deletions

View File

@@ -319,6 +319,44 @@ describe("applyAuthProfileConfig", () => {
expect(next.auth?.order?.anthropic).toEqual(["anthropic:work", "anthropic:default"]);
});
it("creates provider order when switching from legacy oauth to api_key without explicit order", () => {
const next = applyAuthProfileConfig(
{
auth: {
profiles: {
"kilocode:legacy": { provider: "kilocode", mode: "oauth" },
},
},
},
{
profileId: "kilocode:default",
provider: "kilocode",
mode: "api_key",
},
);
expect(next.auth?.order?.kilocode).toEqual(["kilocode:default", "kilocode:legacy"]);
});
it("keeps implicit round-robin when no mixed provider modes are present", () => {
const next = applyAuthProfileConfig(
{
auth: {
profiles: {
"kilocode:legacy": { provider: "kilocode", mode: "api_key" },
},
},
},
{
profileId: "kilocode:default",
provider: "kilocode",
mode: "api_key",
},
);
expect(next.auth?.order).toBeUndefined();
});
});
describe("applyMinimaxApiConfig", () => {