Skip to content

feat(feishu): convert markdown tables to interactive card elements - #33180

Closed
whatwoods wants to merge 1 commit into
NousResearch:mainfrom
whatwoods:feat/feishu-table-to-card
Closed

feat(feishu): convert markdown tables to interactive card elements#33180
whatwoods wants to merge 1 commit into
NousResearch:mainfrom
whatwoods:feat/feishu-table-to-card

Conversation

@whatwoods

@whatwoods whatwoods commented May 27, 2026

Copy link
Copy Markdown

Problem

Feishu post-type md elements cannot render markdown tables. The existing outbound path therefore downgraded table-bearing replies to plain text, leaving structured data as raw pipe-delimited text.

Solution

Markdown tables are now converted to Feishu Card JSON 2.0 table elements and sent as interactive messages. Surrounding prose remains ordered card markdown.

Changes

  • Implement fence-aware markdown segmentation so table-like text inside code blocks is preserved
  • Parse escaped pipes and inline-code pipes without shifting table columns
  • Build native Card 2.0 tables with lark_md cells
  • Preserve mixed content and multiple tables in source order
  • Normalize headings outside code fences for card markdown
  • Fall back to plain text when card limits are exceeded
  • Add send and edit fallbacks when Feishu rejects an interactive card
  • Port the change to the current plugins/platforms/feishu/adapter.py implementation
  • Keep the unrelated OpenClaw migration skill and script intact

Before / After

Before: Table content was sent as plain text:

| Col A | Col B |
|-------|-------|
| 1     | 2     |

After: It renders as a structured Feishu table inside an interactive card.

Testing

  • scripts/run_tests.sh tests/gateway/test_feishu.py -q — 217 passed
  • scripts/run_tests.sh tests/skills/test_openclaw_migration.py -q — 41 passed
  • .venv/bin/ruff check plugins/platforms/feishu/adapter.py tests/gateway/test_feishu.py — passed
  • git diff --check — passed

@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter P2 Medium — degraded but workaround exists labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #12114 (Feishu markdown table → interactive card rendering). Part of the 70+ PR cluster tracked by consolidation issue #27469. See also competing PRs #32455, #21000, #17006.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for tackling a real Feishu rendering limitation. Current main still routes markdown tables to plain text in plugins/platforms/feishu/adapter.py:4524-4530, so the underlying problem remains.

Problems

  • The PR deletes the unrelated OpenClaw migration skill and script. They are active bundled dependencies: hermes_cli/claw.py:37-43, hermes_cli/setup.py:2349-2355, and tests/skills/test_openclaw_migration.py:9-24 reference the script.
  • The feature targets gateway/platforms/feishu.py, but current main moved the live adapter to plugins/platforms/feishu/adapter.py in 560010547.
  • The new interactive path would not use the existing API-rejection text fallbacks, which are restricted to post in plugins/platforms/feishu/adapter.py:1913-1936 and 1963-1971.

Suggested changes

  • Port only the table-card work to plugins/platforms/feishu/adapter.py; keep the migration skill intact.
  • Cover pure/mixed/multiple tables and interactive send/edit rejection fallback in tests/gateway/test_feishu.py.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
@whatwoods
whatwoods force-pushed the feat/feishu-table-to-card branch from 4ada75e to e2b179d Compare July 18, 2026 05:21

Copy link
Copy Markdown
Author

Reworked in e2b179d to address the sweeper review:

  • rebuilt from current main and ported the feature to plugins/platforms/feishu/adapter.py
  • removed the unrelated OpenClaw migration deletions
  • added interactive API-rejection fallbacks for both send and edit paths
  • added coverage for pure/mixed/multiple tables, fenced code, escaped pipes, card limits, and send/edit fallbacks

Validation: Feishu 217/217, OpenClaw migration 41/41, Ruff and git diff --check passed. The PR is now mergeable and changes only the adapter and its tests.

@whatwoods whatwoods closed this Jul 23, 2026
@whatwoods
whatwoods deleted the feat/feishu-table-to-card branch July 23, 2026 01:29
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 P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants