Conversation
Feishu post-type `md` elements do not render GitHub-style pipe tables, so agent responses containing tables arrive as raw or dropped markup. Detect markdown table blocks in outbound content and render them as interactive cards using the Card-Kit 2.0 native `table` component — the only stable table rendering path in Feishu. Surrounding prose is preserved as `markdown` card elements. - Table card uses schema 2.0 with column-keyed rows - Single-column or degenerate tables fall back to an ASCII code-fence table inside a post message - Card build failures fall back to the same ASCII path - Configurable via platforms.feishu.extra.table_mode: 'card' (default) or 'ascii' to skip Card-Kit entirely - `_build_outbound_payload` reads table mode defensively (getattr with a 'card' default) so it keeps working on bare instances per the test contract in tests/gateway/test_feishu_table_markdown.py Tests: - Add test_send_uses_interactive_card_for_markdown_table asserting msg_type=interactive, schema 2.0 and a native table element - Update tests/gateway/test_feishu_table_markdown.py: the NousResearch#52786 intent (never downgrade a table to plain text) is preserved; the default table_mode now asserts the interactive card path, and ascii mode asserts the post + ASCII code-fence path
Contributor
Duplicate of #12114: both route Feishu markdown tables to Card 2.0 interactive cards using native table elements. |
Author
|
Thanks for the triage note. I searched existing PRs (including #12114) before opening this one, and I'd respectfully push back on the duplicate flag — the two PRs are not on comparable bases:
For reference, the same stale-path issue applies to #46727 and #38453 (both modify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Feishu
post-type messages withtag: "md"elements do not render GitHub-style pipe tables — table content arrives as raw or dropped markup. This PR detects markdown table blocks in outbound messages and renders them as interactive cards using the Card-Kit 2.0 nativetablecomponent, the only stable table rendering path in Feishu. Prose around a table is preserved asmarkdowncard elements in the same card.Type of Change
Changes Made
plugins/platforms/feishu/adapter.py_build_outbound_payloadbefore the generic markdown pathinteractivecards (schema: "2.0") with nativetableelements (column-keyed rows) for multi-column tablespostmessage for single-column/degenerate tables or card build failuresplatforms.feishu.extra.table_mode:"card"(default, Card-Kit) |"ascii"(always ASCII code-fence)_build_outbound_payloadreads the table mode defensively (getattrwith a"card"default) so it keeps working on bare instances, per the test contract intests/gateway/test_feishu_table_markdown.pytests/gateway/test_feishu.pytest_send_uses_interactive_card_for_markdown_table: assertsmsg_type=interactive,schema: "2.0", and a nativetableelement with the expected column-keyed rowstests/gateway/test_feishu_table_markdown.pytextinteractiveCard-Kit path (previously assertedpost; the rendering path is what changed, not the no-downgrade guarantee)table_mode="ascii"asserting thepost+ ASCII code-fence pathHow to Test
platforms.feishu.extra.table_mode: card)| A | B |\n|---|---|\n| 1 | 2 |table_mode: asciiand repeat — the table arrives as a code-fenced ASCII table inside apostmessagepython -m pytest tests/gateway/test_feishu.py tests/gateway/test_feishu_table_markdown.py -q(79 passed)Relationship to #52786 and Existing Similar PRs
textbug; its test intest_feishu_table_markdown.pyis updated here because the table rendering path changed frompost/mdtointeractiveCard-Kit. The no-downgrade guarantee the regression test protects is preserved.gateway/platforms/feishu.py, which no longer exists onmain(the Feishu adapter moved toplugins/platforms/feishu/adapter.py) — staletable_modeconfig toggle, and ASCII fallback for degenerate tablesChecklist
Code
feat(feishu):)tests/gateway/test_feishu.py+tests/gateway/test_feishu_table_markdown.py79/79;tests/gateway/full directory 4847 passed (4 pre-existing failures intest_feishu_approval_buttons.py,test_discord_send.py,test_session_store_prune.pyare unrelated to this PR — those files are untouched)Documentation & Housekeeping
cli-config.yaml.example— N/A: the new key is a per-platformextrapassthrough (same mechanism as existing keys such asrequire_mention)CONTRIBUTING.mdorAGENTS.md— N/A (no architecture or workflow change)