fix(opencode): compare Codex GPT versions by major and minor (#47385)

This commit is contained in:
Aiden Cline 2026-09-04 18:22:56 -05:00 committed by GitHub
parent 500c46ec79
commit 02a167e048
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View file

@ -297,8 +297,11 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
if (ALLOWED_MODELS.has(model.api.id)) return true
if (DISALLOWED_MODELS.has(model.api.id)) return false
if (model.api.id === "gpt-5.6") return false
const match = model.api.id.match(/^gpt-(\d+(?:\.\d+)?)/)
return match ? parseFloat(match[1]) > 5.4 : false
const match = model.api.id.match(/^gpt-(\d+)(?:\.(\d+))?/)
if (!match) return false
const major = Number(match[1])
const minor = Number(match[2] ?? 0)
return major > 5 || (major === 5 && minor > 4)
})
.map(([modelID, model]) => [
modelID,

View file

@ -331,12 +331,24 @@ describe("plugin.codex", () => {
["gpt-6", true],
["gpt-6.0-astra", true],
["gpt-7", true],
["gpt-10", true],
["gpt-5.5-astra", true],
["gpt-5.9", true],
["gpt-5.10", true],
["gpt-5.10-astra", true],
["gpt-5.40", true],
["gpt-5", false],
["gpt-5.4-astra", false],
["gpt-5.04-astra", false],
["gpt-4.1", false],
["gpt-4.99", false],
["gpt-5.5-pro", false],
["gpt-5.6", false],
["gpt-6garbage", true],
["gpt-6.", true],
["gpt-6.1.2", true],
["not-a-gpt-model", false],
])("filters OAuth model %s with integer or decimal versions", async (id, allowed) => {
])("filters OAuth model %s by GPT major and minor versions", async (id, allowed) => {
const hooks = await CodexAuthPlugin({} as never)
const provider = {
models: {