fix(openai): align auth picker labels for API key vs Codex OAuth

Lock regression coverage for current OpenAI API key, Codex browser login, and Codex device pairing auth picker labels.\n\nThanks @tmlxrd.
This commit is contained in:
tm.lxrd
2026-04-23 05:48:55 +02:00
committed by GitHub
parent fab76f3d70
commit edea0cba7a
4 changed files with 61 additions and 0 deletions

View File

@@ -5,8 +5,13 @@ const manifest = JSON.parse(
readFileSync(new URL("./openclaw.plugin.json", import.meta.url), "utf8"),
) as {
providerAuthChoices?: Array<{
provider?: string;
method?: string;
choiceLabel?: string;
choiceHint?: string;
choiceId?: string;
deprecatedChoiceIds?: string[];
groupHint?: string;
}>;
};
@@ -18,4 +23,34 @@ describe("OpenAI plugin manifest", () => {
expect(codexBrowserLogin?.deprecatedChoiceIds).toContain("openai-codex-import");
});
it("labels OpenAI API key and Codex auth choices without stale mixed OAuth wording", () => {
const choices = manifest.providerAuthChoices ?? [];
const codexBrowserLogin = choices.find((choice) => choice.choiceId === "openai-codex");
const codexDeviceCode = choices.find(
(choice) => choice.choiceId === "openai-codex-device-code",
);
const apiKey = choices.find(
(choice) => choice.provider === "openai" && choice.method === "api-key",
);
expect(codexBrowserLogin).toMatchObject({
choiceLabel: "OpenAI Codex Browser Login",
choiceHint: "Sign in with OpenAI in your browser",
groupHint: "API key + Codex auth",
});
expect(codexDeviceCode).toMatchObject({
choiceLabel: "OpenAI Codex Device Pairing",
choiceHint: "Pair in browser with a device code",
groupHint: "API key + Codex auth",
});
expect(apiKey).toMatchObject({
choiceLabel: "OpenAI API Key",
groupHint: "API key + Codex auth",
});
expect(choices.map((choice) => choice.choiceLabel)).not.toContain(
"OpenAI Codex (ChatGPT OAuth)",
);
expect(choices.map((choice) => choice.groupHint)).not.toContain("Codex OAuth + API key");
});
});