Skip to content

Telegram: keep DM topic replies in the originating thread#18586

Merged
sebslight merged 1 commit intoopenclaw:mainfrom
sebslight:fix/telegram-dm-topic-thread-replies
Feb 16, 2026
Merged

Telegram: keep DM topic replies in the originating thread#18586
sebslight merged 1 commit intoopenclaw:mainfrom
sebslight:fix/telegram-dm-topic-thread-replies

Conversation

@sebslight
Copy link
Member

@sebslight sebslight commented Feb 16, 2026

Summary

  • include message_thread_id for DM-scoped Telegram threads in buildTelegramThreadParams
  • keep existing forum behavior (thread_id=1 still omitted for forum sends)
  • update Telegram delivery and draft-stream tests to assert DM topic thread IDs are sent
  • update helper tests to cover DM topic inclusion + normalization guardrails

Regression coverage

  • src/telegram/bot/helpers.test.ts
  • src/telegram/bot/delivery.test.ts
  • src/telegram/draft-stream.test.ts

Validation

  • pnpm test -- src/telegram

Greptile Summary

This PR fixes Telegram DM topic thread routing by including message_thread_id in API calls for DM-scoped threads. Previously, buildTelegramThreadParams unconditionally dropped thread IDs for DM scope because Telegram private chats historically didn't support topics. Telegram now supports "Topics in Private Chats," so the helper is updated to include message_thread_id when the normalized thread ID is positive, while still omitting non-positive values (0, negative) as invalid.

  • buildTelegramThreadParams now returns { message_thread_id: normalized } for DM threads with positive IDs, instead of always returning undefined
  • DM thread ID 1 is correctly included (unlike forum scope where 1 is the General topic and must be skipped)
  • Tests across delivery, draft-stream, and helpers are updated to assert the new DM topic inclusion behavior
  • Edge case normalization (truncation, non-positive values) is preserved and tested

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk — it's a targeted behavioral fix with comprehensive test coverage.
  • The change is a small, well-scoped fix to a single function (buildTelegramThreadParams) with a clear behavioral rationale (Telegram now supports DM topics). The implementation correctly handles edge cases (non-positive IDs, truncation), maintains forum behavior (General topic id=1 still omitted), and all three test files are updated to cover the new behavior. No new dependencies, no architectural changes, and the diff is minimal.
  • No files require special attention.

Last reviewed commit: fd055a0

@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: XS maintainer Maintainer-authored PR labels Feb 16, 2026
@sebslight sebslight merged commit 0cff8bc into openclaw:main Feb 16, 2026
27 checks passed
sebslight added a commit that referenced this pull request Feb 16, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 5134983
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
archerhpagent pushed a commit to howardpark/openclaw that referenced this pull request Feb 18, 2026
archerhpagent pushed a commit to howardpark/openclaw that referenced this pull request Feb 18, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 5134983
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
jun-planfit pushed a commit to planfit/openclaw that referenced this pull request Feb 19, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 5134983
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight

(cherry picked from commit 0f6b39e)
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 5134983
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight

(cherry picked from commit 0f6b39e)
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 5134983
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant