mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-21 05:52:35 +08:00
Merge pull request #12040 from rakshith1928/fix/hide-models-oauth
fix(codex): hide gpt-5.5-pro for Codex OAuth users
This commit is contained in:
@@ -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.
|
||||
@@ -29,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
|
||||
@@ -394,6 +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 // kilocode_change
|
||||
const match = model.api.id.match(/^gpt-(\d+\.\d+)/)
|
||||
return match ? parseFloat(match[1]) > 5.4 : false
|
||||
})
|
||||
|
||||
@@ -122,6 +122,68 @@ describe("plugin.codex", () => {
|
||||
})
|
||||
})
|
||||
|
||||
// kilocode_change start
|
||||
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"])
|
||||
})
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
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 })
|
||||
|
||||
Reference in New Issue
Block a user