hermes - 💡(How to fix) Fix [Feature]: Compression logic deadlock: Suggest adding a sliding window "Auto-Forget" mechanism when compression targets fail

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…

Error Message

Error Logstext ERROR [20260508_174930_721e652d] root: Context compression failed after 3 attempts.

RAW_BUFFERClick to expand / collapse

Problem or Use Case

Description:

When using the automatic context compression feature, the session may trigger an unexpected auto-reset. This happens when the protect_last_n constraint makes it impossible to reach the compression target, causing a loop that hits the maximum retry limit (3 attempts) and forces a session wipe.

My Configuration

Local LLM ctx-size: 65535 Hermes ctx-size: 65535 Compression Settings: threshold: 0.5, target: 0.2, protect_last_n: 20

The Problem

Based on the logs, the system attempted to compress ~37,299 tokens. Attempt 1: Reduced messages from 23 to 19. Total tokens dropped to ~34,080. Attempt 2 & 3: Since protect_last_n is 20, the logic could no longer remove messages. However, 34,080 tokens is still way above the target (65535 * 0.2 ≈ 13,107 tokens). Result: The system reached 3 failed attempts and triggered a full session reset.

Error Logstext

[2026/5/8 19:44] Hermes: 🗜️ Context too large (~37,299 tokens) — compressing (1/3)... [2026/5/8 19:44] Hermes: 🗜️ Compressed 23 → 19 messages, retrying... [2026/5/8 19:44] Hermes: 🗜️ Context too large (~34,080 tokens) — compressing (2/3)... [2026/5/8 19:45] Hermes: 🗜️ Context too large (~34,080 tokens) — compressing (3/3)... [2026/5/8 19:45] Hermes: ⚠️ Context length exceeded: max compression attempts (3) reached. 🔄 Session auto-reset — the conversation exceeded the maximum context size and could not be compressed further. ERROR [20260508_174930_721e652d] root: Context compression failed after 3 attempts.

Proposed Solution

implementing an "Auto-Forget" (Sliding Window) mechanism as a fallback:

1.Prioritize Continuity: Instead of a hard reset, the system should allow the oldest messages within the protect_last_n range to be dropped if they exceed the context limits. 2.Hybrid Approach: Maintain the current compression logic, but if it fails after X retries, switch to a sliding window that discards the oldest tokens to keep the session alive. 3.Dynamic Thresholds: Automatically adjust or ignore the target ratio if it conflicts with the protect_last_n requirement to prevent session termination.

Alternatives Considered

No response

Feature Type

Performance / reliability

Scope

None

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

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