openclaw - ✅(Solved) Fix [Bug]: Discord final replies attach Markdown image badges from assistant text [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72642Fetched 2026-04-28 06:33:41
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
referenced ×3cross-referenced ×2closed ×1

Discord final replies can upload incidental Markdown image badges from assistant text as unexpected attachments after the Markdown-image media extraction added for #66191.

Root Cause

This can also cause final reply delivery failures when an illustrative Markdown image example contains an invalid or unresolvable URL, because the URL is promoted to media and the delivery layer tries to fetch it.

Fix Action

Fixed

PR fix notes

PR #72649: [codex] Keep markdown image badges in Discord replies

Description (problem / solution / changelog)

Summary

  • add an opt-out for Markdown-image media extraction in the shared media parser
  • disable Markdown-image lifting for Discord outbound payload planning while keeping explicit MEDIA/mediaUrls handling intact
  • thread outbound surface context through Discord-capable send paths and add regression coverage

Fixes #72642.

Root Cause

#66471 made splitMediaFromOutput() lift Markdown image destinations into outbound media for final replies. That helped Telegram group-media replies, but the shared outbound normalization path also runs for Discord. As a result, incidental Markdown images such as README shields.io badges were promoted into mediaUrls and sent as Discord attachments.

Validation

  • pnpm vitest run src/media/parse.test.ts src/infra/outbound/payloads.test.ts
  • git diff --check
  • pnpm check:changed currently fails before reaching this change because local/core typecheck has existing dependency and typing errors such as missing typebox and model compat type mismatches.

Changed files

  • src/agents/command/delivery.ts (modified, +4/-1)
  • src/auto-reply/reply/reply-directives.ts (modified, +8/-2)
  • src/gateway/server-methods/send.ts (modified, +4/-1)
  • src/infra/outbound/message.ts (modified, +10/-7)
  • src/infra/outbound/payloads.test.ts (modified, +40/-0)
  • src/infra/outbound/payloads.ts (modified, +9/-2)
  • src/media/parse.test.ts (modified, +8/-0)
  • src/media/parse.ts (modified, +16/-2)

PR #72718: fix(media): gate markdown image extraction by channel

Description (problem / solution / changelog)

Problem

Discord final replies can contain incidental Markdown images from README snippets, package summaries, or badge examples. Since #66471, the shared media parser lifted remote Markdown image syntax into mediaUrls, so Discord delivered those incidental images as file attachments.

Example:

tech: ![Node.js](https://img.shields.io/badge/Node.js-339933?logo=node.js&logoColor=white)

That should remain visible reply text on Discord, not become an attachment.

Fix

Make Markdown-image media extraction opt-in:

  • splitMediaFromOutput() keeps Markdown images as text by default.
  • Outbound payload planning can enable extraction via channel context.
  • ChannelOutboundAdapter.extractMarkdownImages is the generic channel-owned capability.
  • Telegram opts in, preserving the behavior added for Telegram media replies.
  • Explicit MEDIA: directives remain unchanged, so agents and trusted tools can still intentionally attach any valid public media URL.

Tests

  • src/media/parse.test.ts
  • src/infra/outbound/payloads.test.ts
  • src/infra/outbound/deliver.test.ts
  • src/auto-reply/reply/agent-runner-payloads.test.ts
  • pnpm check:changed

Closes #72642.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/reference/rich-output-protocol.md (modified, +4/-0)
  • extensions/telegram/src/outbound-adapter.ts (modified, +1/-0)
  • extensions/telegram/src/outbound-base.ts (modified, +1/-0)
  • src/auto-reply/reply/agent-runner-payloads.test.ts (modified, +3/-0)
  • src/auto-reply/reply/agent-runner-payloads.ts (modified, +2/-0)
  • src/auto-reply/reply/reply-delivery.ts (modified, +3/-0)
  • src/auto-reply/reply/reply-directives.ts (modified, +10/-2)
  • src/channels/plugins/outbound.types.ts (modified, +2/-0)
  • src/infra/outbound/deliver.test.ts (modified, +48/-0)
  • src/infra/outbound/deliver.ts (modified, +20/-0)
  • src/infra/outbound/payloads.test.ts (modified, +38/-0)
  • src/infra/outbound/payloads.ts (modified, +8/-2)
  • src/media/parse.test.ts (modified, +97/-23)
  • src/media/parse.ts (modified, +13/-3)

Code Example

tech: ![Node.js](https://img.shields.io/badge/Node.js-339933?logo=node.js&logoColor=white)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Discord final replies can upload incidental Markdown image badges from assistant text as unexpected attachments after the Markdown-image media extraction added for #66191.

Steps to reproduce

  1. On OpenClaw 2026.4.24, pass assistant/final reply text containing a remote Markdown image badge through splitMediaFromOutput() / parseReplyDirectives().
  2. Minimal input:
tech: ![Node.js](https://img.shields.io/badge/Node.js-339933?logo=node.js&logoColor=white)
  1. Observed parser output includes text: "tech:" and mediaUrls: ["https://img.shields.io/badge/Node.js-339933?logo=node.js&logoColor=white"].
  2. Let the normalized final reply deliver through Discord. Discord treats the extracted mediaUrls value as a file attachment.

Expected behavior

Normal Discord final replies should not automatically turn arbitrary Markdown images in assistant prose into Discord file attachments. Incidental Markdown image syntax from fetched or summarized content should remain text unless the agent or a trusted tool explicitly requests media delivery.

Actual behavior

The shared final-reply normalization path extracts remote Markdown image URLs from assistant text into mediaUrls. Discord then sends those URLs as attachments. In observed Discord replies, README badge URLs produced unexpected attachments named after badge targets such as Node.js-339933 and Playwright-2EAD33.

This can also cause final reply delivery failures when an illustrative Markdown image example contains an invalid or unresolvable URL, because the URL is promoted to media and the delivery layer tries to fetch it.

OpenClaw version

2026.4.24

Operating system

macOS local gateway host

Install method

npm global openclaw package

Model

Not model-dependent; reproduced directly at the parser/final-reply normalization layer.

Provider / routing chain

Not provider-dependent; the issue occurs after assistant text generation in outbound final reply normalization before Discord delivery.

Additional provider/model setup details

The local agent was using the normal Discord final reply path. The same extraction reproduces by calling the parser directly, without relying on model behavior or custom workspace instructions.

Logs, screenshots, and evidence

Related upstream change: #66471, which added Markdown image extraction for #66191.

Relevant path observed locally:

  • parseReplyDirectives() calls splitMediaFromOutput() unconditionally.
  • createOutboundPayloadPlanEntry() uses parsed mediaUrls.
  • Discord outbound delivery sends those mediaUrls as attachments.

2026.4.25-beta.10 appears to improve invalid/internal/localhost URL filtering, but real HTTPS image URLs such as shields.io badges are still lifted into mediaUrls.

Impact and severity

Affected users/systems/channels: Discord channels using normal agent final replies. Severity: annoying, and it can block reply delivery in the invalid-URL case. Frequency: deterministic for remote Markdown image syntax that passes media validation. Consequence: unexpected Discord attachments and possible final reply delivery failure.

Additional information

Likely root cause: #66471 extended src/media/parse.ts so splitMediaFromOutput() recognizes Markdown image targets and lifts them into media segments. That behavior was added for Telegram group media delivery but now affects Discord final replies via the shared final-reply normalization path.

Suggested fix directions:

  1. Make Markdown-image lifting channel/context aware and disable it for normal Discord final replies.
  2. Restrict Markdown-image lifting to the Telegram path that needed #66191.
  3. Only lift Markdown images to outbound media when explicitly requested by a trusted tool/directive.
  4. Add tests covering Discord final replies with remote Markdown image badges.

extent analysis

TL;DR

The issue can be fixed by making Markdown-image lifting channel/context aware and disabling it for normal Discord final replies.

Guidance

  • Review the changes made in #66471 and assess how to restrict Markdown-image lifting to only the Telegram path or when explicitly requested.
  • Modify splitMediaFromOutput() to consider the destination channel (e.g., Discord) and only lift Markdown images into media segments when appropriate.
  • Implement tests for Discord final replies that include remote Markdown image badges to ensure the fix does not introduce regressions.
  • Consider adding a configuration option to control Markdown-image lifting behavior for different channels.

Example

No code example is provided due to the complexity of the issue and the need for a thorough review of the existing codebase.

Notes

The fix should be carefully tested to ensure it does not break existing functionality, especially for Telegram group media delivery. It's also important to consider the security implications of lifting Markdown images into media segments.

Recommendation

Apply a workaround by modifying the splitMediaFromOutput() function to disable Markdown-image lifting for Discord final replies, as this is the most direct way to address the issue without introducing potential regressions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Normal Discord final replies should not automatically turn arbitrary Markdown images in assistant prose into Discord file attachments. Incidental Markdown image syntax from fetched or summarized content should remain text unless the agent or a trusted tool explicitly requests media delivery.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Discord final replies attach Markdown image badges from assistant text [2 pull requests, 1 participants]