Skip to content

[Bug]: send_model_picker bypasses _message_thread_id_for_send — "Message thread not found" in topic groups #12839

@wl-lgtm

Description

@wl-lgtm

Bug Description

In Telegram forum groups (topics enabled), /model falls back to text output instead of showing the interactive inline-keyboard picker.

Steps to Reproduce

  1. Open a Telegram forum group with topics enabled
  2. Send /model in any topic (including General)
  3. Observe: text list is returned instead of interactive picker

Expected Behavior

interactive picker shown

Actual Behavior

just text output of models

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Telegram

Debug Report

hermes debug share
⚠️  This will upload the following to a public paste service:
  • System info (OS, Python version, Hermes version, provider, which API keys
    are configured — NOT the actual keys)
  • Recent log lines (agent.log, errors.log, gateway.log — may contain
    conversation fragments and file paths)
  • Full agent.log and gateway.log (up to 512 KB each — likely contains
    conversation content, tool outputs, and file paths)

Pastes auto-delete after 6 hours.

Collecting debug report...
Uploading...

Debug report uploaded:
  Report     https://paste.rs/9XJn4
  agent.log  https://paste.rs/rHvmO

  (failed to upload: gateway.log: Failed to upload to any paste service:
  paste.rs: HTTP Error 503: Service Temporarily Unavailable
  dpaste.com: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1016)>)

⏱  Pastes will auto-delete in 6 hours.
To delete now:  hermes debug delete <url>

Share these links with the Hermes team for support.

Operating System

Mac OS 26.3.1

Python Version

Python 3.14.4

Hermes Version

0.10

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

send_model_picker() (line 1315 in gateway/platforms/telegram.py) passes message_thread_id directly:
message_thread_id=int(thread_id) if thread_id else None,
Every other send method in the adapter uses _message_thread_id_for_send(), which converts the General topic sentinel "1" to None. Without this conversion, Telegram receives message_thread_id=1 for the General topic and rejects it with "Message thread not found" — since there's no actual forum topic with ID 1.

The gateway error log confirms:
WARNING gateway.platforms.telegram: [Telegram] send_model_picker failed: Message thread not found

Proposed Fix (optional)

Two-line change in send_model_picker():

Line 1309: use existing helper instead of raw metadata access

thread_id = self._metadata_thread_id(metadata)

Line 1315: route through _message_thread_id_for_send like every other method

message_thread_id=self._message_thread_id_for_send(thread_id),

Are you willing to submit a PR for this?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/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