You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compaction occurs way before context limit reached on GPT 5.4 #16333
@christallire@GrahamCampbell
Adding the model to allowance list is not related to compaction and the model context window config in models.dev was also correct the last time I checked it. The issue is probably the compaction logic doesn't respect the context window or might be a calculation error. I may take another look at this when I am home.
I think the feature (extended context window) is also opt-in/beta-ish in the first-party Codex app and burns 2X usage beyond the 272K limit. So by default you'll get hit by compaction when reaching 272K, regardless of which software you use.
If you can implement this I'd also be interested in the fast mode ("/fast" in Codex CLI/App) toggle/config if you can.
Reacted by Xin-Ma, RVZO6, Brendan Duke, herobrauni, Leon Liechti, Xynonners and Zhao Chengyu
I wonder if the usage-API bypasses that limit. Their documentation there says 1.05M and doesn't say any special headers or config is needed... though that could just be crappy docs.
On Codex (apps) it requires modifying ~/.codex/config.toml so perhaps yeah somewhat undocumented stuff, but just like the fast mode it's probably sent through the headers.
As I reviewed the compaction logic, it basically limits the compaction window to model input limit minus reserved limit to be able to get a summary of the history. The problem with Openai oAuth provider is that it has an input window of 272k and a context window of 1m.
So to actually use 1m context window the options I can think of are:
disable the compaction entirely.
use gpt-5.4 from another provider (like from opencode zen with 900k input window)
refactor the compaction logic to use another strategy.
configure the current compaction logic to use compacting agent input limits instead of current agent limits and set a compact agent with a larger input limit. considering the input limit of current agent since the summary goes there.
In my opinion, first option wouldn't be beneficial at all. Third and fourth options are long term and need a deeper analysis. Best short term solution here is either going with second option or using the model as it is.
I am not a maintainer of the repo so this answer is based on a quick review of the codebase.
This configuration setup makes context window to 1.05M (This is experimental feature but It works)
I think opencode need to setup this configuration internally or change model loading features to load from outside configuration file for setup all other models.
Activity
github-actions commentedon Mar 6, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is already covered by one of the above, please consider closing this one and adding a "+1" or comment there instead.
christallire commentedon Mar 6, 2026
@msadiks gpt 5.4 needs little more love here <3 thanks!
msadiks commentedon Mar 6, 2026
@christallire @GrahamCampbell
Adding the model to allowance list is not related to compaction and the model context window config in models.dev was also correct the last time I checked it. The issue is probably the compaction logic doesn't respect the context window or might be a calculation error. I may take another look at this when I am home.
oddko commentedon Mar 6, 2026
I think the feature (extended context window) is also opt-in/beta-ish in the first-party Codex app and burns 2X usage beyond the 272K limit. So by default you'll get hit by compaction when reaching 272K, regardless of which software you use.
If you can implement this I'd also be interested in the fast mode ("/fast" in Codex CLI/App) toggle/config if you can.
GrahamCampbell commentedon Mar 6, 2026
I wonder if the usage-API bypasses that limit. Their documentation there says 1.05M and doesn't say any special headers or config is needed... though that could just be crappy docs.
oddko commentedon Mar 6, 2026
On Codex (apps) it requires modifying ~/.codex/config.toml so perhaps yeah somewhat undocumented stuff, but just like the fast mode it's probably sent through the headers.
msadiks commentedon Mar 6, 2026
As I reviewed the compaction logic, it basically limits the compaction window to model input limit minus reserved limit to be able to get a summary of the history. The problem with Openai oAuth provider is that it has an input window of 272k and a context window of 1m.
So to actually use 1m context window the options I can think of are:
In my opinion, first option wouldn't be beneficial at all. Third and fourth options are long term and need a deeper analysis. Best short term solution here is either going with second option or using the model as it is.
I am not a maintainer of the repo so this answer is based on a quick review of the codebase.
fix: resolve 8 open bug reports from upstream tracker
JSCOP commentedon Mar 10, 2026
This is codex configuration setup
This configuration setup makes context window to 1.05M (This is experimental feature but It works)
I think opencode need to setup this configuration internally or change model loading features to load from outside configuration file for setup all other models.
rekram1-node commentedon Mar 10, 2026
This should be fixed if u run
opencode models --refreshoddko commentedon Mar 11, 2026
Looks like it's working, thanks a lot !

JSCOP commentedon Mar 11, 2026
This works! thanks :)