fix(opencode): allow integer GPT versions in Codex model filter (#47384)

This commit is contained in:
Aiden Cline 2026-09-04 18:14:21 -05:00 committed by GitHub
parent 5cf9f517cf
commit 500c46ec79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View file

@ -297,7 +297,7 @@ 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+)/)
const match = model.api.id.match(/^gpt-(\d+(?:\.\d+)?)/)
return match ? parseFloat(match[1]) > 5.4 : false
})
.map(([modelID, model]) => [

View file

@ -326,6 +326,29 @@ describe("plugin.codex", () => {
)
})
test.each([
["gpt-6-astra", true],
["gpt-6", true],
["gpt-6.0-astra", true],
["gpt-7", true],
["gpt-5", false],
["gpt-4.1", false],
["gpt-5.5-pro", false],
["gpt-5.6", false],
["not-a-gpt-model", false],
])("filters OAuth model %s with integer or decimal versions", async (id, allowed) => {
const hooks = await CodexAuthPlugin({} as never)
const provider = {
models: {
[id]: { id, api: { id }, limit: {}, cost: {}, options: {} },
},
}
const models = await hooks.provider!.models!(provider as never, { auth: { type: "oauth" } } as never)
expect(Object.keys(models)).toEqual(allowed ? [id] : [])
})
test("deduplicates concurrent Codex token refreshes", async () => {
const refreshedAccess = createTestJwt({
"https://api.openai.com/auth": { chatgpt_compute_residency: "eu" },