Skip to content

fix(cron): support Telegram topic delivery via platform:chat_id:thread_id format - #2037

Closed
alexferrari88 wants to merge 1 commit into
NousResearch:mainfrom
alexferrari88:fix/cron-telegram-topic-delivery
Closed

alexferrari88 wants to merge 1 commit into
NousResearch:mainfrom
alexferrari88:fix/cron-telegram-topic-delivery

Conversation

@alexferrari88

@alexferrari88 alexferrari88 commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Problem

The current implementation prevents cron job to send Telegram messages to Topics inside Telegram groups.

Solution

Parse thread_id from explicit deliver target (e.g. telegram:-1003724596514:17) in _resolve_delivery_target() and forward it to _send_to_platform and mirror_to_session.

Previously _resolve_delivery_target() always set thread_id=None when parsing the platform:chat_id format, breaking cron job delivery to specific Telegram topics.

Changes

  • cron/scheduler.py: Parse :thread_id suffix when present in deliver target
  • tests/cron/test_scheduler.py: Added two tests for the new parsing behavior
  • tools/cronjob_tools.py: Updated CRONJOB_SCHEMA deliver description to document the platform:chat_id:thread_id format

Testing

tests/cron/test_scheduler.py: 27 passed
tests/tools/test_send_message_tool.py: 19 passed

@alexferrari88
alexferrari88 force-pushed the fix/cron-telegram-topic-delivery branch 2 times, most recently from 648a9c8 to 6207786 Compare March 20, 2026 04:31
@alexferrari88

Copy link
Copy Markdown
Contributor Author

the failing tests are not related to my PR

@alexferrari88

Copy link
Copy Markdown
Contributor Author

rebased and conflict resolved

…d_id format

Parse thread_id from explicit deliver target (e.g. telegram:-1003724596514:17)
and forward it to _send_to_platform and mirror_to_session.

Previously _resolve_delivery_target() always set thread_id=None when
parsing the platform:chat_id format, breaking cron job delivery to
specific Telegram topics.

Added tests:
- test_explicit_telegram_topic_target_with_thread_id
- test_explicit_telegram_chat_id_without_thread_id

Also updated CRONJOB_SCHEMA deliver description to document the
platform:chat_id:thread_id format.
@alexferrari88
alexferrari88 force-pushed the fix/cron-telegram-topic-delivery branch from 6464702 to 3a520ba Compare March 22, 2026 06:21
@alexferrari88

Copy link
Copy Markdown
Contributor Author

rebased onto the latest main on remote

@teknium1

Copy link
Copy Markdown
Collaborator

Merged via PR #2455. Your commit was cherry-picked onto current main with authorship preserved. Clean fix — the negative chat ID handling via split(':', 1) was nicely done. Thanks @alexferrari88!

@teknium1 teknium1 closed this Mar 22, 2026
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.

2 participants