Context limit handling and compression freeze issues
Cluster 11529 · agent. Data as of
Nothing open on GitHub. Fix merged in #55926 on 30 Jun 2026. Check it covers your case.
The short answer
- Known?
- Yes. 3 related items grouped here, 1 issue already closed.
- Fix event
- A fix was merged to main in PR #55926. Check it covers your case. No release data is tracked.
- Tracker
- The maintainers' tracker marks this
resolved, deciding PR #55926. That is separate from the fix event. - Still open
- Nothing open on GitHub.
These items relate to bugs and fixes around context length detection, exceeding context limits, and CLI freezes caused by compression behavior during LLM cooldown periods. Topics span both crash/overflow bugs and improvements to context-aware model resolution.
Open issues0
Open PRs0
Fixes on record
-
#55926 fix(compressor): skip compression during summary LLM cooldown to prevent CLI freeze
files:
agent/context_compressor.py,tests/run_agent/test_infinite_compaction_loop.pyShow the diff
-
agent/context_compressor.py@@ -1073,6 +1073,23 @@ def should_compress(self, prompt_tokens: int = None) -> bool: tokens = [redacted:secret-assignment] if prompt_tokens is not None else self.last_prompt_tokens if tokens < self.threshold_tokens: return False + # Do not trigger compression while the summary LLM is in cooldown. + # On a 429/transient failure _generate_summary() sets a cooldown and + # returns None; compress() then inserts a static fallback marker and + # returns. Tokens stay above threshold, so without this guard every + # subsequent turn re-fires _compress_context() — re-inserting the + # marker and re-entering the loop, making the CLI appear frozen until + # the cooldown expires (issue #11529). Manual /compress passes + # force=True, which clears this cooldown in compress() before running, + # so it still retries immediately. + _cooldown_remaining = self._summary_failure_cooldown_until - time.monotonic() + if _cooldown_remaining > 0: + if not self.quiet_mode: + logger.debug( + "Compression deferred — summary LLM in cooldown for %.0fs more", + _cooldown_remaining, + ) + return False # Anti-thrashing: back off if recent compressions were ineffective if self._ineffective_compression_count >= 2: if not self.quiet_mode: -
tests/run_agent/test_infinite_compaction_loop.py@@ -16,6 +16,8 @@ from unittest.mock import patch, MagicMock +import time + from agent.context_compressor import ContextCompressor, _CHARS_PER_TOKEN @@ -248,3 +250,36 @@ def test_below_threshold_allows(self): comp = _make_compressor(config_context_length=96000) comp.last_prompt_tokens = [redacted:secret-assignment] assert not comp.should_compress(10_000) + + +# --------------------------------------------------------------------------- +# Test: summary-LLM cooldown guard in should_compress (#11529) +# --------------------------------------------------------------------------- + +class TestCooldownGuard: + """should_compress() must skip compression while the summary LLM is in + cooldown, otherwise a 429/transient failure re-fires _compress_context() + every turn (inserting a fallback marker repeatedly) and freezes the CLI. + """ + + def test_active_cooldown_blocks(self): + """A future cooldown deadline -> should_compress returns False even + when tokens are over threshold.""" + comp = _make_compressor(config_context_length=96000) + comp.last_prompt_tokens = [redacted:secret-assignment] + comp._summary_failure_cooldown_until = time.monotonic() + 60 + assert not comp.should_compress(65_000) + + def test_expired_cooldown_allows(self): + """A past cooldown deadline -> compression resumes normally.""" + comp = _make_compressor(config_context_length=96000) + comp.last_prompt_tokens = [redacted:secret-assignment] + comp._summary_failure_cooldown_until = time.monotonic() - 1 + assert comp.should_compress(65_000) + + def test_no_cooldown_allows(self): + """The default (no cooldown set) does not block compression.""" + comp = _make_compressor(config_context_length=96000) + comp.last_prompt_tokens = [redacted:secret-assignment] + assert comp._summary_failure_cooldown_until == 0.0 + assert comp.should_compress(65_000)
-
1 PR closed without merging
From the close comments: merged via another change 1
-
#11559 fix(compressor): skip compression during summary LLM cooldown to prevent CLI freeze · merged via another change →
812236b,#55926
Closed issues · 1
- Closed#11529[Bug]: Context bursting in long context session
How this cluster was grouped
-
Link evidence (
structural links throughout): every member is connected by structural evidence: shared changed files, or a closing/superseded reference. -
Pairwise link density
0.67: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36.1.00means every pair is linked.
Pick up a Lab task
Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.
Open the LabAt a glance
- Subsystem
- agent
- Merged PRs
- #55926
- Closed issues
- 1
- Attempts
- 1 PR closed without merging
- Fix link checked
- 30 Jun 2026