Skip to content

fix(gateway/feishu): migrate markdown rendering to CardKit 2.0 interactive cards - #23494

Open
hyhy111 wants to merge 1 commit into
NousResearch:mainfrom
hyhy111:fix-feishu-cardkit2-markdown
Open

fix(gateway/feishu): migrate markdown rendering to CardKit 2.0 interactive cards#23494
hyhy111 wants to merge 1 commit into
NousResearch:mainfrom
hyhy111:fix-feishu-cardkit2-markdown

Conversation

@hyhy111

@hyhy111 hyhy111 commented May 11, 2026

Copy link
Copy Markdown

Problem

Feishu recently stopped rendering markdown markup inside the legacy post message type's md tag. This caused all markdown content (tables, bold, code blocks, etc.) to be displayed as raw source text unless the user tapped to open a detail view.

Solution

Replace the post path with CardKit 2.0's interactive message type using the tag: "markdown" component, which natively supports standard GFM syntax and renders correctly on both desktop and mobile Feishu clients.

Changes

  • _build_outbound_payload: route markdown content to _build_cardkit_markdown_payload returning interactive type
  • _build_cardkit_markdown_payload: split content into sections and build a CardKit 2.0 card with markdown elements (max 10)
  • Update fallback logic in _feishu_send_with_retry to handle both post and interactive failures, falling back to plain text

Fixes

  • Markdown tables appearing blank
  • General markdown not rendering in Feishu

Related: PR #7085 (closed, unmerged)

Testing

  • Verified markdown tables, bold, code blocks, and lists render correctly on Feishu desktop and mobile
  • Verified fallback to plain text when interactive payload is rejected by API

…ctive cards

Feishu recently stopped rendering markdown markup inside the legacy
post message type's md tag.  This caused all markdown content
(tables, bold, code blocks, etc.) to be displayed as raw source text
unless the user tapped to open a detail view.

This commit replaces the post path with CardKit 2.0's
interactive message type using the tag: markdown component,
which natively supports standard GFM syntax and renders correctly on
both desktop and mobile Feishu clients.

Changes:
- _build_outbound_payload: route markdown content to
  _build_cardkit_markdown_payload returning interactive type
- _build_cardkit_markdown_payload: split content into sections and
  build a CardKit 2.0 card with markdown elements (max 10)
- Update fallback logic in _feishu_send_with_retry to handle both
  post and interactive failures, falling back to plain text

Fixes: markdown tables appearing blank; general markdown not rendering.
Related: PR NousResearch#7085 (closed, unmerged).
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for pursuing the Feishu Markdown rendering issue; current main still routes detected tables to plain text in plugins/platforms/feishu/adapter.py:4528-4530, so the underlying problem remains.

Problems

  • The patch changes gateway/platforms/feishu.py, but commit 5600105478ffde29d7566b45421b100eaa29c4ef moved the active adapter to plugins/platforms/feishu/adapter.py; this needs a port rather than a direct merge.
  • The proposed sections[:10] cap silently drops content after the tenth section.
  • _build_outbound_payload() also drives edit_message (plugins/platforms/feishu/adapter.py:1958), while the current edit fallback is post-only (:1963-1971). The patch updates only the send fallback, leaving interactive edit failures without the proposed degradation path.

Suggested changes

  • Port the implementation to plugins/platforms/feishu/adapter.py and make card splitting lossless.
  • Add send and edit fallback coverage, plus payload-routing tests for tables and ordinary Markdown.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
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 sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants