Skip to content

fix(compressor): reset _summary_failure_cooldown_until in on_session_reset() - #15548

Closed
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/compressor-reset-cooldown
Closed

fix(compressor): reset _summary_failure_cooldown_until in on_session_reset()#15548
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/compressor-reset-cooldown

Conversation

@nftpoetrist

Copy link
Copy Markdown
Contributor

What does this PR do?

ContextCompressor.on_session_reset() clears _previous_summary, _last_summary_error, and _ineffective_compression_count but leaves _summary_failure_cooldown_until intact. When a transient summary error (network timeout, rate limit) sets a 60 s cooldown — or 600 s when no auxiliary provider is configured — and the user immediately runs /reset or /new, the cooldown carries into the new session. If the new session reaches the compression threshold before the cooldown expires, _generate_summary() returns None early: middle turns are silently dropped without a summary and the agent continues with no indication that compaction was skipped.

One-line fix in on_session_reset(): set _summary_failure_cooldown_until = 0.0, matching the value assigned in __init__ and symmetric with the other per-session fields already cleared there. Scoped to session reset only — no behavior change for sessions that never hit an error.

Related Issue

Fixes #15547

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests
  • ♻️ Refactor
  • 🎯 New skill

Changes Made

  • agent/context_compressor.py: add self._summary_failure_cooldown_until = 0.0 to on_session_reset() (+1 line)

How to Test

  1. Trigger a context compression failure (disable auxiliary provider or simulate a network error in _generate_summary)
  2. Confirm _summary_failure_cooldown_until is set to a future timestamp
  3. Call on_session_reset()
  4. Assert _summary_failure_cooldown_until == 0.0
import time
from unittest.mock import patch

with patch("agent.context_compressor.get_model_context_length", return_value=100000):
    c = ContextCompressor(model="test/model", quiet_mode=True)

c._summary_failure_cooldown_until = time.monotonic() + 60
c.on_session_reset()
assert c._summary_failure_cooldown_until == 0.0

Checklist

Code

  • Contributing Guide okundu
  • Conventional Commits
  • Duplicate PR yok
  • Sadece bu fix
  • pytest çalıştırıldı
  • Platform: macOS

Documentation & Housekeeping

  • Docs güncellendi — N/A
  • cli-config.yaml.example — N/A
  • CONTRIBUTING.md/AGENTS.md — N/A
  • Cross-platform impact — N/A
  • Tool descriptions — N/A

…reset()

on_session_reset() cleared _previous_summary, _last_summary_error, and
_ineffective_compression_count but left _summary_failure_cooldown_until
intact. When a transient summary error sets a 60 s cooldown (or 600 s
for a missing-provider RuntimeError) and the user immediately runs /reset
or /new, the cooldown carries into the new session. If the new session
reaches the compression threshold before the cooldown expires,
_generate_summary() returns None early, middle turns are silently dropped
without a summary, and the agent continues with no indication that
compaction was skipped.

Fix: set _summary_failure_cooldown_until = 0.0 in on_session_reset(),
matching the value assigned in __init__ and symmetric with the other
per-session fields already cleared there.

Fixes NousResearch#15547
@teknium1

teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvaged via #19622 onto current main - your commit authorship was preserved. Thanks!

@teknium1 teknium1 closed this May 4, 2026
nftpoetrist added a commit to nftpoetrist/hermes-agent that referenced this pull request May 10, 2026
…session reset

_generate_summary() clears self.summary_model = "" when the configured aux
model fails (404, 503, timeout) and falls back to the main model for the
current compression call. This mutation is permanent for the lifetime of the
ContextCompressor instance. Because the same instance is reused across /reset
(run_agent.py calls on_session_reset() rather than recreating the compressor),
every subsequent session silently uses the main model for compression instead
of the configured aux model — even after a transient outage resolves.

on_session_reset() already resets _summary_failure_cooldown_until to 0 so
transient errors do not block a fresh session (fix NousResearch#15548). The same logic
applies to summary_model: a per-session failure should not permanently degrade
compression quality for subsequent sessions.

Fix: store the originally configured value in _configured_summary_model at
__init__ time, then restore summary_model from it in on_session_reset().
Also reset _summary_model_fallen_back to False so the one-shot fallback can
fire again if the aux model fails in the new session.

Fixes companion to NousResearch#15548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: _summary_failure_cooldown_until not reset on /new or /reset — compression skipped silently in new session

3 participants