hermes - ✅(Solved) Fix [Bug]: send_message text/media/files are delivered to general topic instead of current thread; voice routing works correctly [1 pull requests, 1 comments, 2 participants]

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…
GitHub stats
NousResearch/hermes-agent#20104Fetched 2026-05-06 06:38:45
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #20110: fix(send_message): resolve thread_id from session context for text/media/file sends

Description (problem / solution / changelog)

Problem

When send_message is called with just a platform name (e.g. telegram), thread_id was left as None, causing text/media/file messages to be delivered to the general topic instead of the originating thread. Voice messages were unaffected because they use the gateway adapter path (send_voice()) which already carries the thread context.

Fix

When no thread_id is present in the target string, fall back to HERMES_SESSION_THREAD_ID from the session context — the same mechanism already used by cronjob_tools.py for auto-delivery.

Fixes #20104

Changed files

  • tools/send_message_tool.py (modified, +13/-0)

Code Example

Debug report uploaded:
  Report       https://paste.rs/ucAMt
  agent.log    https://paste.rs/MaZj6
  gateway.log  https://paste.rs/JKtwO

---
RAW_BUFFERClick to expand / collapse

Bug Description

When Hermes Agent sends messages through send_message, text messages, media attachments, and file attachments are delivered to the general/main topic instead of the originating conversation thread.

Voice messages work correctly: they are routed through the gateway adapter path using send_voice() and preserve the correct thread_id.

The issue appears to be in send_message_tool.py: _send_to_platform() is called with thread_id=None, and the current gateway session thread ID is never resolved or forwarded to the platform-specific sender.

As a result, non-voice outbound messages lose the original thread context.

Steps to Reproduce

Open Hermes Agent in a threaded/topic-based chat platform, for example Telegram forum topics. Start or continue a conversation inside a specific topic/thread. Ask the agent to send a normal text response using send_message. Ask the agent to send a media attachment or file attachment. Compare with sending a voice message from the agent.

Expected Behavior

All outbound message types should be sent back into the same topic/thread where the user message originated.

Specifically:

Text messages should be sent to the current conversation thread. Media attachments should be sent to the current conversation thread. File attachments should be sent to the current conversation thread. Voice messages should continue to be sent to the current conversation thread.

thread_id should be resolved from the current gateway session and passed consistently to platform-specific senders.

Actual Behavior

Text messages, media attachments, and file attachments are sent to the general/main topic instead of the originating thread.

Voice messages are routed correctly to the current thread.

Observed behavior:

send_message text → general topic send_message media → general topic send_message files → general topic voice messages → correct originating thread

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Telegram

Debug Report

Debug report uploaded:
  Report       https://paste.rs/ucAMt
  agent.log    https://paste.rs/MaZj6
  gateway.log  https://paste.rs/JKtwO

Operating System

almalinux10

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

In send_message_tool.py, _send_to_platform() is invoked without a valid thread context:

_send_to_platform(thread_id=None)

The thread_id from the current gateway session is not resolved or forwarded.

Voice messages do not hit this broken path because they bypass send_message_tool.py and use the gateway adapter’s send_voice() implementation, which correctly includes the thread context.

Proposed Fix (optional)

Resolve the current thread_id from the active gateway/session context inside _send_to_platform() or before calling it, then pass that thread_id to all platform-specific senders.

The same routing behavior used by send_voice() should be applied consistently to:

text sending media sending file attachment sending

This should ensure all outbound message types preserve the originating conversation thread.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be fixed by resolving the current thread_id from the active gateway/session context and passing it to all platform-specific senders in the _send_to_platform() function.

Guidance

  • Review the send_message_tool.py file and locate the _send_to_platform() function to understand how the thread_id is currently being handled.
  • Modify the _send_to_platform() function to resolve the current thread_id from the active gateway/session context before calling the platform-specific senders.
  • Apply the same routing behavior used by send_voice() to send_message() for text, media, and file attachments to ensure all outbound message types preserve the originating conversation thread.
  • Verify the fix by testing the sending of text messages, media attachments, and file attachments through the Hermes Agent and checking that they are delivered to the correct conversation thread.

Example

# Example of how to resolve the thread_id in _send_to_platform()
def _send_to_platform(thread_id=None):
    if thread_id is None:
        # Resolve the current thread_id from the active gateway/session context
        thread_id = get_current_thread_id_from_gateway_session()
    # Pass the resolved thread_id to the platform-specific senders
    platform_sender.send_message(thread_id, message)

Notes

The proposed fix assumes that the get_current_thread_id_from_gateway_session() function is available and correctly resolves the current thread_id from the active gateway/session context. If this function is not available, it will need to be implemented.

Recommendation

Apply the workaround by modifying the _send_to_platform() function to resolve the current thread_id from the active gateway/session context and pass it to all platform-specific senders. This should ensure that all outbound message types preserve the originating conversation thread.

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 - ✅(Solved) Fix [Bug]: send_message text/media/files are delivered to general topic instead of current thread; voice routing works correctly [1 pull requests, 1 comments, 2 participants]