mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:10:45 +00:00
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:
@@ -110,6 +110,21 @@ describe("openai codex provider", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes grouped model/auth picker labels for Codex auth methods", () => {
|
||||
const provider = buildOpenAICodexProviderPlugin();
|
||||
const oauth = provider.auth?.find((method) => method.id === "oauth");
|
||||
const deviceCode = provider.auth?.find((method) => method.id === "device-code");
|
||||
|
||||
expect(oauth?.wizard).toMatchObject({
|
||||
choiceLabel: "OpenAI Codex Browser Login",
|
||||
groupHint: "API key + Codex auth",
|
||||
});
|
||||
expect(deviceCode?.wizard).toMatchObject({
|
||||
choiceLabel: "OpenAI Codex Device Pairing",
|
||||
groupHint: "API key + Codex auth",
|
||||
});
|
||||
});
|
||||
|
||||
it("returns deprecated-profile doctor guidance for legacy Codex CLI ids", () => {
|
||||
const provider = buildOpenAICodexProviderPlugin();
|
||||
|
||||
|
||||
@@ -49,6 +49,16 @@ function runWrappedPayloadCase(params: {
|
||||
}
|
||||
|
||||
describe("buildOpenAIProvider", () => {
|
||||
it("exposes grouped model/auth picker labels for API key setup", () => {
|
||||
const provider = buildOpenAIProvider();
|
||||
const apiKey = provider.auth.find((method) => method.id === "api-key");
|
||||
|
||||
expect(apiKey?.wizard).toMatchObject({
|
||||
choiceLabel: "OpenAI API Key",
|
||||
groupHint: "API key + Codex auth",
|
||||
});
|
||||
});
|
||||
|
||||
it("resolves gpt-5.4 mini and nano from GPT-5 small-model templates", () => {
|
||||
const provider = buildOpenAIProvider();
|
||||
const registry = {
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user