fix: auto toolset detect chatgpt_oauth as codex (#1033)

This commit is contained in:
Charles Packer
2026-02-19 00:28:32 -08:00
committed by GitHub
parent aed7e5d119
commit 093657b63c
2 changed files with 15 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import { describe, expect, test } from "bun:test";
import { isOpenAIModel } from "../../tools/manager";
import { deriveToolsetFromModel } from "../../tools/toolset";
describe("isOpenAIModel", () => {
test("detects openai handles", () => {
@@ -10,6 +11,10 @@ describe("isOpenAIModel", () => {
expect(isOpenAIModel("chatgpt-plus-pro/gpt-5.3-codex")).toBe(true);
});
test("detects chatgpt_oauth handles", () => {
expect(isOpenAIModel("chatgpt_oauth/gpt-5.3-codex")).toBe(true);
});
test("detects chatgpt-plus-pro model ids via models.json metadata", () => {
expect(isOpenAIModel("gpt-5.3-codex-plus-pro-high")).toBe(true);
});
@@ -18,3 +23,9 @@ describe("isOpenAIModel", () => {
expect(isOpenAIModel("anthropic/claude-sonnet-4-6")).toBe(false);
});
});
describe("deriveToolsetFromModel", () => {
test("maps chatgpt_oauth handles to codex toolset", () => {
expect(deriveToolsetFromModel("chatgpt_oauth/gpt-5.3-codex")).toBe("codex");
});
});

View File

@@ -898,14 +898,16 @@ export function isOpenAIModel(modelIdentifier: string): boolean {
if (info?.handle && typeof info.handle === "string") {
return (
info.handle.startsWith("openai/") ||
info.handle.startsWith(`${OPENAI_CODEX_PROVIDER_NAME}/`)
info.handle.startsWith(`${OPENAI_CODEX_PROVIDER_NAME}/`) ||
info.handle.startsWith("chatgpt_oauth/")
);
}
// Fallback: treat raw handle-style identifiers as OpenAI for openai/*
// and ChatGPT OAuth Codex provider handles.
return (
modelIdentifier.startsWith("openai/") ||
modelIdentifier.startsWith(`${OPENAI_CODEX_PROVIDER_NAME}/`)
modelIdentifier.startsWith(`${OPENAI_CODEX_PROVIDER_NAME}/`) ||
modelIdentifier.startsWith("chatgpt_oauth/")
);
}