Skip to content

fix(telegram): draft stream preview not threaded when replyToMode is on (#17880)#17928

Merged
obviyus merged 7 commits intoopenclaw:mainfrom
yinghaosang:fix/telegram-draft-stream-reply-threading
Feb 16, 2026
Merged

fix(telegram): draft stream preview not threaded when replyToMode is on (#17880)#17928
obviyus merged 7 commits intoopenclaw:mainfrom
yinghaosang:fix/telegram-draft-stream-reply-threading

Conversation

@yinghaosang
Copy link
Copy Markdown
Contributor

@yinghaosang yinghaosang commented Feb 16, 2026

Summary

When streamMode: "partial" is active, Telegram reply threading doesn't work even with replyToMode: "all". The draft stream preview message gets sent without reply_to_message_id, and since the final reply is an edit to that same message, threading is permanently lost.

Closes #17880

lobster-biscuit

Root Cause

createTelegramDraftStream in draft-stream.ts only passes forum topic thread params (message_thread_id) to the initial sendMessage call. It never receives or forwards reply_to_message_id. The call site in bot-message-dispatch.ts doesn't pass it either.

Changes

  • Before: draft stream preview sent without reply_to_message_id — replies aren't threaded in partial/block stream mode
  • After: replyToMessageId threaded through createTelegramDraftStream and merged into the sendMessage params, gated on replyToMode !== "off"
  • replyParams construction follows the same flat ternary style as the existing threadParams pattern (no IIFE)

Tests

  • draft-stream.test.ts — 4 new tests:
    • reply-only: replyToMessageId passed without thread
    • reply+thread combo: both reply_to_message_id and message_thread_id present
    • no thread, no reply: params are undefined
    • general topic + reply: reply_to_message_id still set when thread resolves to general topic (id=1)
  • bot-message-dispatch.test.ts — 2 additions:
    • existing "streams drafts" test now asserts replyToMessageId: 456 is passed to createTelegramDraftStream
    • new test: replyToMode: "off"replyToMessageId is undefined
  • All existing Telegram tests pass
  • pnpm build && pnpm check pass

Greptile Summary

Fixes Telegram reply threading for draft stream preview messages. When streamMode: "partial" (or "block") is active, the initial preview message sent via createTelegramDraftStream was missing reply_to_message_id, causing threading to be permanently lost since the final reply is an edit of that same message.

  • Adds replyToMessageId parameter to createTelegramDraftStream and merges it into the sendMessage params alongside existing message_thread_id (forum topic) support
  • Computes draftReplyToMessageId in bot-message-dispatch.ts, gated on replyToMode !== "off", consistent with how delivery.ts handles reply threading
  • The replyParams construction correctly handles all edge cases: reply-only, reply+thread combo, neither, and general topic (id=1) where message_thread_id is suppressed but reply_to_message_id is preserved
  • Well-covered with 4 new tests in draft-stream.test.ts and 2 additions in bot-message-dispatch.test.ts

Confidence Score: 5/5

  • This PR is safe to merge — it's a targeted bug fix with thorough test coverage and no risk of regression.
  • The change is minimal and focused: threading replyToMessageId through to the draft stream's initial sendMessage call. The replyParams construction correctly handles all edge cases (reply-only, reply+thread, neither, general topic). The gating on replyToMode !== "off" is consistent with the existing delivery path. Six new tests cover the relevant scenarios. No behavioral changes to existing code paths.
  • No files require special attention.

Last reviewed commit: d0eaad8

@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: S labels Feb 16, 2026
@yinghaosang yinghaosang force-pushed the fix/telegram-draft-stream-reply-threading branch from d333aa0 to 8228a60 Compare February 16, 2026 09:35
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@obviyus obviyus self-assigned this Feb 16, 2026
@obviyus obviyus force-pushed the fix/telegram-draft-stream-reply-threading branch from d0eaad8 to cfd4181 Compare February 16, 2026 12:38
@obviyus obviyus merged commit 244ed9d into openclaw:main Feb 16, 2026
24 checks passed
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Feb 16, 2026

Merged via squash.

Thanks @yinghaosang!

Archeb pushed a commit to Archeb/openclaw that referenced this pull request Feb 16, 2026
…on (openclaw#17880) (openclaw#17928)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cfd4181
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: obviyus <[email protected]>
Reviewed-by: @obviyus
thinstripe pushed a commit to thinstripe/openclaw that referenced this pull request Feb 16, 2026
…on (openclaw#17880) (openclaw#17928)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cfd4181
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: obviyus <[email protected]>
Reviewed-by: @obviyus
archerhpagent pushed a commit to howardpark/openclaw that referenced this pull request Feb 18, 2026
…on (openclaw#17880) (openclaw#17928)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cfd4181
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: obviyus <[email protected]>
Reviewed-by: @obviyus
jun-planfit pushed a commit to planfit/openclaw that referenced this pull request Feb 19, 2026
…on (openclaw#17880) (openclaw#17928)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cfd4181
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: obviyus <[email protected]>
Reviewed-by: @obviyus
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…on (openclaw#17880) (openclaw#17928)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: cfd4181
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: obviyus <[email protected]>
Reviewed-by: @obviyus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram: auto reply threading broken — replyToId not mapped to reply_to_message_id

2 participants