Skip to content

Commit e50206c

Browse files
sahrizviclaude
andcommitted
fix(codex): add gpt-5.5 + gpt-5.6 to ChatGPT-subscription allowlist
Closes #1132. ChatGPT Pro/Plus (Codex tier) users couldn't select gpt-5.6 in the model picker even though OpenAI shipped it and `models.dev` (upstream catalog we regenerate `models-snapshot.ts` from at build time) has had it for a while. Root cause: the OAuth allowlist in packages/opencode/src/plugin/codex.ts hard-codes accepted model ids and hadn't been bumped past gpt-5.4-mini. Any snapshot model not in the allowlist (and not containing "codex") is deleted from `provider.models` at loader time — so gpt-5.6 never reached the picker. Fix: - Add `gpt-5.5` and `gpt-5.6` to `plugin/codex.ts`'s `OAUTH_ALLOWED_MODELS` (renamed + module-exported so it's unit- testable). Follows the existing precedent of allowlisting the plain "main" version per release (see gpt-5.2, gpt-5.4). Skips `pro`, `luna`, `sol`, `terra` variants — they're on models.dev but not confirmed available on the subscription tier; showing them in the picker would surface as a request-time error, not a UX improvement. - Also update `plugin/openai/codex.ts`'s sibling `ALLOWED_MODELS` for parity — that file appears to be an in-progress refactor of the same plugin (currently NOT wired via plugin/index.ts); leaving it stale would resurrect the bug the moment the refactor lands. Regression barrier: new `test/plugin/codex-allowlist.test.ts` asserts gpt-5.5 + gpt-5.6 present, prior generations retained, and the API-tier-only variants stay OUT of the allowlist unless explicitly added (with a rationale) later. Also a "no accidental truncation" size floor. 21/21 tests pass; typecheck clean; marker guard clean. Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 parent e3f7495 commit e50206c

3 files changed

Lines changed: 101 additions & 12 deletions

File tree

‎packages/opencode/src/plugin/codex.ts‎

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ const CODEX_API_ENDPOINT = "https://chatgpt.com/backend-api/codex/responses"
1616
const OAUTH_PORT = 1455
1717
const OAUTH_POLLING_SAFETY_MARGIN_MS = 3000
1818

