Skip to content

[Bug]: Iterative context compaction summary keeps completed topics alive and overrides the current active topic #9631

@qwertysc

Description

@qwertysc

Bug Description

When Hermes performs automatic context compression multiple times within the same session lineage, the iterative compaction summary can keep old completed topics alive and allow them to overshadow the current active topic.

This is not just stale-summary leakage across /new sessions (#2635). It happens within the same long-running session chain after multiple compression splits.

In my case, an earlier completed topic ("Bybit Card cashback") was preserved so strongly in the compaction summary that, while I was actively discussing OpenViking, Hermes suddenly answered about Bybit again.

Actual Behavior

After automatic compression:

  • previously completed topics remain highly prominent in the injected handoff summary
  • the current active topic is not sufficiently prioritized
  • the assistant may answer the older completed topic instead of the current one

Observed behavior:

  • Earlier topic: Bybit Card / ChatGPT cashback
  • Current topic: OpenViking database/backend support
  • After compression, the assistant unexpectedly resumed talking about Bybit

Expected Behavior

After automatic compression:

  • the current active topic should dominate the summary
  • older completed topics should be aggressively demoted unless they remain directly relevant
  • the assistant should continue from the most recent user intent, not from a previously completed topic

Relevant Local Findings

Compression split occurred

agent.log

  • 2026-04-14 09:42:16,134 INFO gateway.run: Session split detected: 20260413_160032_e7cc1ea5 → 20260414_094155_13417e (compression)

Earlier topic in same lineage

  • Bybit question at 2026-04-14 03:18 UTC

Current topic before wrong answer

  • OpenViking question at 2026-04-14 09:35 UTC

Suspected Root Cause

The issue appears to come from the interaction of:

  1. Iterative summary update

    • agent/context_compressor.py
    • _previous_summary is reused and updated instead of rebuilt
    • old “Done / Critical Context / Key Decisions” content persists too strongly
  2. No automatic active-topic focus

    • focus_topic exists for manual /compress <focus>
    • but automatic compression does not appear to derive focus from the latest user turns
  3. No strong “topic switch” logic

    • the iterative update prompt says to preserve existing relevant info and remove only clearly obsolete info
    • but it does not strongly instruct the summarizer to demote older completed topics once the conversation has clearly moved on

Related Issues / PRs

Suggested Fix Direction

Possible improvements:

  1. Automatically derive a focus_topic from the most recent 1–3 user turns during auto compression
  2. Add a dedicated ## Current Active Topic section with higher priority than Done
  3. In iterative summary updates, aggressively demote older completed topics when a clear topic shift is detected
  4. Give stronger instructions that recent user intent outranks historical Done / Critical Context entries unless explicitly still relevant

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