GeezerVison is showing github.com — fix(opencode): compare Codex GPT versions by major and minor (#47385) · krumpstead/opencode@02a167e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/plugin/openai/codex.ts +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -297,8 +297,11 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug | 297 | 297 | if (ALLOWED_MODELS.has(model.api.id)) return true | 298 | 298 | if (DISALLOWED_MODELS.has(model.api.id)) return false | 299 | 299 | if (model.api.id === "gpt-5.6") return false | 300 | | - const match = model.api.id.match(/^gpt-(\d+(?:\.\d+)?)/) | 301 | | - return match ? parseFloat(match[1]) > 5.4 : false | | 300 | + const match = model.api.id.match(/^gpt-(\d+)(?:\.(\d+))?/) | | 301 | + if (!match) return false | | 302 | + const major = Number(match[1]) | | 303 | + const minor = Number(match[2] ?? 0) | | 304 | + return major > 5 || (major === 5 && minor > 4) | 302 | 305 | }) | 303 | 306 | .map(([modelID, model]) => [ | 304 | 307 | modelID, | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/test/plugin/codex.test.ts +13-1Lines changed: 13 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -331,12 +331,24 @@ describe("plugin.codex", () => { | 331 | 331 | ["gpt-6", true], | 332 | 332 | ["gpt-6.0-astra", true], | 333 | 333 | ["gpt-7", true], | | 334 | + ["gpt-10", true], | | 335 | + ["gpt-5.5-astra", true], | | 336 | + ["gpt-5.9", true], | | 337 | + ["gpt-5.10", true], | | 338 | + ["gpt-5.10-astra", true], | | 339 | + ["gpt-5.40", true], | 334 | 340 | ["gpt-5", false], | | 341 | + ["gpt-5.4-astra", false], | | 342 | + ["gpt-5.04-astra", false], | 335 | 343 | ["gpt-4.1", false], | | 344 | + ["gpt-4.99", false], | 336 | 345 | ["gpt-5.5-pro", false], | 337 | 346 | ["gpt-5.6", false], | | 347 | + ["gpt-6garbage", true], | | 348 | + ["gpt-6.", true], | | 349 | + ["gpt-6.1.2", true], | 338 | 350 | ["not-a-gpt-model", false], | 339 | | - ])("filters OAuth model %s with integer or decimal versions", async (id, allowed) => { | | 351 | + ])("filters OAuth model %s by GPT major and minor versions", async (id, allowed) => { | 340 | 352 | const hooks = await CodexAuthPlugin({} as never) | 341 | 353 | const provider = { | 342 | 354 | models: { | |
|