fix(telegram): extract canonical rich block text#100570
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 4:23 AM ET / 08:23 UTC. Summary PR surface: Source +21, Tests +118. Total +139 across 3 files. Reproducibility: yes. Current main's renderer omits the canonical fields this PR targets, so payloads whose only visible content is summary, label, block-level expression, or caption credit can still resolve to missing text or the unsupported placeholder; I did not rerun live Telegram in this read-only review. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the shared rich-message resolver update after the draft is marked ready and required checks/review pass, while keeping the broader linked Telegram UX issue open for the unrelated typing and rich-send failures. Do we have a high-confidence way to reproduce the issue? Yes. Current main's renderer omits the canonical fields this PR targets, so payloads whose only visible content is summary, label, block-level expression, or caption credit can still resolve to missing text or the unsupported placeholder; I did not rerun live Telegram in this read-only review. Is this the best way to solve the issue? Yes. The shared rich-message helper is the narrowest maintainable fix point because inbound body, reply-target, and cached context all consume it; separate parsers in each caller would create drift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0c38082c6db9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +21, Tests +118. Total +139 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
314c53b
into
openclaw:main
Refs #99471
What Problem This Solves
Telegram Bot API 10.1 rich-message reply/forward echoes can carry visible text only in canonical rich block fields. Current
mainalready extracts markdown, html, and basic rich block text, but it misses several visible fields that appear in real rich-message block payloads: detailssummary, list itemlabel, block-levelexpression, and caption objects with nestedtext/credit.When those fields are the only visible content in the echoed
rich_message, OpenClaw can still collapse the reply/forward context to[unsupported Telegram rich_message received], so the agent loses the message being replied to or forwarded.This PR only addresses the rich-message block extraction addendum from #99471. It does not close the broader issue and does not attempt to fix the typing breaker or empty rich payload send behavior tracked there.
What Changed
summaryfor details/collapsible blockslabelfor list itemsexpressionfor mathematical expression blockstextandcreditTotal+ boldQ1render asTotal Q1, not as separate lines.Evidence
mainrich-message block flattening does not read the canonicalsummary,label, block-levelexpression, or caption-objectcreditfields this PR targets.node scripts/run-vitest.mjs extensions/telegram/src/bot-message-context.body.test.ts extensions/telegram/src/bot/helpers.test.ts extensions/telegram/src/message-cache.test.ts— 3 files, 133 tests passedpnpm exec oxfmt --check --threads=1 extensions/telegram/src/bot/body-helpers.ts extensions/telegram/src/bot-message-context.body.test.ts extensions/telegram/src/bot/helpers.test.tsgit diff --checkReal Behavior Proof Status
Manual Telegram live proof captured on 2026-07-06 15:44 Asia/Shanghai using the PR candidate Gateway from commit
094dbd153e2a66077ce0dc28169e5f0acafc05ca.Proof flow:
channels.telegram.richMessages=true.<details><summary>OC_RICH_SUMMARY_100570</summary>...<ol><li>OC_RICH_LIST_100570</li></ol><tg-math-block>OC_RICH_EXPR_100570</tg-math-block><figcaption>OC_RICH_CAPTION_100570<cite>OC_RICH_CREDIT_100570</cite></figcaption>Result: the reply context preserved the targeted
summary, list label/body text, math expression, caption text, and caption credit tokens, and did not render[unsupported Telegram rich_message received]for the reply target.No chat id, token, screenshot, or private transcript is included here; only the synthetic canary tokens and the sanitized received text are recorded.