Skip to content

fix(feishu): use interactive card messages for Markdown rendering#31804

Open
qiushile wants to merge 1 commit into
NousResearch:mainfrom
qiushile:feat/feishu-interactive-markdown
Open

fix(feishu): use interactive card messages for Markdown rendering#31804
qiushile wants to merge 1 commit into
NousResearch:mainfrom
qiushile:feat/feishu-interactive-markdown

Conversation

@qiushile

Copy link
Copy Markdown

Problem

Feishu (Lark) post message type does not support the md (Markdown) tag. When Hermes sends Markdown-formatted messages as post type, formatting like bold, italic, lists, and code blocks renders as plain text — users see raw Markdown syntax instead of formatted output.

Solution

Switch to Feishu interactive (card) message type, which has a proper markdown element ({"tag": "markdown"}) that correctly renders all Markdown formatting.

Changes

  • _build_markdown_card_payload() — New function that builds a minimal interactive card structure wrapping Markdown content in a proper markdown element
  • _should_fallback_from_interactive() — New fallback handler for card send failures (error codes 99992402/03/04, field validation errors) with graceful degradation to plain text
  • _resolve_message_type_and_payload() — Return msg_type="interactive" instead of "post" for Markdown content
  • _build_media_post_payload() — Adapt media caption payloads to use the card format
  • _build_post_payload() — Delegate to _build_markdown_card_payload()
  • All send/update paths updated from "post""interactive" with expanded error detection

Testing

Before: Markdown messages rendered as raw text with **bold**, - lists, etc. visible.
After: Messages render with proper formatting through Feishu card markdown element.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter labels May 25, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Part of the saturated Feishu markdown rendering cluster (consolidation issue #27469). Related to canonical PR #12114 and competing PRs #29630, #31038, #23494, #26797. This PR is broader than the table-only PRs — it converts ALL markdown rendering from post to interactive card type.

Feishu's 'post' message type does not support the 'md' tag, causing
Markdown formatting (bold, lists, code blocks) to render as plain text.

Switch to 'interactive' (card) message type which has a proper markdown
element that renders formatting correctly. Add _build_markdown_card_payload()
to construct minimal card structures with markdown elements.

Add _should_fallback_from_interactive() to handle card send failures
(error codes 99992402/03/04, field validation errors) with graceful
fallback to plain text messages.

Adapt media caption and post payload builders to use the card format.
@qiushile qiushile force-pushed the feat/feishu-interactive-markdown branch from 7c83a5f to 829bf99 Compare June 3, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants