Skip to content

fix(telegram): keep quoted context + avoid QUOTE_TEXT_INVALID#12156

Merged
obviyus merged 5 commits intoopenclaw:mainfrom
rybnikov:fix/telegram-quote-context-and-safe-reply
Feb 9, 2026
Merged

fix(telegram): keep quoted context + avoid QUOTE_TEXT_INVALID#12156
obviyus merged 5 commits intoopenclaw:mainfrom
rybnikov:fix/telegram-quote-context-and-safe-reply

Conversation

@rybnikov
Copy link
Contributor

@rybnikov rybnikov commented Feb 8, 2026

Summary

  • parse quoted context from external_reply in addition to reply_to_message
  • read quote text from message.quote, reply_to_message.quote, and external_reply.quote
  • keep reply_to_message_id threading for outbound Telegram sends and stop emitting reply_parameters.quote to avoid Bot API QUOTE_TEXT_INVALID

Why

Telegram partial-quote replies can come through external_reply, which previously dropped quoted text from model context. Also, sending quoted replies via reply_parameters.quote is fragile and can fail whole deliveries with 400 QUOTE_TEXT_INVALID.

Tests

  • updated delivery test to assert threaded replies use reply_to_message_id even when quote text exists
  • added bot test for partial quotes delivered via external_reply

Notes

I could not finish full test suite on this host in-session (dependency install was long), so this is smoke-validated in a live Telegram channel and covered by targeted test updates.

Greptile Overview

Greptile Summary

This PR improves Telegram quote/reply handling in two ways:

  • Inbound: describeReplyTarget now derives quoted context not only from message.quote, but also from reply_to_message.quote and external_reply.quote, and falls back to text/caption/media placeholders from the reply-like object (reply_to_message or external_reply).
  • Outbound: delivery no longer uses Telegram’s reply_parameters.quote (which can trigger QUOTE_TEXT_INVALID), and always threads replies via reply_to_message_id when a reply target exists.

Test updates cover partial quotes delivered via external_reply and assert that outbound threading sticks to reply_to_message_id even when quote text is present.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Changes are narrowly scoped to Telegram reply/quote parsing and outbound send parameters, with targeted tests updated/added for the new inbound external_reply path and the outbound behavior change (dropping reply_parameters). No runtime errors or broken call sites were found in the modified files.
  • No files require special attention

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@openclaw-barnacle openclaw-barnacle bot added the channel: telegram Channel integration: telegram label Feb 8, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a1e0d10e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@rybnikov
Copy link
Contributor Author

rybnikov commented Feb 8, 2026

Addressed review note about nested quote reuse.

Change in latest commit (8d9f46e):

  • removed fallback from
  • now quote text is sourced only from the current message () and

This avoids misclassifying ordinary replies as quoted when the replied-to message itself contained an older quote.

@rybnikov
Copy link
Contributor Author

rybnikov commented Feb 8, 2026

Addressed review note about nested quote reuse in latest commit 8d9f46e. Removed fallback to replied-message quote text; quote extraction now uses only current message quote and external_reply quote.

@rybnikov
Copy link
Contributor Author

rybnikov commented Feb 9, 2026

All checks are now green and I resolved the outstanding discussion thread.\n\nGiven this is a Telegram-related fix, a maintainer review from @joshp123 would be great if available.

@obviyus obviyus self-assigned this Feb 9, 2026
@obviyus obviyus merged commit 5827323 into openclaw:main Feb 9, 2026
23 checks passed
@obviyus
Copy link
Contributor

obviyus commented Feb 9, 2026

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: 5827323
  • Merge commit: 5827323

Thanks @rybnikov!

jiulingyun added a commit to jiulingyun/openclaw-cn that referenced this pull request Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments