Skip to content

fix(feishu): remove faulty table→text fallback in outbound payload - #33641

Open
wowpigpan wants to merge 1 commit into
NousResearch:mainfrom
wowpigpan:fix/feishu-post-markdown-rendering
Open

fix(feishu): remove faulty table→text fallback in outbound payload#33641
wowpigpan wants to merge 1 commit into
NousResearch:mainfrom
wowpigpan:fix/feishu-post-markdown-rendering

Conversation

@wowpigpan

Copy link
Copy Markdown

Summary

The _build_outbound_payload function was downgrading messages containing markdown tables from post type (rich rendering) to text type (raw text). This caused all markdown formatting to appear as raw source when a table was present.

Root Cause

The function checked for markdown tables first and forced the entire message to text msg_type. Feishu clients now render tables correctly in post type via the md element.

Fix

Removed the table-detection fallback. Messages with markdown (including tables) now use post type. Plain text uses text type.

Test Plan

  • Tested on Feishu 7.x (macOS): bold, italic, headings, code blocks, inline code, blockquotes, lists, and tables all render correctly

The _build_outbound_payload function was downgrading messages
containing markdown tables from post type (rich rendering) to
text type (raw markdown). This caused ALL markdown formatting
(headings, bold, code blocks, lists) in the entire message to
appear as raw text when a table was present.

Feishu's post 'md' element renders tables correctly on current
client versions, making the fallback unnecessary and harmful.

Tested on Feishu 7.x client — all markdown elements including
tables render correctly in post type.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels May 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #26108 — both remove the faulty _MARKDOWN_TABLE_RE force-text fallback in Feishu _build_outbound_payload. Part of long-standing issue family: #9549, #21866, #25452, #26658. Also competes with #27922.

@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 the focused Feishu report. The force-text behavior is still present, but this patch needs a small re-scope before it can affect current main.

Problems

  • Current main moved the active adapter from gateway/platforms/feishu.py to plugins/platforms/feishu/adapter.py in 560010547; the PR changes only the removed path.
  • Removing the early return alone does not make a bare table a post: _MARKDOWN_HINT_RE at plugins/platforms/feishu/adapter.py:154-157 has no table alternative, so the final text return at :4533-4534 still applies.
  • The patch has no regression test for table-only routing.

Suggested changes

  • Apply the change to plugins/platforms/feishu/adapter.py and route table-regex matches through _build_markdown_post_payload() alongside markdown hints.
  • Add tests/gateway/test_feishu.py coverage for bare-table and mixed markdown-plus-table post routing, with a plain-text control.

This is an automated hermes-sweeper review.

# Feishu post-type 'md' elements do not render tables, so we force text mode.
# No longer used in _build_outbound_payload (post md tags render tables fine),
# but kept for potential future use.
_MARKDOWN_TABLE_RE = re.compile(r"^\|.*\|\n\|[-|: ]+\|", re.MULTILINE)

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 file is no longer the active adapter on current main (560010547 moved it to plugins/platforms/feishu/adapter.py). Also, removing the force-text branch without adding table syntax to the post-routing predicate leaves a bare table at the final text return; salvage this by routing _MARKDOWN_TABLE_RE matches to post in the plugin and add a bare-table regression test.

@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 duplicate This issue or pull request already exists 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.

4 participants