Skip to content

Resumed session can answer with stale compaction Active Task instead of latest user message #35344

@davidvv

Description

@davidvv

Bug Description

A resumed Hermes session can inherit a stale context-compaction handoff and start answering a completely unrelated current user message with instructions from an old ## Active Task.

In the failure mode I observed, a session lineage had previously been compacted and the preserved handoff block told the model that the current task was defined by ## Active Task. Later, when the user asked an unrelated question in the same resumed lineage, Hermes answered with content from that old task instead of the new message.

This was not caused by persistent memory, a skill, or user profile data. Inspecting the stored session history showed that the stale task came from an inherited compaction block inside the resumed session chain.

Why this seems distinct from generic "forgot context" bugs

This is not just loss of context after compression.

The problem is that an old task remains active enough in the resumed session context to hijack future replies. The model does not merely forget progress; it actively answers the wrong question because stale compaction content is still being treated as live intent.

Expected Behavior

After compaction and later resume/continuation:

  • the latest real user message should be the only active instruction
  • any prior ## Active Task inside a compaction summary should be treated as historical state only
  • stale handoff text from a prior lineage should never outrank a fresh user ask

Actual Behavior

A resumed session can answer a new, unrelated user message with instructions from an earlier task preserved in compaction context.

Repro Shape

A likely repro shape is:

  1. Start a session that works on task A
  2. Let the session compact, producing a handoff with an ## Active Task
  3. Continue/resume that lineage later
  4. Ask about unrelated task B
  5. Observe Hermes answer using instructions or status from task A

Investigation Notes

From local inspection of the stored session database and lineage:

  • the repeated wrong answer was present in stored assistant messages, so this was not a rendering glitch
  • the offending content was traceable to a prior compaction handoff in the same resumed lineage
  • persistent memory / user profile / skills did not contain the stale task text
  • the issue appears to be session-context contamination rather than memory contamination

I am intentionally omitting private message content, profile names, IDs, and filesystem details from this report, but I can help test a fix or provide a sanitized repro if useful.

Possibly Related Issues

This looks closely related to, but not obviously identical with:

The specific symptom here is: a stale compaction handoff in a resumed lineage can hijack later unrelated replies even when the stale task is not in memory/skills.

Suggested Fix Directions

  • make the compaction handoff unambiguously historical, never active instruction
  • ensure resumed sessions privilege the latest real user message over inherited handoff text
  • add regression coverage for "old Active Task contaminates reply to unrelated new user message"
  • consider surfacing or resetting contaminated lineage on resume when the inherited handoff conflicts with the latest user turn

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