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
A large compaction.buffer leaves small models no room before compaction #58146
compaction.buffer is subtracted from the model's window with no upper bound (calculateCeiling in packages/core/src/session/compaction.ts: window - buffer). A buffer tuned for a large model therefore leaves a smaller model almost no room: with buffer: 100000 on a 100k window the ceiling is 0, so automatic compaction is due on every request, and on a 64k window it is negative.
Seen with a global config that sets compaction.buffer: 100000 for 1M-token models and is then used with smaller models.
Found while porting #54993 (a v1 report of the same problem, reviewed on #54994) to v2.
Thanks for the clear report and for porting this from #54994. I think this is a duplicate of #56783, which reports the same root cause on v2 and has already been reproduced on v2.0.32 and on dev. When one global compaction.buffer is at or above a model's window, window - buffer comes out at zero or below, so automatic compaction is due on every request. Your buffer: 100000 on a 100k window (and on a 64k window) is that case.
Possible duplicates and closely related issues, ordered from most to least likely:
Closing this as a duplicate of #56783, since there's been no reply saying how this one is different. Both report the same problem: when compaction.buffer is at or above a model's context window, window - buffer comes out at zero or below, so automatic compaction is due on every request. Please follow #56783 for updates.
Two PRs would fix it in different ways: #56786 treats an oversized buffer as unset, and your #58147 caps the buffer at a quarter of the window. Linking #58147 to #56783 would help maintainers compare them. Per-model buffers are tracked in #43703 and #56443.
Until a fix lands, keeping compaction.buffer below the smallest context window among your models avoids the problem. If this turns out to be a different problem, reply here and we'll take another look.
Activity
opencode-agent commentedon Oct 22, 2026
Thanks for the clear report and for porting this from #54994. I think this is a duplicate of #56783, which reports the same root cause on v2 and has already been reproduced on v2.0.32 and on
dev. When one globalcompaction.bufferis at or above a model's window,window - buffercomes out at zero or below, so automatic compaction is due on every request. Yourbuffer: 100000on a 100k window (and on a 64k window) is that case.Possible duplicates and closely related issues, ordered from most to least likely:
compaction.buffer>= the model's context limit makes auto-compaction fire on every turn (open, reproduced)compaction.buffer>= model context limit #56813: the same report again, already closed as a duplicate of V2: compaction fires on first request / loops when compaction.buffer >= model context limit #56783The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different from #56783.
opencode-agent commentedon Oct 23, 2026
Closing this as a duplicate of #56783, since there's been no reply saying how this one is different. Both report the same problem: when
compaction.bufferis at or above a model's context window,window - buffercomes out at zero or below, so automatic compaction is due on every request. Please follow #56783 for updates.Two PRs would fix it in different ways: #56786 treats an oversized buffer as unset, and your #58147 caps the buffer at a quarter of the window. Linking #58147 to #56783 would help maintainers compare them. Per-model buffers are tracked in #43703 and #56443.
Until a fix lands, keeping
compaction.bufferbelow the smallest context window among your models avoids the problem. If this turns out to be a different problem, reply here and we'll take another look.