Skip to content

fix(gateway): Apply markdown-to-mrkdwn conversion in edit_message#5568

Closed
jarvisxyz wants to merge 1 commit into
NousResearch:mainfrom
jarvisxyz:2026-04-06.eizus.slack-edit-formatting
Closed

fix(gateway): Apply markdown-to-mrkdwn conversion in edit_message#5568
jarvisxyz wants to merge 1 commit into
NousResearch:mainfrom
jarvisxyz:2026-04-06.eizus.slack-edit-formatting

Conversation

@jarvisxyz

Copy link
Copy Markdown
Contributor

Summary

Fixes missing markdown → mrkdwn conversion in edit_message(), causing broken formatting and malformed URLs when editing messages.

Problem

The send() method in the Slack adapter correctly converts standard markdown to Slack's mrkdwn format using format_message(). However, edit_message() was sending raw content directly to chat_update, skipping this conversion.

Impact

  • Bold text: **text** rendered literally instead of text
  • Links with formatting: [link](https://...) in bold/context became <https://...|link>** with trailing ** included in the clickable URL → 404 errors
  • Headers/code blocks: Rendered with raw markdown syntax visible

This was discovered after PR #5558 links were unclickable due to trailing ** from bold syntax becoming part of the URL.

Solution

Added format_message(content) call in edit_message() before sending to chat_update, matching the behavior of send().

# Convert standard markdown → Slack mrkdwn
formatted = self.format_message(content)

await self._get_client(chat_id).chat_update(
    channel=chat_id,
    ts=message_id,
    text=formatted,  # Was: text=content
)

Changes

  • gateway/platforms/slack.py: Added format_message() call in edit_message()

Testing

All 69 Slack gateway tests pass. The existing test suite validates the format_message() function; this fix ensures edit_message() uses it consistently with send().

Backwards Compatibility

Fully backwards compatible — only fixes broken behavior. Edited messages will now render correctly instead of showing raw markdown.

@jarvisxyz jarvisxyz force-pushed the 2026-04-06.eizus.slack-edit-formatting branch from 14fe602 to 543270f Compare April 6, 2026 16:24
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
@teknium1

teknium1 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Merged via PR #5733. Your commit was cherry-picked with authorship preserved. Thanks @jarvisxyz!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants