From 93c209bfd1f068b26b38ac4e9b7237d4c7f095e1 Mon Sep 17 00:00:00 2001 From: Rakshith N Date: Wed, 8 Jul 2026 18:10:29 +0530 Subject: [PATCH 1/2] fix(codex): hide gpt-5.5-pro for Codex OAuth users --- .changeset/hide-gpt-5-5-pro.md | 6 ++ packages/opencode/src/plugin/openai/codex.ts | 4 ++ packages/opencode/test/plugin/codex.test.ts | 60 ++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 .changeset/hide-gpt-5-5-pro.md diff --git a/.changeset/hide-gpt-5-5-pro.md b/.changeset/hide-gpt-5-5-pro.md new file mode 100644 index 00000000000..68aa099db8e --- /dev/null +++ b/.changeset/hide-gpt-5-5-pro.md @@ -0,0 +1,6 @@ +--- +"@kilocode/cli": patch +"kilo-code": patch +--- + +Hide gpt-5.5-pro from the model picker when using ChatGPT OAuth login, since Codex rejects it with HTTP 400. diff --git a/packages/opencode/src/plugin/openai/codex.ts b/packages/opencode/src/plugin/openai/codex.ts index 9eb9710b21a..8865e1f89c5 100644 --- a/packages/opencode/src/plugin/openai/codex.ts +++ b/packages/opencode/src/plugin/openai/codex.ts @@ -15,6 +15,9 @@ const ISSUER = "https://auth.openai.com" const CODEX_API_ENDPOINT = "https://chatgpt.com/backend-api/codex/responses" const OAUTH_PORT = 1455 const OAUTH_POLLING_SAFETY_MARGIN_MS = 3000 +const DISALLOWED_MODELS = new Set([ + "gpt-5.5-pro", +]) const ALLOWED_MODELS = new Set([ "gpt-5.5", "gpt-5.2", @@ -394,6 +397,7 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug Object.entries(provider.models) .filter(([, model]) => { if (ALLOWED_MODELS.has(model.api.id)) return true + if (DISALLOWED_MODELS.has(model.api.id)) return false const match = model.api.id.match(/^gpt-(\d+\.\d+)/) return match ? parseFloat(match[1]) > 5.4 : false }) diff --git a/packages/opencode/test/plugin/codex.test.ts b/packages/opencode/test/plugin/codex.test.ts index a375fe4ee10..e2cd0e66330 100644 --- a/packages/opencode/test/plugin/codex.test.ts +++ b/packages/opencode/test/plugin/codex.test.ts @@ -122,6 +122,66 @@ describe("plugin.codex", () => { }) }) + describe("models filter", () => { + test("filters out disallowed models for oauth users", async () => { + const hooks = await CodexAuthPlugin({} as never) + const provider = await hooks.provider!.models!({ + id: "openai", + baseURL: "", + apiKey: "", + models: { + "gpt-5.5-pro": { + id: "gpt-5.5-pro", + api: { id: "gpt-5.5-pro" }, + } as never, + "gpt-5.5": { + id: "gpt-5.5", + api: { id: "gpt-5.5" }, + } as never, + "gpt-5.4-mini": { + id: "gpt-5.4-mini", + api: { id: "gpt-5.4-mini" }, + } as never, + "gpt-5.1-codex": { + id: "gpt-5.1-codex", + api: { id: "gpt-5.1-codex" }, + } as never, + "other-model": { + id: "other-model", + api: { id: "other-model" }, + } as never, + }, + } as never, { auth: { type: "oauth" } } as never) + expect(provider).not.toHaveProperty(["gpt-5.5-pro"]) + expect(provider).toHaveProperty(["gpt-5.5"]) + expect(provider).toHaveProperty(["gpt-5.4-mini"]) + expect(provider).toHaveProperty(["gpt-5.1-codex"]) + expect(provider).not.toHaveProperty(["other-model"]) + }) + + test("passes through all models when not using oauth", async () => { + const hooks = await CodexAuthPlugin({} as never) + const models = { + "gpt-5.5-pro": { + id: "gpt-5.5-pro", + api: { id: "gpt-5.5-pro" }, + } as never, + "other-model": { + id: "other-model", + api: { id: "other-model" }, + } as never, + } + const provider = await hooks.provider!.models!({ + id: "openai", + baseURL: "", + apiKey: "", + models, + } as never, { auth: { type: "api", key: "sk-test" } } as never) + expect(provider).toHaveProperty(["gpt-5.5-pro"]) + expect(provider).toHaveProperty(["other-model"]) + }) + }) + test("installs websocket transport only when experimental websockets are enabled", async () => { const disabled = await CodexAuthPlugin({} as never) const enabled = await CodexAuthPlugin({} as never, { experimentalWebSockets: true }) From 2e2222cfa2ef88f42332221422014470317d3510 Mon Sep 17 00:00:00 2001 From: Rakshith N Date: Wed, 8 Jul 2026 19:14:11 +0530 Subject: [PATCH 2/2] fix(codex): add kilocode_change markers for shared upstream changes --- packages/opencode/src/plugin/openai/codex.ts | 10 ++++++---- packages/opencode/test/plugin/codex.test.ts | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/opencode/src/plugin/openai/codex.ts b/packages/opencode/src/plugin/openai/codex.ts index 8865e1f89c5..9d9ef12116f 100644 --- a/packages/opencode/src/plugin/openai/codex.ts +++ b/packages/opencode/src/plugin/openai/codex.ts @@ -15,9 +15,6 @@ const ISSUER = "https://auth.openai.com" const CODEX_API_ENDPOINT = "https://chatgpt.com/backend-api/codex/responses" const OAUTH_PORT = 1455 const OAUTH_POLLING_SAFETY_MARGIN_MS = 3000 -const DISALLOWED_MODELS = new Set([ - "gpt-5.5-pro", -]) const ALLOWED_MODELS = new Set([ "gpt-5.5", "gpt-5.2", @@ -32,6 +29,11 @@ const ALLOWED_MODELS = new Set([ "gpt-5.2-codex", // kilocode_change end ]) +// kilocode_change start +const DISALLOWED_MODELS = new Set([ + "gpt-5.5-pro", +]) +// kilocode_change end interface PkceCodes { verifier: string @@ -397,7 +399,7 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug Object.entries(provider.models) .filter(([, model]) => { if (ALLOWED_MODELS.has(model.api.id)) return true - if (DISALLOWED_MODELS.has(model.api.id)) return false + if (DISALLOWED_MODELS.has(model.api.id)) return false // kilocode_change const match = model.api.id.match(/^gpt-(\d+\.\d+)/) return match ? parseFloat(match[1]) > 5.4 : false }) diff --git a/packages/opencode/test/plugin/codex.test.ts b/packages/opencode/test/plugin/codex.test.ts index e2cd0e66330..0be3ab63bbd 100644 --- a/packages/opencode/test/plugin/codex.test.ts +++ b/packages/opencode/test/plugin/codex.test.ts @@ -122,6 +122,7 @@ describe("plugin.codex", () => { }) }) + // kilocode_change start describe("models filter", () => { test("filters out disallowed models for oauth users", async () => { const hooks = await CodexAuthPlugin({} as never) @@ -181,6 +182,7 @@ describe("plugin.codex", () => { expect(provider).toHaveProperty(["other-model"]) }) }) + // kilocode_change end test("installs websocket transport only when experimental websockets are enabled", async () => { const disabled = await CodexAuthPlugin({} as never)