Skip to content

Native OpenAI max_context_window incorrectly clamped to default context_window #7075

Closed

Description

@bryango

Client or integration

Codex CLI

Area

Catalog / models

Summary

OpenCodex seems to incorrectly set max_context_window to the default context_window for native OpenAI models, when no user-configured context cap is applied.

For example, GPT-6 Astra should have:

{
  "context_window": 272000,
  "max_context_window": 872000
}

But OpenCodex produces:

{
  "context_window": 272000,
  "max_context_window": 272000
}

This is somewhat confusing for users who dig into the model catalog. Although the most effective setting is context_window, I think we should not cap max_context_window if it is not necessary.

Reproduction

This is the default behavior of a vanilla install, unless I configured it incorrectly by some accident.
Oneliner to show what codex gets:

$ codex debug models 2>/dev/null | jq -r '(["slug","context_window","max_context_window"] | @tsv), (.models[] | [.slug, .context_window, .max_context_window] | @tsv)' | column -t -s $'\t'
slug                                       context_window  max_context_window
gpt-6-astra                                272000          272000
gpt-5.6-sol                                272000          272000
gpt-5.6-terra                              272000          272000
gpt-5.6-luna                               272000          272000
gpt-5.5                                    272000          272000
gpt-6-luna                                 272000          272000
gpt-6-sol                                  272000          272000
...

Version

2.83.0

Operating system

macOS 15.7.5

Provider and model

openai login

Screenshots and supporting files

Root cause

In src/codex/catalog/parsing.ts, narrowNativeMaxContextWindow() contains:

const resolved = nativeOpenAiContextWindow(slug, limits);
return Math.min(value, Math.max(resolved, 1));

When no user cap is configured, resolved equals the default context_window, causing max_context_window to be incorrectly reduced to that value.

Suggested fix

Only narrow max_context_window when an actual user-configured limit requires it. Otherwise, preserve the model's advertised maximum.

Expected behavior

Without a user-imposed cap, native OpenAI models should retain their original max_context_window (e.g., 872K), independently of the default context_window (272K).

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Oct 13, 2026
  2. bryango commented on Oct 13, 2026

    @bryango
    Author

    Related: my use case: I'd like to set 6.1 Sol to 500k with others set to 300k. Now I have to set the openai context cap to 500k, and then modify each and every other model by hand to 300k. This is not very convenient... I wonder whether the logic / UX can be improved.

  3. added
    catalog
    on Oct 13, 2026
  4. github-actions commented on Oct 13, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  5. Ingwannu commented on Oct 16, 2026

    @Ingwannu
    Owner

    Fixed on dev by #7130, commit ccb91914988eb62a885b42c142fb6402889931a5.

    Native advertised maximum context is now preserved unless a configured hard limit narrows it. The change also documents the existing per-model setting for the 500k/300k example.

    I checked that the merge commit is an ancestor of current inspected dev@4ae49360b7 and that its implementation is present. Regression commands and results are recorded in #7130; I did not rerun those tests in this triage pass.

    Closing as completed on the integration branch. This is not a claim that the fix has reached an npm/desktop release; please use a build containing the commit when checking the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcatalog

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions