Skip to content

fix(feishu): remove outdated markdown table fallback, always use post format - #65529

Closed
hacxy wants to merge 1 commit into
NousResearch:mainfrom
hacxy:fix/feishu-md-table-rendering
Closed

fix(feishu): remove outdated markdown table fallback, always use post format#65529
hacxy wants to merge 1 commit into
NousResearch:mainfrom
hacxy:fix/feishu-md-table-rendering

Conversation

@hacxy

@hacxy hacxy commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Feishu's post-type md elements now natively support all markdown syntax including pipe tables. The old _MARKDOWN_TABLE_RE fallback forced table messages to plain text, causing them to render as raw source code instead of formatted tables.

Changes

  • Remove the table-to-text fallback in _build_outbound_payload()
  • Add _MARKDOWN_TABLE_RE check alongside _MARKDOWN_HINT_RE so tables route through the post format with md elements
  • Add 12 tests covering table routing, regex matching, and payload format

Problem

When the agent sends a markdown table in Feishu, the adapter's _build_outbound_payload() method detects the table pattern via _MARKDOWN_TABLE_RE and forces the message to plain text (msg_type: "text"). This causes the table to appear as raw markdown source code instead of a rendered table.

Root Cause

The old code assumed Feishu's post-type md elements could not render markdown tables, so it fell back to plain text. However, Feishu has since updated their post format to support all markdown syntax including pipe tables.

Fix

Instead of falling back to plain text for table content, we now route tables through the same post format as other markdown content (_MARKDOWN_HINT_RE). The _build_markdown_post_payload() function already handles the conversion correctly.

Testing

Added 12 new tests in tests/gateway/test_feishu_outbound_payload.py covering:

  • _MARKDOWN_TABLE_RE regex matching (simple table, heading row, plain text, single pipe)
  • _build_outbound_payload() routing (table → post, heading → post, plain text → text, mixed content)
  • _build_markdown_post_payload() output format

Fixes #38755

… format

Feishu's post-type 'md' elements now natively support all markdown syntax
including pipe tables. The old _MARKDOWN_TABLE_RE fallback forced table
messages to plain text, causing them to render as raw source code instead
of formatted tables.

Changes:
- Remove the table-to-text fallback in _build_outbound_payload()
- Add _MARKDOWN_TABLE_RE check alongside _MARKDOWN_HINT_RE so tables
  route through the post format with md elements
- Add 12 tests covering table routing, regex matching, and payload format

Fixes NousResearch#38755
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/feishu Feishu / Lark adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 16, 2026
@teknium1 teknium1 added 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 18, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing — this was fixed on main by #68121, which removes the _MARKDOWN_TABLE_RE force-text downgrade and routes tables through post/md, the same direction as this PR. Your dedicated test_feishu_outbound_payload.py suite overlapped with #58019's regression file that landed; the routing change is identical. The salvage was based on #58019 (cleanest implementation vs current main, with tests) with #29552 credited as the earliest submitter against the live plugin adapter path; both authors' commits were cherry-picked with authorship preserved. Thanks for contributing a fix for this — it was one of the most-reported bugs in the tracker.

@teknium1 teknium1 closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have 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.

fix(feishu): remove outdated markdown table fallback, always use post format

3 participants