fix: auto toolset detect chatgpt_oauth as codex (#1033)
This commit is contained in:
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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/")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user