Skip to content

[Bug]: Context compression failure uses static placeholder instead of preserved message tail — context permanently lost #12131

@WwNeXst

Description

@WwNeXst

Bug Description
When a conversation triggers context compression and the summarisation call fails (HTTP 529/500/timeout, etc.), Hermes injects a static fallback text into the conversation instead of the genuinely preserved message tail. The model then completely loses the current task context and responds to stale topics from several rounds ago.

Specific symptoms

  • User is working on a task/topic
  • Conversation hits compression trigger; Hermes calls the LLM for summarisation
  • Summarisation call fails (observed: MiniMax HTTP 529)
  • Model receives static placeholder text ("Summary generation was unavailable. N conversation turns were removed...") instead of the actual preserved message tail
  • User asks model to continue the interrupted task
  • Model starts responding to content from several rounds ago, not the interrupted task
  • User must re-explain the task from scratch to recover

Contrast with OpenClaw
OpenClaw using the same MiniMax API does NOT have this problem with the same 529 scenario. This suggests the issue is in Hermes fallback handling, not the API provider itself.

Root Cause (preliminary)
Two-part failure:

  1. Summarisation LLM call fails due to provider error (529/500/timeout)
  2. Fallback mechanism injects a static placeholder message ("context lost, continue from recent messages") instead of concatenating the genuinely preserved message tail — model cannot recover the interrupted task from this

Additional Observations

  • 529 errors appear to affect summarisation calls specifically (primary model calls may succeed while summarisation fails)
  • OpenClaw does NOT have this problem with the same MiniMax API key — suggesting Hermes fallback logic is the root cause
  • After compression failure, the model next response is consistently off-topic
  • User must re-explain the task from scratch to recover

Environment

  • Hermes agent with MiniMax-M2.7 as primary model (provider: minimax-cn)
  • Context compression enabled
  • Same MiniMax API key used by OpenClaw (OAuth auth) without this issue
  • Issue reproduced multiple times in today's sessions

Expected vs Actual Behavior

  • Expected: After context compression failure, model should continue naturally from the preserved message tail with full awareness of the in-progress task
  • Actual: Model loses the thread entirely and responds to stale topics

Proposed Fix

  1. Compare context compression fallback logic between OpenClaw and Hermes — how does OpenClaw preserve context on summarisation failure?
  2. Change fallback to concatenate actual preserved messages (the message tail that was explicitly kept) rather than static placeholder text
  3. Ensure the preserved message tail is always accessible even when summarisation LLM call fails

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/agentCore agent loop, run_agent.py, prompt buildertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions