Skip to content

[Bug]: Context compression drops recent conversation记忆 and injects cross-session fragments #9413

@hy1195571214-byte

Description

@hy1195571214-byte

Bug Description

When context compression triggers (at 100% context), the compacted summary is missing the most recent conversation turns, and fragments from other unrelated sessions are injected into the current context. This causes the agent to lose track of who the user is and what they were just discussing.

Steps to Reproduce

  1. Have a multi-turn conversation that approaches context window limit (~100%)
  2. Context compression triggers automatically
  3. Observe: agent responds as if the conversation just started — "introduce yourself" again, no memory of recent exchanges
  4. In some cases, content from completely different sessions appears mixed into the context (e.g., search results from other topics, unrelated conversation fragments)

Actual Behavior

After compression, the agent:

  • Loses memory of the most recent N turns (where N varies)
  • May have cross-session contamination — content from session A appearing in session B
  • Appears to the user as if the conversation just started fresh

The compacted summary appears to be generated from a truncated window that excludes the most recent messages, and/or the merge step incorrectly pulls from wrong session data.

Expected Behavior

After compression:

  • All recent conversation context should be preserved in the summary
  • No cross-session contamination should occur
  • The agent should seamlessly continue the conversation without memory loss

Additional Context

  • Hermes version: v0.9.0 (2026.4.13)
  • Model: MiniMax-M2.7-highspeed
  • Platform: Feishu (websocket mode)
  • This has happened at least 2 times in the same day for the reporter

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/agentCore agent loop, run_agent.py, prompt builderplatform/feishuFeishu / Lark adapterprovider/minimaxMiniMax (Anthropic transport)type/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