diff --git a/src/tests/tools/model-provider-detection.test.ts b/src/tests/tools/model-provider-detection.test.ts index 486dcd6..2f57745 100644 --- a/src/tests/tools/model-provider-detection.test.ts +++ b/src/tests/tools/model-provider-detection.test.ts @@ -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"); + }); +}); diff --git a/src/tools/manager.ts b/src/tools/manager.ts index 52d4812..b66d1df 100644 --- a/src/tools/manager.ts +++ b/src/tools/manager.ts @@ -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/") ); }