# NousResearch/hermes-agent · Context limit handling and compression freeze issues

## Open now

- 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.

## TL;DR

- 3 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 1 PR(s) closed without merging.
- A fix was merged to main in PR #55926. Verify it addresses your case.
- **Recommended:** read PR #55926 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-55926`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.67`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #11529: \[Bug\]: Context bursting in long context session

## Prior & competing PRs

- **#55926: fix(compressor): skip compression during summary LLM cooldown to prevent CLI freeze**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/context_compressor.py`, `tests/run_agent/test_infinite_compaction_loop.py`
  - fix hunks:
  - `agent/context_compressor.py`

    ```diff
    @@ -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`

    ```diff
    @@ -16,6 +16,8 @@
     
     from unittest.mock import patch, MagicMock
     
    +import time
    +
     from agent.context_compressor import ContextCompressor, _CHARS_PER_TOKEN
     
     
    ```

    ```diff
    @@ -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)
    ```
- **#11559: fix(compressor): skip compression during summary LLM cooldown to prevent CLI freeze**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `812236bff`, `#55926`

## Fix status

- Merged to main in PR #55926 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-06-30`.
- Subsystem: `agent`
