Skip to content

fix: use _message_thread_id_for_send() in send_model_picker() for forum topics#12873

Closed
ztexydt-cqh wants to merge 1 commit into
NousResearch:mainfrom
ztexydt-cqh:ai-fix/12839
Closed

fix: use _message_thread_id_for_send() in send_model_picker() for forum topics#12873
ztexydt-cqh wants to merge 1 commit into
NousResearch:mainfrom
ztexydt-cqh:ai-fix/12839

Conversation

@ztexydt-cqh

Copy link
Copy Markdown
Contributor

Problem

In send_model_picker(), the code directly read metadata.get("thread_id") and passed int(thread_id) as message_thread_id to send_message(). This bypassed _message_thread_id_for_send(), which contains special handling for Telegram forum General topics (thread_id == "1" should be sent as None). As a result, sending the model picker in a forum General topic caused Telegram to return "Message thread not found".

Solution

Replace the raw metadata access with self._metadata_thread_id(metadata) and use self._message_thread_id_for_send(thread_id) when calling send_message(). This aligns send_model_picker() with all other send methods in the adapter, ensuring consistent forum topic handling.

Verification

  • Code review confirmed the two-line change matches the pattern already used in send(), send_exec_approval(), and send_typing().
  • No other callers of send_message() in the adapter bypass _message_thread_id_for_send().

Closes #12839.

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Thanks for catching this — the General-topic mapping (message_thread_id="1"None) you proposed for send_model_picker is now on main. It landed via #22410 (salvage of @leehack's #22053 telegram DM topic fix), which routed send_model_picker through _thread_kwargs_for_send — a strict superset of the _message_thread_id_for_send mapping you proposed. That helper now handles both forum General topics (your case) AND Hermes-created DM topic lanes that #22053 was originally about.

The parallel code path in the send_message tool's standalone _send_telegram helper had the same bug — fixed in #22423 just now (Fixes #22267).

Closing as superseded — thanks for the contribution and for keeping us focused on this bug class!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants