feat: declare input window for 1M models so auto-compaction fires before the edge - #18
Open
mradwankhalil wants to merge 1 commit into
Open
mradwankhalil wants to merge 1 commit into
mradwankhalil wants to merge 1 commit into
Conversation
OpenCode schedules automatic compaction at (limit.input - reserved) when a model declares an input cap, falling back to (context - maxOutput) otherwise. The 1M Claude Code models declared only context/output, so scheduled compaction landed at the very edge of the window (~98% observed in long sessions). Declaring a 900k input window moves the trigger to ~88-90% and leaves 200K models unchanged.
This was referenced Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Declares an input window (
limit.input = 900_000) for the 1M-context models (aliasesfable/opus/sonnet, plus the pinned 1M ids) and surfaces it through both the provider models and the static config entries. 200K models are unchanged.Why
OpenCode schedules automatic compaction at
limit.input - compaction.reservedwhen a model declares an input cap, and falls back tolimit.context - maxOutputTokensotherwise. The 1M models declared{ context, output }only, so scheduled compaction crawled to the very edge of the window (~98% observed in long sessions) - effectively never in practice. A declared input window moves the scheduled trigger to ~88-90% of the window (depending oncompaction.reserved), matching Claude Code's own auto-compact timing.Behavior
900k - reservedinput tokens.Verification
bun run buildpasses.test/smoke.tsand verified directly.test/smoke.tsis POSIX-only and fails on Windows hosts; confirmed failing on unmodifiedmainas well (unrelated to this change).