Skip to content

fix(send_message): add thread-not-found retry for Telegram forum topic sends (#27012) - #28514

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-6063e704
May 19, 2026
Merged

fix(send_message): add thread-not-found retry for Telegram forum topic sends (#27012)#28514
teknium1 merged 4 commits into
mainfrom
hermes/hermes-6063e704

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #27098 (@kunci115). The standalone _send_telegram path in tools/send_message_tool.py had no retry fallback for deleted/stale forum topic threads. Now retries without message_thread_id if Telegram returns 'thread not found' — matching the gateway adapter's existing fallback.

Conflict resolution: combined with the just-merged #27865 (mention entities) — kept entities=_entities and switched thread_kwargstext_kwargs.

Authorship preserved across 3 commits via cherry-pick. 121/121 send_message tests passing (one pre-existing slack flake unrelated).

kunci115 and others added 4 commits May 18, 2026 22:31
…c sends

The standalone _send_telegram path in send_message_tool lacked the
thread-not-found fallback that the gateway adapter has. When a forum
topic thread_id was stale or deleted, the send would fail entirely
instead of retrying to the General topic.

Changes:
- Add _is_telegram_thread_not_found() helper matching gateway adapter
- Add thread-not-found retry in text send path
- Add thread-not-found retry in media send path (with f.seek(0))
- Separate text_kwargs from thread_kwargs to prevent
  disable_web_page_preview leaking into send_photo/send_video calls

Closes #27012
…um topics

Adds two tests to TestSendTelegramThreadIdMapping:
- test_thread_not_found_retries_without_message_thread_id
- test_thread_not_found_for_media_retries_without_message_thread_id

Refs #27012
Three tests covering the #27012 fix:
- test_is_thread_not_found_matches_expected_errors
- test_text_send_retries_without_thread_id_on_thread_not_found
- test_disable_web_page_preview_not_leaked_to_media_sends

116/116 existing tests still pass (no regressions).
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-6063e704 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8920 on HEAD, 8920 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4671 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter tool/terminal Terminal execution and process management labels May 19, 2026
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 tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants