Repository navigation
Conversation
After an auto-compaction, :auto-compacted? stayed true for the rest of the turn, so neither the threshold check nor the context-overflow fallback could compact again. Long turns, common with steered messages, filled the context a second time and ended with "Context window exceeded". The turn-wide flag is now a per-compaction guard. It is released on the first usage update that shows the compacted context under the threshold, so later compactions can run. If the compacted context is still too big the guard stays on, keeping the editor-code-assistant#391 loop protection. The "Continue with the task" prefix no longer stacks on each compaction. A turn auto-compacts at most autoCompactMaxPerTurn times (default 3, global or per agent), so a turn that keeps refilling the context can't keep sending full-context compaction requests. Related to editor-code-assistant#615 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default config listed in introduction.md still showed 85. The default was lowered to 75 in 3a26d6d, and the code, the schema and context-management.md already say 75. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Related to #615.
Problem
After an auto-compaction, ECA does not auto-compact again until the user turn ends. A long turn can fill the context a second time and end with
Context window exceeded. Steering makes this common, because steered messages join the running turn.Real case: 262k context, 75%. One compaction at ~196k, then 6 steered messages in the same turn, no second compaction, and finally
Input length (267765) exceeds model's maximum context length (262144).Cause:
resume-after-compact!sets:auto-compacted? trueon thechat-ctx, and every later tool-call round of the turn reuses it. So the threshold check and the context-overflow fallback stay blocked for the whole turn. The flag comes from #391 (stop a compact → overflow → compact loop). That goal is right, but it only needs to cover the request right after a compaction.Changes
:post-compact-guard*atom. It is released on the first usage update that shows the compacted context under the threshold. After that, the turn can compact again. If the compacted context is still too big, the guard stays on, so the ECA becomes unresponsive when tool output causes LLM context overflow #391 protection holds.autoCompactMaxPerTurn(default 3, global or per agent). Each compaction sends the whole context to the LLM, so a turn that keeps refilling it (e.g. re-reading a huge file) must not compact without end. When the limit is reached, the turn ends with the normal overflow error.autoCompactPercentage: 85in the default config docs (the default is 75).Alternatives
:compacting?: it would need clearing at every turn end, including errors and stops. Inchat-ctxit belongs to the turn by design.Tests
auto-compact-again-later-in-same-turn-testandcontext-overflow-later-in-same-turn-auto-compacts-test: a second compaction in the same turn (both fail onmaster), and no loop when the compacted context is still too big.auto-compact-limit-per-turn-test: stops at the limit, includingautoCompactMaxPerTurn 1.context-overflow-auto-compact-guard-testnow goes through the realresume-after-compact!.A/B with the real server against a fake LLM:
masteroverflows after one compaction. This PR compacts twice and finishes the task, and a longer task stops at 3 compactions.🤖 Generated with Claude Code