Skip to content

fix: cap GPT-5.6 ChatGPT sessions at the Codex 272k input budget - #10827

Merged
LionSR merged 4 commits into
mainfrom
fix/codex-gpt56-subscription-context
Aug 17, 2026
Merged

fix: cap GPT-5.6 ChatGPT sessions at the Codex 272k input budget#10827
LionSR merged 4 commits into
mainfrom
fix/codex-gpt56-subscription-context

Conversation

@LionSR

@LionSR LionSR commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

ChatGPT-subscription sessions on GPT-5.6 Sol, Terra, and Luna now use the same Codex budget as GPT-5.5: 272k input, 400k displayed context (input plus the registry 128k output). Compaction and the status bar follow those numbers instead of the old 372k / 500k split.

Codex CLI 0.145.0 lists context_window and max_context_window as 272000 for all three GPT-5.6 variants. OpenCode matched that today in anomalyco/opencode#39082. Our larger GPT-5.6-only cap let sessions run past the window the first-party harness advertises; the unofficial Codex backend then rejected the turn without a recoverable overflow error.

API-key and relay routes are unchanged. They still use the llm-zoo 1.05M window.

Issue acceptance gates

No tracking issue. Acceptance:

  • GPT-5.6 Sol / Terra / Luna ChatGPT-subscription profiles resolve to 272k input and 400k context
  • GPT-5.5 subscription budget is unchanged (400k / 272k)
  • API-key and relay status still shows the raw 1.05M registry window
  • Displayed subscription context is 272k + model.maxOutputTokens, not a second hardcoded GPT-5.6 constant

Single source of truth

src/model/providerCapabilities.tsCODEX_DEFAULT_SUBSCRIPTION_INPUT_LIMIT (272k). Displayed context is that input cap plus the model's registry maxOutputTokens.

Duplication and abstraction budget

Removed codexSubscriptionTokenLimits and the GPT-5.6-only 500k / 372k constants. One budget for every ChatGPT-subscription model.

Net elements (R6)

n/a — bug fix, not a refactor PR.

Consumer counts (R8)

n/a — deleted file-local helper and two exports that only this module and its suite consumed.

Host impact

Extension: model picker and progress context use the smaller subscription window on ChatGPT auth.

Desktop: same shared profile.

CLI: status bar for GPT-5.6 subscription usage shows 187k/400k instead of 187k/500k.

Scheduled refactoring

None. A 1M ChatGPT-account opt-in is deliberately not added; Codex still clamps Sol to the catalog 272k max.

Validation

  • npx vitest run src/test-kernel/model/ProviderCapabilities.vitest.ts src/test-kernel/cli/StatusBar.vitest.ts src/test-kernel/model/ComputeModelOptions.vitest.ts src/test-kernel/agent/modelHandlers/CodexSubscriptionFallback.vitest.ts

  • Post-audit fallback correction: 144 focused tests passed; workspace/test-kernel typechecks, full lint, Prettier, and diff checks passed.

Codex CLI 0.145.0 lists 272k for Sol, Terra, and Luna — the same as
GPT-5.5. The old 372k/500k split delayed compaction until the unofficial
backend rejected the turn.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread src/model/providerCapabilities.ts
@github-actions github-actions Bot added area:docs Documentation, PRDs, walkthroughs, screenshots, and guides area:model-handlers Model providers, SDK handlers, streaming, pricing, and model registry behavior bug Something isn't working labels Aug 17, 2026
LionSR and others added 2 commits August 17, 2026 17:44
Give the large-window Codex fixture the real 128k output budget so the
displayed subscription window stays 400k.
@LionSR
LionSR merged commit 78eadcf into main Aug 17, 2026
15 checks passed
@LionSR LionSR added the re-review Request a fresh AI review of this PR (consumed by the review workflows) label Aug 17, 2026
@github-actions github-actions Bot removed the re-review Request a fresh AI review of this PR (consumed by the review workflows) label Aug 17, 2026
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Findings

Diff is small and clean — no issues to flag.

This is a straightforward bug fix in src/model/providerCapabilities.ts: it replaces the GPT-5.6-only hardcoded 500k/372k constants (and the codexSubscriptionTokenLimits helper that special-cased the model id) with a single derivation — inputTokenLimit = min(272k, model.contextWindow) and contextWindow = min(inputTokenLimit + model.maxOutputTokens, model.contextWindow) — applied uniformly to every ChatGPT-subscription-eligible OpenAI model. This is a genuine SSOT improvement over the prior per-model constant table, not new indirection: the removed codexSubscriptionTokenLimits function and both GPT-5.6 constants have no remaining references anywhere in src/ or packages/, so this is a clean deletion, not a shim.

Checked against the review checklist:

  • Platform decoupling: src/model/ stays VS Code-free; no vscode import introduced.
  • Zod / schemas: no schema changes in this diff.
  • Abstraction/duplication (§13): net LoC and export count both go down (one helper + two constants deleted, zero added); this is a legitimate consolidation, not a "reduction" that grows LoC.
  • Test correctness: the four updated suites (CodexSubscriptionFallback, StatusBar, ComputeModelOptions, ProviderCapabilities) all derive their expected values from CODEX_DEFAULT_SUBSCRIPTION_INPUT_LIMIT + maxOutputTokens rather than a second hardcoded number, so they'll track the formula instead of drifting from it. The it.each(['gpt56', 'gpt56-', 'gpt56--']) conversion is a reasonable table-test collapse of what were near-duplicate cases.
  • Dead code: grepped for CODEX_DEFAULT_SUBSCRIPTION_CONTEXT_WINDOW, CODEX_GPT56_SUBSCRIPTION_CONTEXT_WINDOW, CODEX_GPT56_SUBSCRIPTION_INPUT_LIMIT, and codexSubscriptionTokenLimits across src/ and packages/ — all clean, no dangling imports.

The underlying factual claim (Codex CLI 0.145.0's context_window/max_context_window = 272000 for GPT-5.6 Sol/Terra/Luna) isn't independently verifiable from this repo since llm-zoo isn't vendored here, but the PR body cites the upstream OpenCode PR making the same correction, and the change is internally consistent across every call site and test.

Verified

  • Read src/model/providerCapabilities.ts:1-238 (full file) — confirmed the new formula, no vscode import, codexBackendModelId still has a live consumer in src/agent/modelHandlers/openai/modelHandlerCodex.ts:114.
  • Read the full diff (gh pr diff 10827) covering CHANGELOG.md, src/model/providerCapabilities.ts, src/test-kernel/agent/modelHandlers/CodexSubscriptionFallback.vitest.ts, src/test-kernel/cli/StatusBar.vitest.ts:690-760, src/test-kernel/model/ComputeModelOptions.vitest.ts:370-410, src/test-kernel/model/ProviderCapabilities.vitest.ts:1-50 plus the changed hunks.
  • Grepped src/ and packages/ for the three removed exports and the removed helper — no remaining references.
  • Grepped for codexBackendModelId usage — still consumed outside this file, correctly left in place.
  • Checked PR body/labels/comments via gh pr view and the GitHub MCP review-comment/review APIs (403'd — insufficient token scope, but the only existing comment is an automated Codex "usage limit reached" notice, not a review to reconcile against).

@LionSR
LionSR deleted the fix/codex-gpt56-subscription-context branch August 21, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation, PRDs, walkthroughs, screenshots, and guides area:model-handlers Model providers, SDK handlers, streaming, pricing, and model registry behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants