Skip to content

fix(telegram): graceful fallback when send fails with 'Message thread not found' - #3218

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/telegram-dm-thread-id-v2
Closed

fix(telegram): graceful fallback when send fails with 'Message thread not found'#3218
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/telegram-dm-thread-id-v2

Conversation

@ygd58

@ygd58 ygd58 commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #3206

Problem

In non-forum Telegram DMs, reply chains set message_thread_id which gets passed to send_message(), causing "Message thread not found" errors, 3-retry loops, and 1000+ log errors per session.

Fix — Layer 2 (send-level fallback)

When send_message() fails with "Message thread not found", clear effective_thread_id and retry immediately without it. This is defense-in-depth on top of the source-level fix in #3207.

Note: upstream already handles the source-level fix (Layer 1) via _get_dm_topic_info(). This PR adds the send-level fallback (Layer 2) to handle any thread_id that slips through.

@ygd58

ygd58 commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

The test failure appears to be a pre-existing CI issue unrelated to this PR's changes to gateway/platforms/telegram.py. No telegram-specific tests exist in the test suite.

@teknium1

Copy link
Copy Markdown
Contributor

Already fixed on main via PR #3390 (commit 41d9d08), which applies the same send-layer 'thread not found' fallback. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram DM sends fail with 'Message thread not found' — spurious thread_id from reply chains

2 participants