When a turn started from an existing summary and its reply then compacted again between tool calls, the new summary was written without the earlier one whenever the plain summary prompt was used (a model with a filter, a separate Context Compaction Model, or a provider that refuses the cached replay). From the next turn on, everything the earlier summary held was gone. That compaction now gets the turn's summary as its previous summary, as a compaction at the start of a turn already does.
Fixes#34141
Context compaction can already run partway through a long reply that calls many tools. If /compact was used after such a reply, the next message sent the model every tool call and result from that reply again, so the request grew instead of shrinking and could go past the model's context limit. Now the model gets the same shortened history it got before /compact, plus the new summary. Nothing changes in the saved chat or in what the chat shows.
Fixes#33911
Without Task Model Params set, the compaction summary was capped at 1000 tokens. Reasoning models could spend all of that on thinking and return an empty or cut-off summary, which then replaced the chat's context. The summary request now carries no token limit of its own unless Task Model Params sets one, so the provider's normal limits apply.
Context compaction summarizes older messages and keeps the most recent ones verbatim, splitting the chat at a user message. It skipped the chat whenever the first follow-up message sat too close to the end to keep the share set in the Retained Messages admin setting. So a fresh chat with one question and one reply carrying a lot of tool output never compacted: the follow-up failed with a context length error, and regenerating or editing that follow-up failed the same way. Now compaction splits at the first follow-up message in that case, keeping fewer messages than Retained Messages asks for, so the chat keeps working. Chats where a split already met that share compact as before, and compaction between tool calls is unchanged.
Fixes#32781
Images stored inside the chat record itself (chats from older versions, images that could not be saved as files, temporary chats) had their encoded data counted as text when estimating how full the context is, so a single 3 MB image counted as about a million tokens. That pushed the chat over the compaction threshold, summarizing older messages while the chat was well under the limit, and made the context usage indicator jump. The encoded image data is now left out of the token estimate, both for compaction and for the indicator.
Fixes#31913