hermes - ✅(Solved) Fix Gateway users not notified when compression summary generation fails and history is dropped [2 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16650Fetched 2026-04-28 06:51:54
View on GitHub
Comments
2
Participants
3
Timeline
11
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×2closed ×1

When auxiliary compression's summary LLM call fails (e.g. model 404, misconfigured auxiliary.compression.model), the compressor still drops the selected turns and inserts a static fallback placeholder. The dropped context is unrecoverable.

The only signal of this failure is a WARNING in agent.log. Gateway users (Telegram / Discord / Slack) see nothing in their chat. A user can come back to a session, find earlier context missing, and have no way to know why.

Error Message

  • Gateway auto-compress: surface a ⚠️ message via the platform adapter when summary generation fails, including dropped turn count, the underlying error, and a remediation hint (/reset or check auxiliary.compression).

Root Cause

When auxiliary compression's summary LLM call fails (e.g. model 404, misconfigured auxiliary.compression.model), the compressor still drops the selected turns and inserts a static fallback placeholder. The dropped context is unrecoverable.

The only signal of this failure is a WARNING in agent.log. Gateway users (Telegram / Discord / Slack) see nothing in their chat. A user can come back to a session, find earlier context missing, and have no way to know why.

Fix Action

Fixed

PR fix notes

PR #16333: fix(compression): notify gateway users when summary generation fails

Description (problem / solution / changelog)

Fixes #16650

Problem

When auxiliary compression's summary LLM call fails (e.g. model 404, misconfigured auxiliary.compression.model), the compressor still drops the selected turns and inserts a static fallback placeholder. The dropped context is unrecoverable.

Previously the only signal of this failure was a WARNING in agent.log. Gateway users (Telegram / Discord / Slack / etc.) had no visible signal that context was lost. A user could come back to a session, find earlier work missing, and have no idea why.

Why the existing _emit_warning path didn't catch it

The gateway hygiene path uses a temporary _hyg_agent constructed with quiet_mode=True, _print_fn = no-op, and no status_callback. So _emit_warning (which depends on status_callback) silently no-ops in this code path. The CLI / normal-agent path was already covered.

Reproducible scenario: auxiliary.compression.model set to a model the main provider doesn't serve (e.g. a Google model name routed to Anthropic). Every hygiene-triggered compaction logs Failed to generate context summary: ... 404 ..., the placeholder gets inserted, and the user sees nothing in their chat.

Fix

  1. agent/context_compressor.py — track per-compress state:

    • _last_summary_fallback_used: bool
    • _last_summary_dropped_count: int

    Cleared at the top of compress() and on on_session_reset(). Set when summary generation fails and the static fallback is inserted.

  2. gateway/run.py hygiene auto-compress — after _compress_context returns, inspect _hyg_agent.context_compressor. If _last_summary_fallback_used is True, send a visible ⚠️ warning to the user via the platform adapter, including the dropped count and the underlying error message.

  3. gateway/run.py /compress manual command — append the same warning to the manual /compress reply so users running it explicitly also see the failure.

Acceptance

  • ✅ Summary success → no user-visible warning (unchanged).
  • ✅ Summary failure on gateway hygiene → user receives a TG/Discord message with dropped count, underlying error, and remediation hint (/reset or check auxiliary.compression).
  • ✅ Summary failure on /compress → warning appended to the command reply.
  • ✅ CLI status_callback / _emit_warning path is untouched (no behavioural regression).
  • ✅ Two new tests in tests/agent/test_context_compressor.py verify tracking fields are set on failure and cleared on subsequent success.

Tests

tests/agent/test_context_compressor.py: 54 passed in 1.73s

New tests:

  • TestSummaryFailureTrackingForGatewayWarning::test_compress_records_fallback_and_dropped_count_on_summary_failure
  • TestSummaryFailureTrackingForGatewayWarning::test_compress_clears_fallback_flag_on_subsequent_success

Notes

The warning is only sent to the platform that triggered the hygiene compaction (source.platform/source.chat_id). It does not broadcast to other platforms or sessions. The gateway adapter .send call is wrapped in try/except so a warning-delivery failure can't break the compression result.

Changed files

  • agent/context_compressor.py (modified, +16/-2)
  • gateway/run.py (modified, +41/-0)
  • tests/agent/test_context_compressor.py (modified, +66/-0)
  • tests/gateway/test_compress_command.py (modified, +58/-0)
  • tests/gateway/test_session_hygiene.py (modified, +116/-0)

PR #16771: fix(compression): notify gateway users when summary generation fails (salvage #16333)

Description (problem / solution / changelog)

Salvage of #16333 by @iamagenius00 onto current main (223 commits behind at submission). Contributor authorship preserved via cherry-pick + rebase merge.

Summary

Gateway users now see a visible ⚠️ warning when context compression's summary LLM call fails. Previously the compressor would drop the selected turns, insert a static fallback placeholder, and leave the user with silently-truncated context — only agent.log had the warning.

Why the existing warning path didn't catch it

_compress_context in run_agent.py already calls self._emit_warning(...) on summary failure, but _emit_warning surfaces via _vprint (silenced by _print_fn = lambda: None) and status_callback (not set). Both the gateway hygiene auto-compress path and the /compress command build temporary AIAgent instances with quiet_mode=True, no-op _print_fn, and no status_callback — so the warning never reached the user.

Changes

  • agent/context_compressor.py — track _last_summary_fallback_used + _last_summary_dropped_count per compress call. Cleared at the top of compress() and on on_session_reset(). Set when summary generation returns None and the static fallback is inserted.
  • gateway/run.py hygiene auto-compress — after _compress_context returns, inspect the compressor flags and send a visible ⚠️ message to the originating chat (with thread_id metadata preserved).
  • gateway/run.py /compress command — append the same warning to the manual command reply.
  • Tests: 2 new compressor tests + 1 gateway hygiene test + 1 /compress test.

Acceptance

  • Summary success → no user-visible warning (unchanged).
  • Summary failure on gateway hygiene → user receives TG/Discord message with dropped count, underlying error, and remediation hint.
  • Summary failure on /compress → warning appended to the command reply.
  • CLI status_callback / _emit_warning path untouched (no behavioural regression).
  • Warning delivery is try/except-wrapped so a send failure can't break the compression result.

Validation

scripts/run_tests.sh tests/agent/test_context_compressor.py tests/gateway/test_session_hygiene.py tests/gateway/test_compress_command.py
81 passed in 1.75s

Closes #16333. Fixes #16650.

Changed files

  • agent/context_compressor.py (modified, +16/-2)
  • gateway/run.py (modified, +41/-0)
  • tests/agent/test_context_compressor.py (modified, +66/-0)
  • tests/gateway/test_compress_command.py (modified, +58/-0)
  • tests/gateway/test_session_hygiene.py (modified, +116/-0)
RAW_BUFFERClick to expand / collapse

Summary

When auxiliary compression's summary LLM call fails (e.g. model 404, misconfigured auxiliary.compression.model), the compressor still drops the selected turns and inserts a static fallback placeholder. The dropped context is unrecoverable.

The only signal of this failure is a WARNING in agent.log. Gateway users (Telegram / Discord / Slack) see nothing in their chat. A user can come back to a session, find earlier context missing, and have no way to know why.

Reproduction

  1. Set auxiliary.compression.model to a model the main provider doesn't serve (e.g. a Google model name when the main provider is Anthropic; or provider: auto routing a google/... model to Anthropic).
  2. Run a session long enough to trigger hygiene auto-compress (or run /compress manually).
  3. Expected: visible warning in TG/Discord/Slack that summary generation failed and N turns were dropped, with remediation hint.
  4. Actual: no chat-side signal. Only agent.log shows Failed to generate context summary: ... 404 ....

Why the existing warning path doesn't catch it

The gateway hygiene path constructs a temporary _hyg_agent with quiet_mode=True, a no-op _print_fn, and no status_callback. _emit_warning depends on status_callback, so it silently no-ops in this code path. The CLI / normal-agent path is already covered.

Expected behaviour

  • Gateway auto-compress: surface a ⚠️ message via the platform adapter when summary generation fails, including dropped turn count, the underlying error, and a remediation hint (/reset or check auxiliary.compression).
  • Manual /compress: append the same warning to the command reply.
  • CLI path: unchanged.
  • Warning delivery itself must not break the compression result.

Fix in flight

PR #16333 implements the above. Filing this issue separately so the user-impact problem is tracked independently of the implementation.

extent analysis

TL;DR

Implement a warning message via the platform adapter when summary generation fails during gateway auto-compress, including details on dropped turns and remediation hints.

Guidance

  • Review the auxiliary.compression.model configuration to ensure it matches the main provider's capabilities.
  • Verify that the agent.log contains a WARNING message indicating the failure to generate a context summary.
  • Consider implementing a temporary workaround to manually check the agent.log for warnings after running /compress or during long sessions.
  • Test the warning delivery mechanism to ensure it does not break the compression result.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The existing warning path does not catch the failure due to the quiet_mode=True and no-op _print_fn in the gateway hygiene path. The fix is being implemented in PR #16333.

Recommendation

Apply workaround: Implement a manual check for warnings in agent.log after running /compress or during long sessions, as the fix in PR #16333 is still in flight.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Gateway users not notified when compression summary generation fails and history is dropped [2 pull requests, 2 comments, 3 participants]