fix(feishu): route markdown tables through post instead of broken interactive card - #45583
fix(feishu): route markdown tables through post instead of broken interactive card#45583Zjrua wants to merge 1 commit into
Conversation
…n interactive card Markdown tables in Feishu post 'md' elements render correctly, but the interactive card table element format was invalid (missing required page_size, header_row, display_name fields), causing Feishu API error 230099 (ErrCode 200914: table rows is invalid) and blank messages. The card table approach also fails during streaming edits because Feishu does not allow changing msg_type (post → interactive) on message update. Routing tables through post alongside other markdown content is simpler and renders correctly on all Feishu clients.
Related issues & PRsSearch found several existing issues/PRs addressing the same Feishu markdown table problem: Bug reports:
Similar approaches (post routing):
Card-based attempts (same root cause — invalid card table format):
All card-based PRs appear stuck — the Feishu card table JSON format has strict requirements ( Closes #9549 |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Feishu markdown tables now route through a native card table element instead of falling back to plain text, which was causing tables to appear blank. The fix parses markdown tables into Feishu card element format, with non-table content continuing through the standard post/markdown path. Also fixes a text-edit fallback that falls back to post if the initial edit failed due to msg_type mismatch. Well-scoped fix with good test coverage.
Reviewed by Hermes Agent
|
Alternative approach: Schema 2.0 card with Instead of routing tables back to The key difference: instead of parsing the markdown table into a card Relevant docs: |
|
Superseded by #53453 — cleaner diff (no dead CardKit code), targets the correct post-migration file path, and additionally fixes the streaming edit fallback edge case. |
Bug
Markdown tables in Feishu messages render as blank/empty content. The gateway logs show:
Root cause
_build_outbound_payload()routes any content containing a markdown table to the interactive card path (msg_type=interactive), which builds a cardtableelement via_parse_markdown_table_to_card_element().The generated table JSON format is invalid per Feishu's card table API spec:
page_sizefieldheader_rowdata_typeanddisplay_namein column definitions{"tag": "plain_text", "content": ...}instead of{"text": {"tag": "plain_text", ...}}This causes the Feishu API to reject the card with error 230099, resulting in blank messages.
Additionally, during streaming, the initial chunk is sent as
post/textand then the final edit tries to switch tointeractive— Feishu does not allow changingmsg_typeon message update, causing further failures.Fix
Route markdown tables through the post type (same as other markdown content) instead of the interactive card. Markdown tables in post
mdelements render correctly on Feishu clients.Testing
Verified on Feishu (websocket mode) with various markdown tables — all render correctly via post type. The interactive card approach produced blank messages consistently.