Files
goose/crates
Filip Kujawa e418e993b1 fix(compaction): bound re-appended user message to stop thrash
Auto-compaction re-appended the latest user message verbatim. When that
message was large, post-compaction context landed right back over the
threshold, so every turn fired another full summarization call that never
relieved the pressure - context stayed pinned (~2x input tokens).

Middle-out truncate the re-appended message to a budget derived entirely
from real values: context limit, compaction threshold, current overhead
(system + tools + summary), and a reserve for the next turn (model max
output + per-turn additions like the turn-context block). Post-compaction
context now drops below the threshold with headroom, so the next turn
doesn't re-compact.
2026-06-29 22:04:45 -07:00
..