Repository navigation
Description
Description
When using OpenAI OAuth / Codex with openai/gpt-5.5, the effective context appears to behave closer to ~400k than 1M, and the UI/compaction behavior becomes inconsistent.
This looks related to closed issue #24171, but I am still reproducing the same mismatch in current OpenCode behavior.
Concrete observations:
- With GPT-5.5 via OAuth/Codex, the UI/context behavior suggests an effective window around ~400k
- Example: about 91k tokens showed as 23% usage, which implies a denominator around ~395k, not ~1.05M
- In previous longer sessions, auto-compaction triggered around ~250k–260k total tokens (roughly "~300k" from user perspective), far earlier than expected for a 1M-class model
- By contrast, GPT-5.4 appears to show the expected 1M-ish context behavior/UI
I also checked OpenCode’s local cached model metadata and both GPT-5.4 and GPT-5.5 report the same limits:
openai/gpt-5.4 -> context: 1,050,000 / input: 922,000 / output: 128,000
openai/gpt-5.5 -> context: 1,050,000 / input: 922,000 / output: 128,000
opencode/gpt-5.4 -> context: 1,050,000 / input: 922,000 / output: 128,000
opencode/gpt-5.5 -> context: 1,050,000 / input: 922,000 / output: 128,000
So this does not look like a simple stale local cache problem.
I also checked current OpenCode source behavior locally:
- UI percentage is calculated from
totalTokens / model.limit.context - proactive overflow / compaction uses
model.limit.input - reserved
Given the metadata above, GPT-5.5 should not compact anywhere near ~250k. That makes this look like a runtime/provider-side mismatch between the metadata OpenCode thinks GPT-5.5 has and the effective Codex OAuth backend limit actually enforced.
Related issues:
- GPT-5.5 Codex context limit dropped to 400k but uses API context limit (1M) causing "exceeds the context window of this model" errors #24171 (closed, but seems highly related)
- Unusable sessions after 1.14.24 upgrade. New messages on session with just 161.2k context are now triggering compaction but never succeeds. It claims to have over 1M context. Conversations before 1.14.24 are now unrecoverable because of this. #24249
- Auto-compaction triggers at ~200k tokens instead of model's actual context window (1M) #15871
Plugins
No third-party plugins required for reproduction. This was reproduced with OpenCode using OpenAI OAuth / Codex authentication.
OpenCode version
1.14.27
Steps to reproduce
- Authenticate OpenAI using OAuth / Codex (not API key)
- Start an OpenCode session with
openai/gpt-5.5 - Let the conversation grow naturally
- Observe the context percentage shown in the UI and when auto-compaction happens
- Compare the same flow with
openai/gpt-5.4
Screenshot and/or share link
No share link. Diagnosed from local observation, session behavior, cached model metadata, and source inspection.
Operating System
Linux
Terminal
OpenCode TUI on Linux using bash
Activity
github-actions commentedon Apr 27, 2026
This issue might be a duplicate of existing issues. Please check:
context_length_exceedederrors. This was closed but you note you are still reproducing the same behavior.If this is still occurring after #24171 was closed, it may be worth clarifying what changed (if anything) and whether the fix from that issue was released or not. You may also want to reference #24249 which describes related compaction failures after a recent upgrade.
SoyJohnXD commentedon Apr 27, 2026
Thanks — this does look very closely related to #24171.
The reason I opened a new issue instead of only referencing #24171 is that I am still reproducing the behavior on OpenCode 1.14.27 with OpenAI OAuth / Codex.
What seems worth clarifying is:
openai/gpt-5.5is still an effective ~400k windowgpt-5.4appears to show the expected ~1M-style behavior/UI whilegpt-5.5does not under the same OAuth/Codex flowMy main reason for reporting again is that the issue does not look purely historical from my side:
~91kshowed as23%usage, implying an effective window around~395k~250k–260k1,050,000context for bothgpt-5.4andgpt-5.5So if this is expected for Codex OAuth, the current UI / metadata / compaction signals still seem misleading. If it is not expected, then the underlying mismatch may still be present.
Happy to move/close this if maintainers confirm it is fully covered by #24171, but I wanted to document that I can still reproduce it on the current version.
void0x14 commentedon Apr 27, 2026
I'm experiencing the same issue, but I'm using OpenCode via 9Router with OAuth. When I reached around 240K tokens, it started throwing the error: "Error: Your input exceeds the context window of this model. Please adjust your input and try again." It didn’t resolve until I set it to compact. However, the context window is set to 1M in the config file, so it shouldn’t be doing this. It hadn’t been doing this for days, but it started today.
rekram1-node commentedon Apr 27, 2026
When using gpt-5.5 through oauth it has a context window of 400k NOT 1M like api does (FOR NOW AT LEAST).
Context at 400k means the input limit is 272k, so opencode will compact a bit before then in some cases to ensure that there is enough space to compact
SAIL-Fang commentedon Apr 27, 2026
I was able to use the 1M context window a few days ago, what happened?
SAIL-Fang commentedon Apr 27, 2026
Well it looks like there was a problem before, now it's fixed
void0x14 commentedon Apr 27, 2026
Yes, I realized this terrible situation later. Also, the GPT 5.5 used up my data allowance like water. It consumes far too much power for its performance and is truly a terrible model. Therefore, I reverted to the GPT 5.4 High and I have no problems for now.