Skip to content

fix(telegram): restore readable default text sends - #93279

Merged
steipete merged 5 commits into
openclaw:mainfrom
NianJiuZst:fix/93263-telegram-readable-default
Jun 16, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
NianJiuZst:fix/93263-telegram-readable-default

Conversation

@NianJiuZst

@NianJiuZst NianJiuZst commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #93263 by restoring readable Telegram text delivery as the default while keeping Bot API 10.1 rich messages available as an explicit account-level opt-in.

  • default sends, edits, native-command replies, and draft previews use standard sendMessage / editMessageText
  • channels.telegram.richMessages: true enables native rich messages, including block tables
  • account overrides and configured default-account selection are respected
  • the agent prompt advertises rich text only when the selected account enables it
  • rich chunks enforce Telegram's documented 32,768-character, 500-block, 50-media, 16-level nesting, and 20-column table limits
  • reply quotes, threads, buttons, link-preview behavior, media fallbacks, and outbound table-mode overrides remain intact
  • empty or structurally invalid rich rendering falls back to readable source text

Telegram specification

Telegram currently accepts sendRichMessage, but current Desktop, Web, Android, and third-party clients can render accepted messages as unsupported. The default therefore remains the broadly compatible standard text path; operators can enable native rich tables on compatible clients with:

{
  channels: {
    telegram: {
      richMessages: true,
    },
  },
}

Linked context

Closes #93263.

Related rich-message work: #92679, #93286, #92258.

Supersedes the group-only rollback in #93345 by fixing the default for DMs, groups, commands, edits, and previews while preserving an explicit rich-message mode.

Verification

Passed on exact local head:

  • node scripts/run-vitest.mjs extensions/telegram/src/config-schema.test.ts extensions/telegram/src/send.test.ts extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/format.test.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/bot-native-commands.test.ts extensions/telegram/src/telegram-outbound.test.ts extensions/telegram/src/outbound-adapter.test.ts extensions/telegram/src/bot-message-dispatch.test.ts extensions/telegram/src/bot.helpers.test.ts extensions/telegram/src/channel-actions.contract.test.ts extensions/telegram/src/channel.gateway.test.ts
    • 12 files, 533 tests passed
  • node --import tsx scripts/generate-bundled-channel-config-metadata.ts
  • git diff --check
  • fresh autoreview --mode local
    • no accepted/actionable findings

Isolated Linux proof:

  • Crabbox brisk-crab-c0e5: pnpm tsgo:extensions passed; the initial test-type graph found two mock tuple inference errors
  • Crabbox golden-crab-c5fe: pnpm tsgo:extensions:test passed after the focused test-only fix

Azure Testbox was attempted twice but did not provision a lease before the 10-minute coordinator timeout.

Real behavior proof

Readable Telegram DM proof

Behavior addressed: Telegram replies accepted by the Bot API rendered as unsupported across current clients; standard text is readable by default, while native rich messages are explicit opt-in.

Real environment tested: Contributor's local OpenClaw gateway on macOS with a real Telegram bot and direct-message chat; isolated Linux typecheck validation for the final maintainer patch.

Exact steps or command run after this patch: Restarted the gateway, sent Hello openclaw and 你好 in a real Telegram DM, then ran the exact local and isolated validation commands listed above.

Evidence after fix: The attached Telegram screenshot shows readable replies for both messages. Exact-head tests cover standard and rich send/edit/draft paths, native tables, list/table chunking, structural limits, account capability selection, quote fallback, and table-mode propagation.

Observed result after fix: Standard Telegram replies render as readable messages; the final extension production and test type graphs pass.

What was not tested: Exact-head live client proof for richMessages: true is requested separately because current Telegram clients may still show Bot API 10.1 rich messages as unsupported.

Proof limitations or environment constraints: Azure Testbox capacity was unavailable; isolated Linux validation used Crabbox local-container instead.

Risk

Highest risk is the split standard/rich delivery boundary. The default follows the previously shipped compatible text path, rich capability is account-scoped and opt-in, and all send/edit/draft/native-command surfaces share the selected account setting.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. size: XL labels Jun 15, 2026
@NianJiuZst
NianJiuZst marked this pull request as ready for review June 15, 2026 11:57
@clawsweeper

clawsweeper Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 4:55 PM ET / 20:55 UTC.

Summary
The branch changes Telegram default text delivery, bot reply sending, outbound chunking, and draft previews from rich raw Bot API calls back to sendMessage/editMessageText with HTML/plain fallback and updates Telegram tests.

PR surface: Source +175, Tests -155. Total +20 across 12 files.

Reproducibility: yes. at source/report level: current main still routes Telegram final text and draft previews through rich-message paths, and the linked issue has cross-client unsupported-message evidence. I did not run a live bad-version repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Telegram delivery defaults: 2 changed: text API path and chunk cap. Both defaults affect visible Telegram reply rendering and upgrade behavior, so maintainers need exact-head checks and real transport proof before merge.

Stored data model
Persistent data-model change detected: serialized state: extensions/telegram/src/draft-stream.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦪 silver shellfish
Patch quality: 🦪 silver shellfish
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix draft-stream.test.ts:78 and send.test.ts:2669 so check-test-types and lint pass on the exact merge head.
  • [P1] Add redacted live Telegram proof for draft preview send/edit rendering; screenshots or recordings are preferred when they show the behavior, and logs or terminal output also count.
  • Rerun the targeted Telegram tests plus the relevant extension typecheck/lint checks after the cleanup.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The attached screenshot is useful proof for final reply readability, but the PR also changes draft-preview send/edit behavior and the PR body says that live path was not captured; add redacted screenshot/video, terminal output, live logs, or linked artifacts and update the PR body to trigger re-review.

Mantis proof suggestion
Native Telegram proof would directly show whether both final replies and draft preview edits render as readable text after the rollback. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram desktop proof: verify default replies and draft preview edits render as readable text on this PR.

Risk before merge

  • [P1] Exact merge check-test-types and lint currently fail on touched Telegram tests, so the branch is not land-ready.
  • [P1] The screenshot proves readable final replies, but the live draft-preview send/edit path changed by this PR remains unproven.
  • [P1] Changing Telegram's default text API path and chunk cap affects upgraded users' visible formatting, chunking, and message delivery behavior.

Maintainer options:

  1. Finish exact-head rollback proof (recommended)
    Fix the type/lint failures and add redacted live Telegram proof that shows draft preview send/edit plus final replies rendering as readable text.
  2. Accept narrower emergency proof
    Maintainers may explicitly accept the final-reply screenshot as enough for an emergency rollback and rely on tests for draft preview behavior.
  3. Pause for rich-message policy
    If legacy rollback is not the desired default, pause this PR until rich-message default or gating policy has cross-client proof.

Next step before merge

  • [P1] Contributor/maintainer follow-up is needed because exact-head type/lint defects and missing live draft-preview proof cannot be fully handled by an automated repair lane.

Security
Cleared: The diff stays within Telegram transport code and tests and does not add dependencies, workflows, credentials, lockfiles, package metadata, or script execution surfaces.

Review findings

  • [P2] Type the sendMessage mock call before indexing — extensions/telegram/src/draft-stream.test.ts:78
  • [P3] Remove the unused firstParams local — extensions/telegram/src/send.test.ts:2669
Review details

Best possible solution:

Land a type/lint-clean Telegram text rollback that restores readable final replies and draft preview edits, preserves media/buttons/thread behavior, and includes live Telegram proof for both visible paths.

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

Yes at source/report level: current main still routes Telegram final text and draft previews through rich-message paths, and the linked issue has cross-client unsupported-message evidence. I did not run a live bad-version repro in this read-only review.

Is this the best way to solve the issue?

No as currently submitted: the rollback is the right owner-boundary direction for the outage, but exact-head type/lint failures and missing live draft-preview proof keep it from being the best merge-ready fix.

Full review comments:

  • [P2] Type the sendMessage mock call before indexing — extensions/telegram/src/draft-stream.test.ts:78
    The exact merge check-test-types job fails with TS2493 here because this mock call is inferred as a zero-length tuple, and lint also rejects the no-op String conversion. Type the mock call/helper before reading the text argument.
    Confidence: 0.95
  • [P3] Remove the unused firstParams local — extensions/telegram/src/send.test.ts:2669
    The exact merge lint jobs fail because this local is declared and never used after the test moved assertions to the last chunk. Delete it or assert the first params before merge.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P1: The PR targets a fresh beta regression that made Telegram-bound replies unreadable across tested clients.
  • merge-risk: 🚨 compatibility: The branch changes the default Telegram text delivery API path and text chunk cap, which can affect existing formatting and upgrade behavior.
  • merge-risk: 🚨 message-delivery: An incomplete Telegram transport rollback could keep replies unreadable, wrongly chunked, or otherwise not delivered as visible text.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The attached screenshot is useful proof for final reply readability, but the PR also changes draft-preview send/edit behavior and the PR body says that live path was not captured; add redacted screenshot/video, terminal output, live logs, or linked artifacts and update the PR body to trigger re-review.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The attached screenshot is useful proof for final reply readability, but the PR also changes draft-preview send/edit behavior and the PR body says that live path was not captured; add redacted screenshot/video, terminal output, live logs, or linked artifacts and update the PR body to trigger re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram reply and draft-preview rendering that can be demonstrated in a short Telegram Desktop proof.
Evidence reviewed

PR surface:

Source +175, Tests -155. Total +20 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 7 378 203 +175
Tests 5 345 500 -155
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 723 703 +20

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs run extensions/telegram/src/draft-stream.test.ts.
  • [P1] node scripts/run-vitest.mjs run extensions/telegram/src/send.test.ts.
  • [P1] node scripts/run-vitest.mjs run extensions/telegram/src/telegram-outbound.test.ts.
  • [P1] pnpm check:test-types.
  • [P1] pnpm lint:extensions:bundled.

What I checked:

Likely related people:

  • obviyus: Authored the merged rich Telegram send/edit/draft implementation and recent rich-message follow-up commits on the same files. (role: rich-message feature owner and recent area contributor; confidence: high; commits: 547cc0f10903, e8b142feb117, da92615816b6; files: extensions/telegram/src/send.ts, extensions/telegram/src/draft-stream.ts, extensions/telegram/src/bot/delivery.send.ts)
  • vincentkoc: Authored the recent rich-message typecheck repair in the same Telegram rich-message path shortly before this PR. (role: recent rich-message contributor; confidence: medium; commits: 42759a1b799b; files: extensions/telegram/src/rich-message.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 15, 2026
@NianJiuZst
NianJiuZst force-pushed the fix/93263-telegram-readable-default branch from ab2c0af to ce7615b Compare June 15, 2026 12:30
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 15, 2026
@NianJiuZst
NianJiuZst force-pushed the fix/93263-telegram-readable-default branch from ce7615b to abdb936 Compare June 15, 2026 15:00
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jun 15, 2026
@NianJiuZst
NianJiuZst force-pushed the fix/93263-telegram-readable-default branch from abdb936 to 366dd2e Compare June 15, 2026 20:42
@steipete steipete self-assigned this Jun 15, 2026
@steipete
steipete force-pushed the fix/93263-telegram-readable-default branch from 366dd2e to 26853c0 Compare June 15, 2026 23:36
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jun 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

@openclaw-mantis telegram desktop proof

Please verify exact head 26853c078053212cab513cf67e8cd8a6699e278e in a real Telegram Desktop DM:

  1. With channels.telegram.richMessages omitted, send a normal reply, a Markdown heading/table reply, and a streaming preview update. Confirm all render as readable standard messages.
  2. Set channels.telegram.richMessages: true, restart, and send a native table reply plus a streaming preview update. Capture the Bot API result and the client rendering, including an unsupported-message card if the current client still cannot render Bot API 10.1 rich messages.

Please attach screenshots/artifact URLs and the exact tested head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram docs Improvements or additions to documentation mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram clients show "not supported" for every reply on 2026.6.8-beta.1

2 participants