GPT 5.2 Codex - Compaction happens way too early and context limit is wrong #7906

Open
opened 2026-02-16 18:08:38 -05:00 by yindo · 6 comments
Owner

Originally created by @Simplereally on GitHub (Jan 28, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

GPT 5.2 Codex via Copilot is compacting at 100k tokens when the model's context is 272k.

Plugins

None

OpenCode version

latest

Steps to reproduce

  1. Use gpt-5.2-codex via github copilot
  2. Context in top right indicates max 100k when it is actually 272k
  3. Reach ~90k+ tokens in session and compaction happens

Screenshot and/or share link

Image

Operating System

Windows 10 latest

Terminal

Windows Terminal

Originally created by @Simplereally on GitHub (Jan 28, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description GPT 5.2 Codex via Copilot is compacting at 100k tokens when the model's context is 272k. ### Plugins None ### OpenCode version latest ### Steps to reproduce 1. Use gpt-5.2-codex via github copilot 2. Context in top right indicates max 100k when it is actually 272k 3. Reach ~90k+ tokens in session and compaction happens ### Screenshot and/or share link <img width="1451" height="1327" alt="Image" src="https://github.com/user-attachments/assets/7ba79fc9-c230-4bd3-999e-ab2a93065941" /> ### Operating System Windows 10 latest ### Terminal Windows Terminal
yindo added the windowsbug labels 2026-02-16 18:08:38 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 28, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7705: Default Codex context length not matching Pro plan - Reports that GPT 5.2 Codex shows 400k but Pro plan actually has 250-260k, causing early compaction
  • #10650: GitHub Copilot GPT-5 throwing "invalid_request_body" on requests after compaction - Reports context compaction failures with GitHub Copilot GPT-5
  • #3314: github copilot: 2x token (counts total=total+cached) compacts at 64k, instead of 128k - Reports incorrect token counting and premature compaction with GitHub Copilot models
  • #10634: Compaction overflow check doesn't account for large tool outputs until the next step, causing context overflow - Reports compaction being triggered too early due to incomplete overflow checks

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 28, 2026): This issue might be a duplicate of existing issues. Please check: - #7705: Default Codex context length not matching Pro plan - Reports that GPT 5.2 Codex shows 400k but Pro plan actually has 250-260k, causing early compaction - #10650: GitHub Copilot GPT-5 throwing "invalid_request_body" on requests after compaction - Reports context compaction failures with GitHub Copilot GPT-5 - #3314: github copilot: 2x token (counts total=total+cached) compacts at 64k, instead of 128k - Reports incorrect token counting and premature compaction with GitHub Copilot models - #10634: Compaction overflow check doesn't account for large tool outputs until the next step, causing context overflow - Reports compaction being triggered too early due to incomplete overflow checks Feel free to ignore if none of these address your specific case.
Author
Owner

@Deftera186 commented on GitHub (Jan 29, 2026):

This is probably related to a problem in models.dev that was fixed 2 weeks ago:
https://github.com/anomalyco/models.dev/commit/b0e5b914c8376b6305391478712a08aaa7b7531f

maybe you still have the old cache for some reason? try to remove your ~/.cache/opencode/models.json and update if it helps

@Deftera186 commented on GitHub (Jan 29, 2026): This is probably related to a problem in models.dev that was fixed 2 weeks ago: https://github.com/anomalyco/models.dev/commit/b0e5b914c8376b6305391478712a08aaa7b7531f maybe you still have the old cache for some reason? try to remove your `~/.cache/opencode/models.json` and update if it helps
Author
Owner

@Waishnav commented on GitHub (Jan 29, 2026):

Yup, they have fixed this issue. It is working all fine

@Waishnav commented on GitHub (Jan 29, 2026): Yup, they have fixed this issue. It is working all fine
Author
Owner

@dlukt commented on GitHub (Feb 5, 2026):

Nope. Deleting ~/.cache/opencode/models.json does not fix it.

49,590  39% ($0.00)
v1.1.51

50k tokens and already 39% context used.

grep github-copilot/gpt-5.2 ~/.cache/opencode/models.json

No results.

The search for github-copilot in this repo reveals no results either.

How can you greatly announce your partnership when you don't even do the basics?

@dlukt commented on GitHub (Feb 5, 2026): Nope. Deleting `~/.cache/opencode/models.json` does not fix it. ``` 49,590 39% ($0.00) v1.1.51 ``` 50k tokens and already 39% context used. ``` grep github-copilot/gpt-5.2 ~/.cache/opencode/models.json ``` No results. The search for `github-copilot` in this repo reveals no results either. How can you greatly announce your partnership when you don't even do the basics?
Author
Owner

@dlukt commented on GitHub (Feb 5, 2026):

The issue is most likely because you source https://models.dev/api.json
which incorrectly states the limits for context and output to 128k and 64k

I'm letting OpenAI/gpt-5.2 now fix this issue and will send a PR

@dlukt commented on GitHub (Feb 5, 2026): The issue is most likely because you source https://models.dev/api.json which incorrectly states the limits for context and output to 128k and 64k I'm letting OpenAI/gpt-5.2 now fix this issue and will send a PR
Author
Owner

@dlukt commented on GitHub (Feb 5, 2026):

"provider": {
    "github-copilot": {
      "models": {
        "gpt-5.2": {
          "limit": {
            "context": 400000,
            "input": 272000,
            "output": 128000
          }
        },
        "gpt-5.2-codex": {
          "limit": {
            "context": 400000,
            "input": 272000,
            "output": 128000
          }
        }
      }
    },
    "github-copilot-enterprise": {
      "models": {
        "gpt-5.2": {
          "limit": {
            "context": 400000,
            "input": 272000,
            "output": 128000
          }
        },
        "gpt-5.2-codex": {
          "limit": {
            "context": 400000,
            "input": 272000,
            "output": 128000
          }
        }
      }
    }
  }
}
@dlukt commented on GitHub (Feb 5, 2026): ``` "provider": { "github-copilot": { "models": { "gpt-5.2": { "limit": { "context": 400000, "input": 272000, "output": 128000 } }, "gpt-5.2-codex": { "limit": { "context": 400000, "input": 272000, "output": 128000 } } } }, "github-copilot-enterprise": { "models": { "gpt-5.2": { "limit": { "context": 400000, "input": 272000, "output": 128000 } }, "gpt-5.2-codex": { "limit": { "context": 400000, "input": 272000, "output": 128000 } } } } } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7906