19+
/** Non-codex ChatGPT-subscription (OAuth) allowlist. Any modelId
20+
* containing "codex" is auto-allowed elsewhere; this set only enumerates
21+
* the plain main/mini variants OpenAI exposes on Codex-tier accounts.
22+
* Bump whenever a new gpt-5.N is generally available on the subscription.
23+
* Exported for unit-test coverage — see test/plugin/codex-allowlist.test.ts. */
24+
export const OAUTH_ALLOWED_MODELS = new Set([
25+
"gpt-5.1-codex",
26+
"gpt-5.1-codex-max",
27+
"gpt-5.1-codex-mini",
28+
"gpt-5.2",
29+
"gpt-5.2-codex",
30+
"gpt-5.3-codex",
31+
"gpt-5.4",
32+
"gpt-5.4-mini",
33+
"gpt-5.5",
34+
"gpt-5.6",
35+
])
36+
1937
interface PkceCodes {
2038
verifier: string
2139
challenge: string
@@ -398,17 +416,14 @@ export async function CodexAuthPlugin(input: PluginInput): Promise<Hooks> {
398416
const auth = await getAuth()
399417
if (auth.type !== "oauth") return {}
400418

401-
// Filter models to only allowed Codex models for OAuth
402-
const allowedModels = new Set([
403-
"gpt-5.1-codex",
404-
"gpt-5.1-codex-max",
405-
"gpt-5.1-codex-mini",
406-
"gpt-5.2",
407-
"gpt-5.2-codex",
408-
"gpt-5.3-codex",
409-
"gpt-5.4",
410-
"gpt-5.4-mini",
411-
])
419+
// Filter models to only allowed Codex models for OAuth. Any modelId
420+
// whose id includes "codex" is auto-allowed by the loop below, so
421+
// this set only enumerates the non-codex ChatGPT-subscription
422+
// main/mini variants. Keep in sync with what OpenAI's ChatGPT
423+
// Pro/Plus subscription actually accepts — bump when a new
424+
// release (gpt-5.5, 5.6, 5.7, ...) is available on the
425+
// subscription tier. (Closes #1132 — GPT 5.6 missing from picker.)
426+
const allowedModels = OAUTH_ALLOWED_MODELS
412427
for (const modelId of Object.keys(provider.models)) {
413428
if (modelId.includes("codex")) continue
414429
if (allowedModels.has(modelId)) continue

‎packages/opencode/src/plugin/openai/codex.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@ const ISSUER = "https://auth.openai.com"
1212
const CODEX_API_ENDPOINT = "https://chatgpt.com/backend-api/codex/responses"
1313
const OAUTH_PORT = 1455
1414
const OAUTH_POLLING_SAFETY_MARGIN_MS = 3000
15-
const ALLOWED_MODELS = new Set(["gpt-5.5", "gpt-5.3-codex-spark", "gpt-5.4", "gpt-5.4-mini"])
15+
// Non-codex ChatGPT-subscription (OAuth) allowlist. Keep in sync with
16+
// the sibling ALLOWED_MODELS in ../codex.ts — both files exist during a
17+
// refactor in flight; whichever is wired via plugin/index.ts is the
18+
// active one. (Closes #1132 — GPT 5.6 missing from picker.)
19+
const ALLOWED_MODELS = new Set([
20+
"gpt-5.3-codex-spark",
21+
"gpt-5.4",
22+
"gpt-5.4-mini",
23+
"gpt-5.5",
24+
"gpt-5.6",
25+
])
1626

1727
interface PkceCodes {
1828
verifier: string
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Regression coverage for the ChatGPT-subscription (OAuth) allowlist in
2+
// packages/opencode/src/plugin/codex.ts.
3+
//
4+
// Filed as issue #1132: GPT 5.6 was released but the allowlist stopped
5+
// at 5.4, so users on ChatGPT Pro/Plus (Codex tier) couldn't pick it in
6+
// the model picker even though the underlying models.dev catalog had it.
7+
//
8+
// Sibling test file test/plugin/codex.test.ts covers `plugin/openai/codex.ts`
9+
// (a parallel implementation currently NOT wired into plugin/index.ts).
10+
// This file covers the ACTIVE plugin at `plugin/codex.ts`.
11+
import { describe, expect, test } from "bun:test"
12+
import { OAUTH_ALLOWED_MODELS } from "../../src/plugin/codex"
13+
14+
describe("codex OAUTH_ALLOWED_MODELS — subscription model picker regression barrier", () => {
15+
test("issue #1132: gpt-5.6 is present", () => {
16+
// If this test starts failing again, someone dropped gpt-5.6 from
17+
// the allowlist without moving forward to a newer generation —
18+
// rejecting a shipped OpenAI model users have subscription access to.
19+
expect(OAUTH_ALLOWED_MODELS.has("gpt-5.6")).toBe(true)
20+
})
21+
22+
test("gpt-5.5 is present (added alongside 5.6 for parity)", () => {
23+
expect(OAUTH_ALLOWED_MODELS.has("gpt-5.5")).toBe(true)
24+
})
25+
26+
test("prior generations stay allowlisted (no accidental removal)", () => {
27+
for (const id of [
28+
"gpt-5.1-codex",
29+
"gpt-5.1-codex-max",
30+
"gpt-5.1-codex-mini",
31+
"gpt-5.2",
32+
"gpt-5.2-codex",
33+
"gpt-5.3-codex",
34+
"gpt-5.4",
35+
"gpt-5.4-mini",
36+
]) {
37+
expect(OAUTH_ALLOWED_MODELS.has(id)).toBe(true)
38+
}
39+
})
40+
41+
test("allowlist does NOT include API-tier-only variants (defensive)", () => {
42+
// Pro / luna / sol / terra variants ship on models.dev but are not
43+
// confirmed available on the ChatGPT-subscription (Codex) tier —
44+
// showing them in the picker would surface a request-time failure.
45+
// If OpenAI extends subscription coverage to them, add them here
46+
// deliberately (with a link to the announcement).
47+
for (const id of [
48+
"gpt-5.4-pro",
49+
"gpt-5.5-pro",
50+
"gpt-5.6-luna",
51+
"gpt-5.6-sol",
52+
"gpt-5.6-terra",
53+
]) {
54+
expect(OAUTH_ALLOWED_MODELS.has(id)).toBe(false)
55+
}
56+
})
57+
58+
test("allowlist size never regresses below current baseline", () => {
59+
// A trip-wire: if someone truncates the allowlist by mistake (or in
60+
// a bad rebase), the count drops and this test catches it before
61+
// shipping. Bump when a real new addition lands.
62+
expect(OAUTH_ALLOWED_MODELS.size).toBeGreaterThanOrEqual(10)
63+
})
64+
})

0 commit comments

Comments
 (0)