hermes - 💡(How to fix) Fix Automatic context compaction can hide or drop just-completed assistant response [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

User-visible impact

The user loses the final deliverable right after a long run completes. This is especially damaging because compaction tends to happen after high-context, high-effort responses.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Bug description

A completed assistant response disappeared from Hermes Workspace immediately after automatic context compaction triggered. This was observed in a long, tool-heavy session. The Workspace UI may be involved, but the failure is tightly coupled to the agent/session compaction event, so this should be tracked on the Hermes Agent side as well.

Related Workspace issue: https://github.com/outsourc-e/hermes-workspace/issues/505

User-visible impact

The user loses the final deliverable right after a long run completes. This is especially damaging because compaction tends to happen after high-context, high-effort responses.

Observed flow

  1. User works in Hermes Workspace on localhost:3000.
  2. Assistant completes a long, tool-heavy response.
  3. Automatic context compaction triggers immediately after completion.
  4. The just-completed assistant response disappears from the visible conversation.
  5. User can still see/recover some information from another interface/session, but the Workspace thread lost the answer.

Expected behavior

Automatic compaction should preserve all finalized messages durably and should never remove or overwrite the most recent assistant response.

Backend/session invariants that should hold:

  • Final assistant message is persisted before compaction starts.
  • Compaction summary/reference message is appended or stored separately, not used as a replacement transcript snapshot.
  • Any session refetch after compaction includes the just-finalized assistant response.
  • Message IDs remain stable across compaction.
  • Stream finalization and compaction cannot race such that the final assistant message is dropped.

Actual behavior

The final assistant message disappeared immediately after auto-compaction.

Suspected areas

  • Stream completion vs. compaction race condition
  • Session DB/message persistence ordering
  • Compaction replacing recent transcript slice with a stale summary snapshot
  • Workspace receiving an incomplete post-compaction transcript from Hermes Agent APIs
  • Last assistant message not flushed/committed before compaction mutation

Suggested investigation

  1. Audit the order of operations when an agent run completes near the compaction threshold.
  2. Confirm message persistence happens before auto-compaction mutates session state.
  3. Add a regression test:
    • create long session near compaction threshold
    • stream/finalize assistant response
    • trigger auto-compaction
    • reload session/messages
    • assert the final assistant message still exists
  4. If the backend is already correct, document the expected client-side merge contract so Workspace can fix its reconciliation.

Environment

  • Host OS: macOS
  • Frontend: Hermes Workspace, localhost:3000
  • Backend: local Hermes Agent gateway/session stack
  • Session: long tool-heavy conversation with automatic compaction

Severity

High. Causes apparent loss of completed agent work.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Automatic compaction should preserve all finalized messages durably and should never remove or overwrite the most recent assistant response.

Backend/session invariants that should hold:

  • Final assistant message is persisted before compaction starts.
  • Compaction summary/reference message is appended or stored separately, not used as a replacement transcript snapshot.
  • Any session refetch after compaction includes the just-finalized assistant response.
  • Message IDs remain stable across compaction.
  • Stream finalization and compaction cannot race such that the final assistant message is dropped.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING