Skip to content

Telegram /status rich reply fails with RICH_MESSAGE_EMAIL_INVALID when richMessages=true #96363

Closed

Description

@rollingshmily

Summary

Telegram /status slash command can fail to deliver its final reply when Telegram rich messages are enabled. The Gateway appears to execute the slash command, but the final Telegram send goes through sendRichMessage and Telegram rejects it with RICH_MESSAGE_EMAIL_INVALID.

This leaves the user with no /status response in Telegram.

Environment

  • OpenClaw: 2026.6.10 (aa69b12)
  • npm latest checked at report time: 2026.6.10
  • OS: Linux x64
  • Node: 22.22.2
  • Channel: Telegram direct chat
  • Config: channels.telegram.richMessages = true

Reproduction

  1. Configure Telegram channel with rich messages enabled:

    channels.telegram.richMessages = true
    
  2. In Telegram, send:

    /status
    
  3. Observe that Telegram receives no status reply.

Actual behavior

The slash command is handled, but final reply delivery fails in the Telegram rich-message path:

[telegram] sendRichMessage failed: Call to 'sendRichMessage' failed! (400: Bad Request: RICH_MESSAGE_EMAIL_INVALID)
[telegram] slash final reply failed: GrammyError: Call to 'sendRichMessage' failed! (400: Bad Request: RICH_MESSAGE_EMAIL_INVALID)

This reproduced multiple times in the same session when /status was sent.

Expected behavior

/status should return a status reply in Telegram.

If the rich-message payload is rejected by Telegram, the slash-command final reply should either:

  1. sanitize/fix the invalid rich email entity before sending, or
  2. fall back to a plain text Telegram message instead of dropping the reply.

Notes

I searched open and closed issues for RICH_MESSAGE_EMAIL_INVALID and did not find an exact existing report.

Related but not identical issues include:

This report is specifically for RICH_MESSAGE_EMAIL_INVALID on /status final reply delivery when richMessages=true.

Activity

  1. clawsweeper commented on Jun 24, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 24, 2026, 6:10 AM ET / 10:10 UTC.

    Summary
    Keep open: current main and the latest release still lack a Telegram rich-message email/entity guard or rich-send fallback for this /status failure, while #95900 is an open proof-positive candidate fix for the same behavior and should be reviewed or landed before closing this issue.

    Reproducibility: yes. at source level and from reporter logs: /status status text can include OAuth profile/email labels, current rich delivery sends them through sendRichMessage, and non-quote rich-send failures propagate without a plain fallback. I did not run an independent live Telegram reproduction in this read-only pass.

    Root-cause cluster
    Relationship: canonical
    Canonical: #96363
    Summary: This issue is the canonical open report for the Telegram /status rich-message RICH_MESSAGE_EMAIL_INVALID drop; one open PR is a direct candidate fix, while nearby Telegram rich-message issues cover sibling URL, newline, and quote behaviors.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    Do not queue a new repair while the exact open candidate PR is available; maintainers should review, land, or reject that PR first.

    Review details

    Best possible solution:

    Land #95900 or an equivalent central Telegram rich-message email guard with focused tests and live Telegram proof, then close this issue after the fix reaches main.

    Do we have a high-confidence way to reproduce the issue?

    Yes, at source level and from reporter logs: /status status text can include OAuth profile/email labels, current rich delivery sends them through sendRichMessage, and non-quote rich-send failures propagate without a plain fallback. I did not run an independent live Telegram reproduction in this read-only pass.

    Is this the best way to solve the issue?

    Yes: the best narrow fix is a shared Telegram rich-message builder guard for email-like tokens, as in the open candidate PR, because durable sends, drafts, and reply delivery all pass through that boundary. A broader plain-text fallback can be considered separately but is not required to keep this exact invalid email entity from dropping /status.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The exact live /status failure was not independently reproduced in this read-only review; confidence comes from the issue logs, current source path, and the proof-positive open candidate PR.
    • A generic rich-send plain-text fallback remains a broader policy choice; the exact email-entity failure has a narrower candidate fix in the shared rich-message builder.

    Codex review notes: model internal, reasoning high; reviewed against 8242923fe393.

    Label changes

    Label changes:

    • add P1: A current-release Telegram direct-chat /status command can complete internally but drop the final user-visible reply when rich messages are enabled.
    • add impact:message-loss: The reported failure loses the final Telegram slash-command response after Telegram rejects the rich payload.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.

    Label justifications:

    • P1: A current-release Telegram direct-chat /status command can complete internally but drop the final user-visible reply when rich messages are enabled.
    • impact:message-loss: The reported failure loses the final Telegram slash-command response after Telegram rejects the rich payload.
    Evidence reviewed

    What I checked:

    • Issue report and shipped version: The issue reports repeated sendRichMessage rejection with RICH_MESSAGE_EMAIL_INVALID on OpenClaw v2026.6.10 and no Telegram /status response.
    • Rich reply path throws non-quote sendRichMessage errors: With richMessages enabled, sendTelegramText builds one rich payload and calls sendRichMessage; only native quote errors are retried, so RICH_MESSAGE_EMAIL_INVALID propagates instead of falling back to sendMessage. (extensions/telegram/src/bot/delivery.send.ts:124, 8242923fe393)
    • Current rich builder has no email/entity guard: Current buildTelegramRichHtml emits skip_entity_detection only when the caller explicitly sets skipEntityDetection, so email-like status text can still be entity-detected by Telegram in rich payloads. (extensions/telegram/src/rich-message.ts:170, 8242923fe393)
    • Status output can include OAuth profile labels: buildStatusText passes selectedModelAuth and activeModelAuth into status rendering, and resolveModelAuthLabel formats OAuth auth as oauth (<label>); auth profile config explicitly allows an email shown in status/profile surfaces. (src/status/status-text.ts:646, 8242923fe393)
    • Latest release lacks the candidate guard: The v2026.6.10 tag still has buildTelegramRichMarkdown passing options through and buildTelegramRichHtml checking only options.skipEntityDetection === true; it does not contain the email-token skip from the open candidate PR. (extensions/telegram/src/rich-message.ts:162, aa69b12d0086)
    • Open candidate PR addresses exact behavior: fix(telegram): keep OAuth emails out of rich entity detection #95900 adds email-token detection in extensions/telegram/src/rich-message.ts, sets skip_entity_detection for rich sends/drafts/replies, includes focused tests, and has a ClawSweeper/Mantis proof-positive review trail, but it is still open and not a main/release implementation. (extensions/telegram/src/rich-message.ts:96, 86cf722a57f1)

    Likely related people:

    • vincentkoc: Current blame in the checkout points to Vincent Koc on the Telegram rich formatter/send/status lines, and merged Telegram rich-message history includes related line-break work by this handle. (role: recent area contributor; confidence: high; commits: 8242923fe393, b3f315461ba7; files: extensions/telegram/src/format.ts, extensions/telegram/src/rich-message.ts, extensions/telegram/src/bot/delivery.send.ts)
    • keshavbotagent: Authored fix(telegram): keep OAuth emails out of rich entity detection #95900, which directly targets provider-prefixed OAuth email text in Telegram rich messages with tests and live proof. (role: open candidate fix author; confidence: high; commits: 86cf722a57f1; files: extensions/telegram/src/rich-message.ts, extensions/telegram/src/send.test.ts, extensions/telegram/src/draft-stream.test.ts)
    • obviyus: Merged/authored several recent Telegram rich-message PRs, including rich-message text and rich HTML work that defined the affected sendRichMessage surface. (role: adjacent rich-message feature contributor; confidence: medium; commits: 45e36a241a79, da92615816b6, 68eb5031bde2; files: extensions/telegram/src/rich-message.ts, extensions/telegram/src/send.ts)
    • NianJiuZst: Authored the merged readable-default/richMessages opt-in work that shaped when Telegram uses rich versus plain delivery. (role: recent richMessages behavior contributor; confidence: medium; commits: a375d6c84963; files: extensions/telegram/src/send.ts, extensions/telegram/src/rich-message.ts, extensions/telegram/src/bot-message-dispatch.ts)
    • dankarization: Authored the merged fix for the related Telegram rich RICH_MESSAGE_URL_INVALID local-href failure, which is the nearest shipped sibling to this email-entity report. (role: adjacent validation-error fix author; confidence: medium; commits: 0922ee9955ae; files: extensions/telegram/src/format.ts, extensions/telegram/src/send.test.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    on Jun 24, 2026
  3. aaajiao commented on Jun 24, 2026

    @aaajiao
    Contributor

    Confirming an independent reproduction on stable 2026.6.10 (aa69b12) — identical failure:

    channels/telegram error: telegram sendRichMessage failed: Call to 'sendRichMessage' failed! (400: Bad Request: RICH_MESSAGE_EMAIL_INVALID)
    channels/telegram error: telegram slash final reply failed: GrammyError: Call to 'sendRichMessage' failed! (400: Bad Request: RICH_MESSAGE_EMAIL_INVALID)
    

    Environment (differs from the original report, so it's not arch/Node-specific):

    • Self-hosted Gateway in an OrbStack Ubuntu VM, arm64, Node 24.17.0
    • Telegram direct chat, channels.telegram.richMessages = true
    • OpenAI/Codex OAuth subscription auth path

    This matches the root cause in #95900 (fix(telegram): keep OAuth emails out of rich entity detection): the runtime text carries the OAuth profile label (openai:<email>), Markdown linkification turns it into an invalid mailto:openai:<email> rich entity, and Telegram rejects the whole rich payload. The OAuth-subscription setup makes this reliably reproducible, since effectively every reply carries that label.

    Inbound + agent execution are unaffected — only the rich send fails, so from the user's side the bot goes silent (message-loss). Setting channels.telegram.richMessages = false restores delivery immediately.

    +1 for landing #95900.

  4. obviyus commented on Jun 25, 2026

    @obviyus
    Collaborator

    Thanks for the clear report and the extra repro confirmation. This is fixed on main by #95900 / 2aa9d67, which keeps OAuth email-like labels out of Telegram rich entity detection so /status replies are delivered normally.

    Closing as fixed on main; users on 2026.6.10 will pick this up with the next release.

  5. added a commit that references this issue on Jun 29, 2026
    b28fcfe
  6. added a commit that references this issue on Jun 29, 2026
    c533139
  7. added 2 commits that reference this issue on Jul 1, 2026
    437ce0f
  8. added 2 commits that reference this issue on Jul 5, 2026
    9d500f1
    47ad9cc
  9. locked as resolved and limited conversation to collaborators on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions