fix(feishu): remove outdated markdown table fallback, always use post format - #38834
fix(feishu): remove outdated markdown table fallback, always use post format#38834liuhao1024 wants to merge 2 commits into
Conversation
… format Feishu's post-type 'md' elements now natively support all markdown syntax including pipe tables. The old _MARKDOWN_TABLE_RE fallback that forced table-containing messages to plain text mode is no longer needed and causes tables to render as raw source code instead of formatted output. Remove the _MARKDOWN_TABLE_RE regex and its check in _build_outbound_payload() so all markdown content (including tables) is routed through the post format with 'md' elements for proper rendering. Fixes NousResearch#38755
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused Feishu fix. The underlying force-to-text behavior is still present on current main, but this branch needs a targeted salvage.
Problems
- The active adapter moved from
gateway/platforms/feishu.pytoplugins/platforms/feishu/adapter.pyin560010547; current routing remains atplugins/platforms/feishu/adapter.py:4524-4534. The new test imports the removed module attests/gateway/test_feishu_outbound_payload.py:20. - The unchanged
_MARKDOWN_HINT_REdoes not match a bare pipe table. The new test explicitly keeps that case in text mode attests/gateway/test_feishu_outbound_payload.py:66-77, so the reported bare-table path remains unfixed.
Suggested changes
- Port the focused change and test to
plugins/platforms/feishu/adapter.py. - Route a pure table to
postand assert the resultingmdpayload.
This is an automated hermes-sweeper review.
|
|
||
| def _make_adapter(): | ||
| """Create a minimal FeishuAdapter skeleton for testing _build_outbound_payload.""" | ||
| from gateway.platforms.feishu import FeishuAdapter |
There was a problem hiding this comment.
Current main migrated the active adapter to plugins/platforms/feishu/adapter.py in 5600105, so this import targets a removed module after salvage. Please import FeishuAdapter from the bundled plugin path.
| "| foo | 42 |" | ||
| ) | ||
| msg_type, payload = adapter._build_outbound_payload(table_content) | ||
| assert msg_type == "text" |
There was a problem hiding this comment.
This locks in the reported defect for a bare table: _MARKDOWN_HINT_RE does not match pipe-table syntax, so the proposed code still sends this case as text. Route this case to post and assert the md payload instead.
|
Closing — this was fixed on main by #68121, which removes the |
What does this PR do?
Removes the outdated
_MARKDOWN_TABLE_REfallback in the Feishu adapter that forced table-containing messages to plain text mode. Feishu's post-typemdelements now natively support all markdown syntax including pipe tables, so the fallback causes tables to render as raw source code instead of formatted output.Related Issue
Fixes #38755
Type of Change
Changes Made
gateway/platforms/feishu.py: Removed_MARKDOWN_TABLE_REregex definition (line 157-159) and its check in_build_outbound_payload()(lines 4311-4313). All markdown content including tables now routes through the post format withmdelements.tests/gateway/test_feishu_outbound_payload.py: Added 10 tests covering outbound payload routing — plain text, headings, tables with headings, pure tables, code blocks, bold, links, empty content, mixed table+code, and verification that_MARKDOWN_TABLE_REno longer exists.How to Test
pytest tests/gateway/test_feishu_outbound_payload.py -v— all 10 tests should passpytest tests/gateway/test_feishu.py -v— all 205 existing tests should pass (no regression)python -m ruff check gateway/platforms/feishu.py tests/gateway/test_feishu_outbound_payload.py— all checks passedChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
_MARKDOWN_TABLE_REused only in definition (line 159) and_build_outbound_payload(line 4314) — both removed_build_outbound_payloadcalled from 2 send paths (line 1785, 4307) — both already havetextfallback on post failure_build_markdown_post_payloadunchanged — handles code blocks and plain content correctly