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
Prune is too aggressive for long-context models and should scale with model context #16285
SessionCompaction.prune() currently uses fixed thresholds:
PRUNE_PROTECT = 40_000
PRUNE_MINIMUM = 20_000
and runs after each assistant turn.
That means old tool outputs start being replaced with [Old tool result content cleared] after only ~40K protected tool-output tokens, regardless of whether the active model has a 128K, 200K, or 1.05M context window.
Why this feels wrong on 1M-context models
Full compaction already looks at model limits, but prune does not. So on long-context models, prune can start clearing old tool results very early even when the session is still nowhere near the actual compaction / overflow threshold.
In practice this feels like premature memory loss on large-context models: the model still has plenty of room left, but important older tool output is already gone.
Current workaround
There is a boolean escape hatch via compaction.prune: false, but that is all-or-nothing. There is no way to tune the thresholds.
Request
Could you consider one or more of the following?
scale prune thresholds from model.limit.context
add config for thresholds such as prune_protect / prune_minimum
make prune less aggressive automatically for very large-context models
expose clearer logs / UI around what was pruned and why
I think this would make long-context models behave much more intuitively.
This appears to be a feature request, but the title does not start with [FEATURE]: and the feature request issue template was not used. Please resubmit using the feature request template, which requires a verification checkbox and description, with the title prefixed by [FEATURE]:.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
Closing this in favor of #11930, since that issue is already tracking configurable compaction behavior.
I added a follow-up comment there with the prune-specific details from this issue, because my main concern is that prune currently uses fixed thresholds and feels too aggressive on long-context models.
Activity
github-actions commentedon Mar 6, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:and the feature request issue template was not used. Please resubmit using the feature request template, which requires a verification checkbox and description, with the title prefixed by[FEATURE]:.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
thresholdandmaxContextconfig optionsIf you believe this was flagged incorrectly, please let a maintainer know.
nyl199310 commentedon Mar 6, 2026
Closing this in favor of #11930, since that issue is already tracking configurable compaction behavior.
I added a follow-up comment there with the prune-specific details from this issue, because my main concern is that
prunecurrently uses fixed thresholds and feels too aggressive on long-context models.