Skip to content

fix(feishu): render markdown tables via Schema 2.0 interactive cards - #33800

Open
chengoak wants to merge 1 commit into
NousResearch:mainfrom
chengoak:main
Open

fix(feishu): render markdown tables via Schema 2.0 interactive cards#33800
chengoak wants to merge 1 commit into
NousResearch:mainfrom
chengoak:main

Conversation

@chengoak

@chengoak chengoak commented May 28, 2026

Copy link
Copy Markdown
Contributor

Problem

Feishu post-type 'md' elements do not render GFM tables. When a reply contains a markdown table, Hermes currently falls back to msg_type text, so users see raw markdown (|, ---) instead of a rendered table.

This is the same root cause described in #9549 and reported in #56430.

Solution

  1. Route table-bearing messages through a Schema 2.0 interactive card with a markdown element, which natively renders GFM tables, code blocks, and blockquotes.
  2. Disable streaming output for Feishu so the interactive card is delivered as a single final message rather than being edited/rendered incrementally.

Changes

  • plugins/platforms/feishu/adapter.py
    • _build_outbound_payload: when markdown tables are detected, return interactive instead of text
    • _build_table_card_payload: new helper that wraps content in a Schema 2.0 card with a markdown element
  • gateway/run.py
    • Force _streaming_enabled = False when source.platform == Platform.FEISHU in both stream-consumer setup paths

Verification

Tested locally: after restarting the gateway, a Feishu message containing a markdown table is rendered as a visual table instead of raw markdown text.

Related issues

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

Copy link
Copy Markdown
Collaborator

Duplicate of #26108 — same approach (route table content through Feishu post+md tags). Also competes with #29552, #31056, #31410, and many others. Root issue: #9549.

@chengoak

Copy link
Copy Markdown
Contributor Author

This fix is now verified working! Feishu v1.0.39+ supports markdown tables in post+md format. Please merge this PR to fix the table rendering issue for all users. 👍

Feishu post-type 'md' elements do not render GFM tables, causing table
content to be downgraded to plain text (raw '|' and '---'). Route
table-bearing messages through a Schema 2.0 interactive card with a
'markdown' element, which natively renders tables, code blocks, and
blockquotes.

Also disable streaming output for Feishu so that the final interactive
card is delivered as a single message rather than being edited/rendered
incrementally.

Fixes NousResearch#56430, related to NousResearch#9549
@chengoak chengoak changed the title fix(feishu): render markdown tables via post md tags instead of raw text fix(feishu): render markdown tables via Schema 2.0 interactive cards Jul 1, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pursuing the Feishu table-rendering path. The current adapter still routes detected tables to plain text (plugins/platforms/feishu/adapter.py:4494), and existing interactive-card sends show that this is a compatible outbound message type (plugins/platforms/feishu/adapter.py:2029-2034).

Problems

  • gateway/run.py:15578 in this PR assigns _streaming_enabled = False without a platform check. This is inside the proxy agent path, which derives configuration from the arbitrary source.platform (gateway/run.py:16725-16735 on current main), so it would disable streaming for every proxy-backed platform rather than just Feishu.
  • No tests cover the new table-to-interactive route or the platform-specific streaming behavior. Existing outbound markdown tests cover post payloads at tests/gateway/test_feishu.py:2693-2994.

Suggested changes

  • Add if source.platform == Platform.FEISHU: around the first streaming override, matching the second hunk.
  • Add regression tests for the interactive Schema 2.0 payload and for preserving non-Feishu streaming.

Automated hermes-sweeper review.

Comment thread gateway/run.py
if _plat_streaming is None
else bool(_plat_streaming)
)
# Force-disable streaming for Feishu to ensure single final message

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment is unconditional in _run_agent_via_proxy, whose source can be any gateway platform. Please guard it with if source.platform == Platform.FEISHU: as in the second streaming setup; otherwise proxy streaming is disabled globally.

@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-broad Sweeper blast radius: broad — a core path most sessions hit 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-broad Sweeper blast radius: broad — a core path most sessions hit 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.

Feishu 消息中 Markdown 表格被降级为纯文本导致渲染错误

3 participants