Skip to content

[Bug]: Context compaction cross-contamination — cron session summaries leak into unrelated live conversations #38788

@koishi70

Description

@koishi70

Description

After context compaction triggers, a compacted summary from a cron job session (unrelated, different platform) is injected into the current live messaging session, causing the agent to hallucinate and drift into an entirely different topic.

Reproduction

  1. Run a cron job that produces a session with compaction (e.g., a scheduled paper ingestion job)
  2. In a separate live conversation (different platform, different topic), allow the conversation to reach a point where compaction triggers
  3. Observe: the compacted summary injected contains content from the cron session, not just the current conversation

Observed Behavior

The agent, after compaction, begins referencing topics, terminology, and context from the unrelated cron session — producing fabricated data and completely off-topic responses. The user perceives this as a sudden, unexplained topic shift.

Expected Behavior

Compaction summaries should only contain context from the current session. Cross-session contamination should not occur. If compaction summaries are stored in a shared pool, they must be keyed/isolated by session ID.

Impact

  • Agent produces hallucinated, fabricated content derived from contaminated context
  • Complete loss of user trust when the agent suddenly switches topics mid-conversation
  • Particularly dangerous when cron sessions contain domain-specific content (finance, medicine, etc.) that pollutes unrelated conversations

Suspected Root Cause

Compaction summaries may be stored/retrieved without proper session-level isolation, allowing a cron session's compacted summary to be injected into a live messaging session's context window.

Related Issues

Environment

  • Hermes version: 0.15.x
  • Platforms: feishu (live) + cron (scheduled)
  • This bug is observed on a single Hermes instance running both gateway and cron scheduler

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