Skip to content

fix(telegram): avoid rich messages in group chats - #93345

Closed
hxy91819 wants to merge 1 commit into
mainfrom
codex/telegram-bug
Closed

hxy91819 wants to merge 1 commit into
mainfrom
codex/telegram-bug

Conversation

@hxy91819

Copy link
Copy Markdown
Member

Summary

Fixes a Telegram group-chat regression where bot replies could render in Telegram Desktop/macOS as an unsupported-message card instead of normal text.

The regression came from the rich-message send path being used for Telegram group replies. Production evidence showed an inbound group conversation followed by an outbound sendRichMessage reply on a positive mirrored chat id, so the delivery path treated the reply like a direct chat even though the source conversation was a group.

This PR keeps rich text for direct chats, but treats group and mirrored-group replies as group sends:

  • route Telegram group text through Bot API sendMessage with HTML/plain fallback instead of sendRichMessage
  • propagate group/direct chat type through reply delivery instead of inferring solely from signed chat id
  • downgrade web_app inline buttons to normal URL buttons for group chats, including edit/reply-markup paths
  • chunk group replies using Telegram sendMessage's 4096-character limit while retaining rich-message chunking for direct chats

Verification

  • node scripts/run-vitest.mjs extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/send.test.ts
    • 2 files passed, 189 tests passed
  • pnpm tsgo:extensions
  • pnpm exec oxfmt --check --threads=1 extensions/telegram/src/bot/delivery.send.ts extensions/telegram/src/bot/delivery.replies.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/send.ts extensions/telegram/src/send.test.ts extensions/telegram/src/inline-keyboard.ts
  • git diff --check
  • Crabbox isolated proof:
    • provider: local-container
    • lease: cbx_57c16786cca4
    • command: corepack pnpm install --frozen-lockfile && node scripts/run-vitest.mjs extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/send.test.ts
    • result: 2 files passed, 189 tests passed, lease released
  • autoreview --mode local --thinking low --stream-engine-output
    • no actionable findings, patch correct

Real behavior proof

Behavior addressed: Telegram group replies no longer use sendRichMessage, which caused Telegram Desktop/macOS group chats to show an unsupported-message card.

Real environment tested: Local OpenClaw checkout plus Crabbox local-container Linux Node 24 isolated run. Production logs from openclaw2 were used for root-cause evidence.

Exact steps or command run after this patch: node scripts/run-vitest.mjs extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/send.test.ts; Crabbox local-container run with corepack pnpm install --frozen-lockfile && node scripts/run-vitest.mjs extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/send.test.ts.

Evidence after fix: Regression tests assert group and mirrored-group replies do not call sendRichMessage, do call sendMessage, convert web_app buttons to URL buttons, and split mirrored group replies at the Bot API send-message limit.

Observed result after fix: The focused Telegram send/delivery suite passed locally and in Crabbox with 189 tests passing.

What was not tested: A real Telegram Desktop visual E2E recording was not run in this environment; the available Telegram real-user Crabbox runner was not installed locally, and remote Testbox/AWS Crabbox paths were blocked by missing authentication/credentials.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: L maintainer Maintainer-authored PR labels Jun 15, 2026
@clawsweeper

clawsweeper Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 15, 2026, 6:41 PM ET / 22:41 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +202, Tests +275. Total +477 across 6 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Not assessed.
Failure reason: invalid structured output.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

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

Label changes

Label changes:

  • remove mantis: telegram-visible-proof: Current Telegram visible-proof status is not_needed.
  • remove P1: Current review triage priority is none.
  • remove rating: 🦪 silver shellfish: Current review failed before PR readiness was assessed, so no rating label should remain.
  • remove merge-risk: 🚨 message-delivery: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status no longer selects a status label.
Evidence reviewed

PR surface:

Source +202, Tests +275. Total +477 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 240 38 +202
Tests 2 276 1 +275
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 516 39 +477

What I checked:

  • failure reason: invalid structured output.
  • codex failure detail: Codex review failed for this PR with exit 0 and wrote invalid JSON or schema-invalid output to /home/runner/work/clawsweeper/clawsweeper/review-artifacts/shard-27/codex/93345.json: decision.rootCauseCluster.currentItemRelationship requires a canonical ref.
  • codex stderr: No stderr captured.
  • codex stdout: n "title": "Pause Until Live Access Is Available",\n "body": "Keep the PR open until a Telegram Desktop proof lane or equivalent live probe is available for the exact head.",\n "category": "pause_or_close",\n "recommended": false,\n "automergeInstruction": ""\n }\n ],\n "reviewMetrics": [\n {\n "label": "Telegram text transport paths",\n "value": "2 group text paths changed",\n "reason": "Both explicit sends and reply delivery now bypass rich messages for groups, so maintainers should verify group and direct-chat behavior before merge."\n }\n ],\n "labelJustifications": [\n {\n "label": "P1",\n "reason": "The PR targets a user-visible Telegram group-chat regression where normal bot replies can render as unsupported-message cards."\n },\n {\n "label": "merge-risk: 🚨 message-delivery",\n "reason": ".

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 15, 2026
@hxy91819
hxy91819 force-pushed the codex/telegram-bug branch from fae6aa5 to 482b071 Compare June 15, 2026 16:27
@hxy91819

Copy link
Copy Markdown
Member Author

@openclaw-mantis telegram desktop proof: verify group replies render as normal text with URL buttons while direct chats still render rich replies.

@hxy91819
hxy91819 force-pushed the codex/telegram-bug branch 2 times, most recently from c840375 to 549371e Compare June 15, 2026 22:42
@clawsweeper clawsweeper Bot removed the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Jun 15, 2026
@clawsweeper clawsweeper Bot removed 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. labels Jun 15, 2026
@hxy91819
hxy91819 force-pushed the codex/telegram-bug branch from 549371e to 35dedb8 Compare June 15, 2026 22:58
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jun 15, 2026
@hxy91819

Copy link
Copy Markdown
Member Author

Closing this PR after follow-up validation.

The original failure appears to be specific to Telegram Web's handling of the new Bot API 10.1 rich message surface in group chats. The same path is now working on updated Telegram Desktop for macOS and iOS, so this is not the right OpenClaw-side mitigation to land.

Keeping OpenClaw's rich-message behavior intact avoids disabling group rich text for clients where Telegram already renders it correctly. If Telegram Web remains a supported problem surface later, we should reopen with a narrower client-specific repro and proof rather than merging this broad group-chat fallback.

@hxy91819 hxy91819 closed this Jun 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

Superseded by #93279, landed in a375d6c.

The landed fix restores readable standard sends for DMs, groups, commands, edits, and streaming previews by default, while preserving native Bot API 10.1 rich messages behind channels.telegram.richMessages: true. Native Telegram Desktop proof and exact-head CI are recorded on #93279.

Thank you @hxy91819 for the group-chat investigation and mitigation work.

@shakkernerd
shakkernerd deleted the codex/telegram-bug branch October 19, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: telegram Channel integration: telegram maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants