fix(codex): add gpt-5.5 + gpt-5.6 to ChatGPT-subscription allowlist (closes #1132)

Merged
SA
3mo ago
+171-14

Summary

Fixes altimate-code#1132 — ChatGPT Pro/Plus (Codex tier) users could not pick gpt-5.6 in the model picker even though OpenAI shipped it and the upstream models.dev catalog has it.

Repro

  1. Connect ChatGPT subscription via OAuth
  2. Open the model picker under the openai provider
  3. Only gpt-5.1-codex through gpt-5.4-mini show; gpt-5.6 is absent

Root cause

The OAuth loader in packages/opencode/src/plugin/codex.ts:412-416 filters provider.models (which the build regenerates from models.dev and DOES contain gpt-5.6) against a hard-coded allowlist:

const allowedModels = new Set([
  "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini",
  "gpt-5.2", "gpt-5.2-codex",
  "gpt-5.3-codex",
  "gpt-5.4", "gpt-5.4-mini",
])
for (const modelId of Object.keys(provider.models)) {
  if (modelId.includes("codex")) continue
  if (allowedModels.has(modelId)) continue
  delete provider.models[modelId]      // ← gpt-5.6 gets deleted here
}

The allowlist hadn't been bumped since gpt-5.4-mini, so every newer non-codex model — gpt-5.5, gpt-5.6, and their variants — gets deleted before it reaches the picker.

Fix

  • Add gpt-5.5 + gpt-5.6 to the allowlist. Matches the existing precedent of allowlisting the plain "main" version per release (gpt-5.2, gpt-5.4).
  • Refactor the allowlist into an exported module-level OAUTH_ALLOWED_MODELS constant so it's unit-testable independently.
  • Not added (deliberately): gpt-5.4-pro, gpt-5.5-pro, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra. These show up on models.dev but aren't confirmed available on the ChatGPT-subscription (Codex) tier — showing them in the picker would surface as a request-time 4xx, not a UX improvement. Extend later once OpenAI announces subscription coverage.

Also touched: plugin/openai/codex.ts

There's a sibling file packages/opencode/src/plugin/openai/codex.ts with its OWN parallel ALLOWED_MODELS set — appears to be an in-progress refactor of the same plugin (currently NOT wired via plugin/index.ts; the ./codex import at plugin/index.ts:14 resolves to the file I fixed above, not the openai/ variant). Updated its allowlist for parity so the bug doesn't resurrect the moment that refactor lands.

Regression barrier

New test at packages/opencode/test/plugin/codex-allowlist.test.ts asserts:

  • gpt-5.5 + gpt-5.6 present (the issue this PR closes)
  • Prior generations retained (no accidental removal)
  • API-tier-only variants stay OUT of the allowlist (defensive)
  • Allowlist size never regresses below 10 (trip-wire for bad rebases)

Test plan

  • bun test test/plugin/codex-allowlist.test.ts test/plugin/codex.test.ts — 21/21 pass
  • bun turbo typecheck — clean
  • Marker Guard (--strict vs origin/main) — clean
  • CI on this PR
  • Once merged, ship in next release (probably v0.9.7); users on ChatGPT-subscription should see gpt-5.5 + gpt-5.6 in the picker

Follow-ups (not in this PR)

  • Reconcile the two codex.ts files. Having two parallel allowlists is a maintenance footgun; the winner needs to be picked and the other deleted.
  • Consider a data-driven approach where the allowlist is sourced from a config file or an OpenAI-published capability endpoint, so new model releases don't require a code push. Filed as a note in-code but not tracked as an issue yet.

Closes #1132


🤖 Generated with Claude Code


Summary by cubic

Adds gpt-5.5 and gpt-5.6 to the ChatGPT-subscription (OAuth) model allowlist so Pro/Plus users can select them. Previously gpt-5.6 was filtered out by a stale allowlist; now it appears while API-tier-only variants remain excluded.

  • Centralizes the OAuth model filter as OAUTH_ALLOWED_MODELS + shouldAllowOAuthModel in packages/opencode/src/plugin/codex.ts; the loader now delegates to it. Auto-allows ids containing "codex"; the set enumerates only non-codex main/mini releases.
  • Adds packages/opencode/test/plugin/codex-allowlist.test.ts for membership and filter behavior (with a size floor). Clarifies in-code comments and fixes the loader comment to avoid implying a shared policy with the unwired sibling packages/opencode/src/plugin/openai/codex.ts (which keeps its own parseFloat > 5.4 filter).
  • No migration; after release, ChatGPT-subscription users see gpt-5.5 and gpt-5.6 in the model picker.

Summary by CodeRabbit

  • New Features

    • OAuth model selection now supports all model IDs containing “codex,” including new variants.
    • Non-Codex models continue to be limited to the approved model list.
  • Bug Fixes

    • Prevented API-only and unrelated models from being incorrectly included in OAuth model selection.
    • Improved filtering consistency so only supported models are available through OAuth.
    • Added safeguards to maintain reliable model selection as new Codex variants are introduced.