Bug Description
When Hermes sends multi-line code blocks to Feishu via the post message type with md tag, the code block is rendered collapsed and cannot be expanded by the user. Only the first ~6 lines are visible.
Steps to Reproduce
- Configure Hermes with Feishu platform enabled (WebSocket mode)
- Ask the agent to generate any response containing a multi-line code block (e.g., a Python function with 10+ lines)
- Send the response to Feishu
Actual Behavior
The code block appears truncated after ~6 lines with no way to expand or view the full content. The message is delivered as a Feishu post message with md tag, which does not support interactive code block expansion.
Expected Behavior
Users should be able to click/expand the code block to view the full content, similar to how code blocks render in other messaging platforms or how Feishu's own code block component behaves.
Environment
- Hermes version: current main branch
- Platform: Feishu (WebSocket connection)
- Feishu client: desktop and mobile (both affected)
Relevant Context
Root Cause
The _build_markdown_post_payload() method in gateway/platforms/feishu.py wraps all markdown content (including code blocks) in a Feishu md tag. Feishu's md tag does not support interactive code block elements — code blocks are rendered as static, non-expandable text and get truncated after a few lines.
Suggested Fix
Route code block content to a Feishu Interactive Card (msg_type: interactive) with a tag: markdown element instead of the post type. CardKit 2.0's markdown element supports code fences that render with a "Copy" button and scrollable view in Feishu.
Alternatively, use Feishu's native tag: code element within card format for code-specific rendering with proper expansion support.
Bug Description
When Hermes sends multi-line code blocks to Feishu via the
postmessage type withmdtag, the code block is rendered collapsed and cannot be expanded by the user. Only the first ~6 lines are visible.Steps to Reproduce
Actual Behavior
The code block appears truncated after ~6 lines with no way to expand or view the full content. The message is delivered as a Feishu
postmessage withmdtag, which does not support interactive code block expansion.Expected Behavior
Users should be able to click/expand the code block to view the full content, similar to how code blocks render in other messaging platforms or how Feishu's own code block component behaves.
Environment
Relevant Context
mdtag inpostmessages does not support interactive elementsgateway/platforms/feishu.py_build_markdown_post_payload()renders code blocks as static textRoot Cause
The
_build_markdown_post_payload()method ingateway/platforms/feishu.pywraps all markdown content (including code blocks) in a Feishumdtag. Feishu'smdtag does not support interactive code block elements — code blocks are rendered as static, non-expandable text and get truncated after a few lines.Suggested Fix
Route code block content to a Feishu Interactive Card (
msg_type: interactive) with atag: markdownelement instead of theposttype. CardKit 2.0'smarkdownelement supports code fences that render with a "Copy" button and scrollable view in Feishu.Alternatively, use Feishu's native
tag: codeelement within card format for code-specific rendering with proper expansion support.