Skip to content

feat(feishu): render markdown tables as Interactive Cards + fix CuaDriver backend cache - #45386

Closed
x7peeps wants to merge 2 commits into
NousResearch:mainfrom
x7peeps:fix/feishu-table-card-rendering
Closed

feat(feishu): render markdown tables as Interactive Cards + fix CuaDriver backend cache#45386
x7peeps wants to merge 2 commits into
NousResearch:mainfrom
x7peeps:fix/feishu-table-card-rendering

Conversation

@x7peeps

@x7peeps x7peeps commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

1. Feishu Markdown Table -> Interactive Card

Previously, when the agent produced a reply containing a markdown table, Feishu rendered it as a blank message via the post msg_type. Now detects markdown tables and renders them as Feishu Interactive Cards with native table components (supported on Feishu v7.4+).

2. CuaDriver Backend Cache Fix

When CuaDriverBackend failed to start on first attempt (e.g. missing mcp binary), _backend was cached as not-None with a dead session. Subsequent _get_backend() calls returned the stale instance instead of re-creating it. Now checks _session._started before reusing the cache.

Changes

  • gateway/platforms/feishu.py - markdown table detection + Interactive Card rendering
  • tests/gateway/test_feishu_table_card.py - comprehensive test suite (333 lines)
  • tools/computer_use/tool.py - CuaDriver backend cache freshness check

Test Plan

  • Unit tests pass (test_feishu_table_card.py)
  • Manual test: table renders as card in Feishu DM

x7peeps added 2 commits June 12, 2026 23:45
…lain text

Previously, when the agent produced a reply containing a markdown table,
Feishu's 'post' content-type 'md' elements rendered the table as a blank
message. The workaround was to fall back to msg_type='text', which
discarded all formatting and made tables unreadable.

Now the adapter detects markdown tables and renders them as Feishu
Interactive Cards with native  components (supported on Feishu
v7.4+). The approach:

- New  splits content into
  text-only blocks and markdown table blocks, handling mixed content,
  multiple tables, and alignment specifiers.
- New  converts a parsed markdown table
  into Feishu's card table JSON with columns, rows, header styling, and
  page-size limits.
- New  assembles a complete Interactive
  Card payload combining markdown text elements and table elements.
-  now returns msg_type='interactive' with
  the card payload when tables are detected, instead of downgrading to
  plain text.
- Both send_message and edit_message paths benefit from the change.

Closes #...
When CuaDriverBackend fails to start on first attempt (e.g. missing 'mcp'
binary), _backend was cached as not-None with a dead session. Subsequent
_get_backend() calls returned the stale instance instead of re-creating it.
Now checks _session._started before reusing the cache.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter duplicate This issue or pull request already exists labels Jun 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of the saturated Feishu-table-rendering cluster (canonical #12114; tracked by #27469). At least 8+ open PRs implement the same markdown-table->Interactive-Card feature (#33180/#26429/#38453/#39045/#27046). Note: this PR also bundles an unrelated CuaDriver backend cache fix in tools/computer_use/tool.py.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Comment (high surface area)

This PR renders markdown tables as Interactive Cards in Feishu and fixes the CuaDriver backend cache. The diff is 533 additions with changes spanning Feishu platform adapter, CuaDriver backend, and table rendering logic.

The changes appear to be focused and additive, but the diff touches multiple areas: the Feishu platform adapter, a caching layer, and the table rendering pipeline. Without running tests to verify the Feishu card rendering and CuaDriver cache interaction, I cannot confidently APPROVE in cron mode. The large diff size (533 additions) warrants human review attention.

No security concerns, no debug artifacts, no secrets in the diff.


Reviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved (high surface area — see notes)

Adds markdown table parsing and rendering as Feishu Interactive Cards. Also includes a CuaDriver backend cache fix.

Strengths:

  • Clean regex-based table detection and parsing
  • Handles escaped pipes in cell content
  • Segments content into table and non-table blocks for mixed content
  • Well-structured with dedicated helper functions

Notes:

  • 533 additions touching 3 files
  • A prior review (tonydwb) noted the high surface area — implementation is clean and well-scoped within the Feishu platform

No blocking issues found.

Reviewed by Hermes Agent

@x7peeps

x7peeps commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as part of the saturated Feishu-table-rendering cluster (#12114 canonical). Thanks @alt-glitch.

@x7peeps

x7peeps commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as part of the saturated Feishu-table-rendering cluster. #12114 is the canonical PR for this feature.

@x7peeps x7peeps closed this Jun 16, 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 P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants