Skip to content

fix(telegram): progress draft previews expose noisy HTML/code formattingย #95002

Description

@snowzlmbot

Summary

Telegram progress draft previews currently format tool-progress rows as Telegram HTML/code spans, e.g. <b>๐Ÿ› ๏ธ Exec</b> <code>command false</code> <i>exit 2</i>. In practice this makes progress drafts hard to read in Telegram, and any fallback/sanitized view exposes implementation markup (<b>, <code>, <br>) instead of a natural progress line.

The issue is visible in source-level tests today: Telegram progress draft expectations assert HTML/code formatting for tool rows rather than a plain readable draft.

Reproduction

From a local OpenClaw checkout:

node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-telegram.config.ts telegram/src/bot-message-dispatch.test.ts -t "Telegram progress"

Relevant existing assertions in extensions/telegram/src/bot-message-dispatch.test.ts currently expect payloads like:

telegramHtmlPreview("<b>Shelling</b><br><b>๐Ÿ› ๏ธ Exec</b> <code>command false</code> <i>exit 2</i>")
telegramHtmlPreview("<b>Shelling</b><br><b>๐Ÿ”Ž Web Search</b> <code>docs lookup</code><br><b>Update</b> <code>tests passed</code>")

The rendering path is:

  • src/channels/streaming.ts builds structured ChannelProgressDraftLine objects.
  • extensions/telegram/src/bot-message-dispatch.ts passes formatTelegramProgressLine into the progress compositor.
  • renderTelegramProgressDraftPreview() then maps lines through renderTelegramProgressLine().
  • renderTelegramProgressLine() emits <b>... + <code>... + <i>... fragments and joins rows with <br>.

Actual behavior

Telegram progress drafts use HTML/code-span style rows for ordinary progress lines:

<b>Shelling</b><br><b>๐Ÿ› ๏ธ Exec</b> <code>command false</code> <i>exit 2</i>

When the payload is shown through a fallback/sanitized path, the user sees markup instead of readable status text. Even when Telegram parses the HTML successfully, command details are rendered as code spans, which is noisy for transient progress messages.

Expected behavior

Progress drafts should be readable as plain status text and should not depend on HTML/code wrappers for ordinary tool rows. For example:

Shelling

๐Ÿ› ๏ธ exit 2; command false

and:

Shelling

๐Ÿ”Ž Web Search: docs lookup
โ€ข tests passed

Rich rendering can still be layered on top when available, but the baseline Telegram draft should remain readable without exposing HTML tags or backtick/code styling.

Impact

  • Telegram users get noisy progress drafts during tool-heavy turns.
  • Fallback/sanitized views can expose internal markup (<b>, <code>, <br>) instead of useful status.
  • The Web UI and Telegram diverge: Web progress appears like structured status, while Telegram can look like raw transport markup.

Suggested fix direction

  • Keep TelegramDraftPreview.text as the canonical plain-readable progress draft.
  • Do not wrap ordinary progress rows in Markdown backticks or Telegram <code> tags.
  • For non-rich Telegram draft delivery, send plain text instead of HTML parse mode.
  • If rich messages are enabled, build rich markup from the same plain line model without making the plain fallback ugly.

Verification target

A local patch should update extensions/telegram/src/bot-message-dispatch.test.ts so the Telegram progress cases assert plain readable preview payloads, then pass:

node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-telegram.config.ts telegram/src/bot-message-dispatch.test.ts -t "Telegram progress"

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: ๐Ÿฆž diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions