hermes - 💡(How to fix) Fix bug: compression boundary drops platform kwarg, causing source=unknown on all subsequent LCM messages

Official PRs (…)
ON THIS PAGE

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…

When Hermes rotates session_id during context compression, the on_session_start call at run_agent.py:10817 does not pass platform to the context engine. Plugin engines (e.g. hermes-lcm) that track per-session source lineage via _session_platform get it reset to "", which normalizes to "unknown". All messages ingested after the compression boundary are attributed to source='unknown' instead of the actual platform (discord, telegram, cli, etc.).

Root Cause

run_agent.py:10817-10821 — the compression boundary notification omits platform:

self.context_compressor.on_session_start(
    self.session_id or "",
    boundary_reason="compression",
    old_session_id=_old_sid,
    # platform=self.platform or "cli",  ← MISSING
)

Compare with the initial session start at run_agent.py:2452-2458 which correctly passes it:

self.context_compressor.on_session_start(
    self.session_id,
    hermes_home=str(get_hermes_home()),
    platform=self.platform or "cli",
    model=self.model,
    context_length=getattr(self.context_compressor, "context_length", 0),
)

LCMEngine._apply_session_start_metadata (engine.py:1455) unconditionally overwrites _session_platform from kwargs:

self._session_platform = str(kwargs.get("platform") or "")

When platform is absent from kwargs, this resets to """unknown".

Fix Action

Fix

Primary (hermes-agent): Add platform=self.platform or "cli" to the compression boundary call at run_agent.py:10817.

Defensive (hermes-lcm): Preserve _session_platform when platform is absent from kwargs in _apply_session_start_metadata, so compression boundary calls without platform don't clobber the previously-set value.

Code Example

self.context_compressor.on_session_start(
    self.session_id or "",
    boundary_reason="compression",
    old_session_id=_old_sid,
    # platform=self.platform or "cli",MISSING
)

---

self.context_compressor.on_session_start(
    self.session_id,
    hermes_home=str(get_hermes_home()),
    platform=self.platform or "cli",
    model=self.model,
    context_length=getattr(self.context_compressor, "context_length", 0),
)

---

self._session_platform = str(kwargs.get("platform") or "")
RAW_BUFFERClick to expand / collapse

Description

When Hermes rotates session_id during context compression, the on_session_start call at run_agent.py:10817 does not pass platform to the context engine. Plugin engines (e.g. hermes-lcm) that track per-session source lineage via _session_platform get it reset to "", which normalizes to "unknown". All messages ingested after the compression boundary are attributed to source='unknown' instead of the actual platform (discord, telegram, cli, etc.).

Root Cause

run_agent.py:10817-10821 — the compression boundary notification omits platform:

self.context_compressor.on_session_start(
    self.session_id or "",
    boundary_reason="compression",
    old_session_id=_old_sid,
    # platform=self.platform or "cli",  ← MISSING
)

Compare with the initial session start at run_agent.py:2452-2458 which correctly passes it:

self.context_compressor.on_session_start(
    self.session_id,
    hermes_home=str(get_hermes_home()),
    platform=self.platform or "cli",
    model=self.model,
    context_length=getattr(self.context_compressor, "context_length", 0),
)

LCMEngine._apply_session_start_metadata (engine.py:1455) unconditionally overwrites _session_platform from kwargs:

self._session_platform = str(kwargs.get("platform") or "")

When platform is absent from kwargs, this resets to """unknown".

Impact

  • 806 messages across 4 sessions in a real deployment attributed to source='unknown' despite originating from Discord
  • lcm_status source lineage shows degraded attribution after every compression boundary
  • lcm_grep source filters miss these messages when filtering by platform

Reproduction

  1. Use context.engine: lcm with a Discord gateway session
  2. Let the conversation run until compression triggers (context pressure > 55%)
  3. Check lcm_status → source lineage shows unknown messages after the compression boundary

Fix

Primary (hermes-agent): Add platform=self.platform or "cli" to the compression boundary call at run_agent.py:10817.

Defensive (hermes-lcm): Preserve _session_platform when platform is absent from kwargs in _apply_session_start_metadata, so compression boundary calls without platform don't clobber the previously-set value.

Related

  • PR #16306 — added the boundary_reason="compression" signal (this is where platform was omitted)
  • PR #13370 — original broader refactor (closed, scope minimized to #16306)
  • hermes-lcm#68 — original compression threshold issue
  • hermes-lcm#76 — LCM-side compression boundary continuation fix

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix bug: compression boundary drops platform kwarg, causing source=unknown on all subsequent LCM messages