fix: honor Codex auth order for OpenAI PI (#82605)

* fix: honor Codex auth order for OpenAI PI

* docs: add PR reference for OpenAI PI auth fix
This commit is contained in:
Peter Steinberger
2026-05-16 15:26:27 +01:00
committed by GitHub
parent 16e5d6692d
commit 9dedc4d95c
19 changed files with 450 additions and 26 deletions
+7 -1
View File
@@ -332,15 +332,21 @@ export function registerModelsCli(program: Command) {
.description("Run a provider plugin auth flow (OAuth/API key)")
.option("--provider <id>", "Provider id registered by a plugin")
.option("--method <id>", "Provider auth method id")
.option("--device-code", "Use the provider device-code auth method", false)
.option("--set-default", "Apply the provider's default model recommendation", false)
.action(async (opts, command) => {
if (opts.deviceCode && typeof opts.method === "string" && opts.method !== "device-code") {
throw new Error(
"--device-code cannot be combined with --method unless method is device-code.",
);
}
await withModelsRuntime(async ({ defaultRuntime, resolveModelAgentOption }) => {
const agent = resolveModelAgentOption(command);
const { modelsAuthLoginCommand } = await import("../commands/models/auth.js");
await modelsAuthLoginCommand(
{
provider: opts.provider as string | undefined,
method: opts.method as string | undefined,
method: opts.deviceCode ? "device-code" : (opts.method as string | undefined),
setDefault: Boolean(opts.setDefault),
agent,
},