Skip to content

fix(feishu): support text tag and nested arrays in interactive card parsing - #73203

Closed
taozengabc wants to merge 2 commits into
openclaw:mainfrom
taozengabc:fix/feishu-interactive-card-text-extraction
Closed

taozengabc wants to merge 2 commits into
openclaw:mainfrom
taozengabc:fix/feishu-interactive-card-text-extraction

Conversation

@taozengabc

Copy link
Copy Markdown
Contributor

Problem

parseInteractiveCardContent only recognizes div, markdown, lark_md, and plain_text element tags. Two common card formats fall through to the [Interactive Card] placeholder:

  1. text tag elements — used by custom cards (e.g. monitoring alert cards built with CardKit):

    { "tag": "text", "text": "Service health check failed" }
  2. Nested array layouts — table-like row structures common in monitoring/status cards:

    {
      "elements": [
        [{"tag": "text", "text": "Service"}, {"tag": "text", "text": "eip-admin-api"}],
        [{"tag": "text", "text": "Alert"}, {"tag": "text", "text": "Health check failed 3 times"}]
      ]
    }

This causes loss of context when users quote-reply to card messages — the agent receives [Interactive Card] instead of the actual card content.

Impact in production: 33 occurrences over 4 weeks in our Feishu deployment, primarily in SLA monitoring groups where users quote alert cards to ask the agent for analysis.

Fix

Two minimal changes in extensions/feishu/src/send.ts:

  1. Add text tag support in extractInteractiveElementText — extracts element.text when tag === "text" and text is a string
  2. Flatten nested arrays in extractInteractiveElementsText — when an element is itself an array (row of cells), iterate its children instead of skipping

Both changes are additive and do not affect existing parsing behavior for div, markdown, lark_md, or plain_text tags.

Tests

Added two test cases in send.test.ts:

  • Nested array elements (table-like card layout)
  • text tag elements mixed with markdown elements

Related

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Apr 28, 2026
@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds two additive improvements to parseInteractiveCardContent in send.ts: support for the text tag (used by custom CardKit-based monitoring cards) and one-level flattening of nested array element rows (table-like layouts). Both changes are backward-compatible and covered by new test cases.

Confidence Score: 5/5

Safe to merge — changes are additive, correctly guarded, and well-tested.

Both changes are minimal and additive: the text tag branch is properly guarded by typeof element.text === "string", and the array flattening correctly delegates to the existing single-element extractor. No existing branches are modified, and two new test cases validate the new paths. No security or data-integrity concerns identified.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(feishu): support text tag and nested..." | Re-trigger Greptile

taozengabc and others added 2 commits April 28, 2026 18:23
…arsing

The parseInteractiveCardContent function only recognizes div, markdown,
lark_md, and plain_text tags. Cards that use text tags (common in
custom monitoring alert cards) or nested array layouts (table-like
row structures [[cell1, cell2], ...]) fall through to the
[Interactive Card] placeholder, losing all content.

This affects quoted message context when users reply to card messages,
causing the agent to lose critical context (e.g. alert details).

Changes:
- Add text tag support in extractInteractiveElementText
- Flatten one level of nested arrays in extractInteractiveElementsText
- Add test cases for both scenarios
@vincentkoc

Copy link
Copy Markdown
Member

ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical.

Source PR: #73203
Validation: pnpm -s vitest run extensions/feishu/src/send.test.ts; pnpm check:changed
Contributor credit is preserved in the branch history and PR context.

@vincentkoc
vincentkoc force-pushed the fix/feishu-interactive-card-text-extraction branch from 17a7abd to bf6f954 Compare April 28, 2026 18:26
@clawsweeper

clawsweeper Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open. Current main and latest release still do not extract direct Feishu interactive-card tag: "text" elements or nested elements rows, so the branch has useful unique work, but it is not merge-ready because it lacks real Feishu proof, is conflicting against main, adds unbounded recursive parsing, and edits release-owned changelog content.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level. A current-main getMessageFeishu() response with msg_type: "interactive" and either direct tag: "text" elements or nested elements row arrays reaches a parser that does not extract those shapes; I did not run tests because this review is read-only.

Is this the best way to solve the issue?

No, not as submitted. The Feishu parser is the right boundary and the text-tag support is useful, but the best mergeable fix should avoid unbounded recursion, remove the release-owned changelog edit, rebase, and include real Feishu proof.

Security review:

Security review needs attention: Security review needs attention: no dependency, workflow, lockfile, secret, or publishing changes were found, but the diff adds unbounded recursion over external Feishu card data.

  • [medium] Unbounded recursion over external card arrays — extensions/feishu/src/send.ts:257
    Feishu card content is external message data, and recursively descending nested arrays without explicit depth, node, or output bounds can overflow the stack or consume excessive CPU during quote/thread parsing.
    Confidence: 0.84

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-28T03:14:26Z, is older than 30 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • m1heng: The Feishu package metadata describes the Feishu/Lark channel plugin as community maintained by this handle. (role: declared plugin contact; confidence: high; files: extensions/feishu/package.json)
  • vincentkoc: Authored the merged Feishu interactive-card extraction repair on main and pushed the narrow repair commit on this PR branch. (role: recent parser repair contributor; confidence: high; commits: c6cf37068cae, 226249de179f, bf6f95446e93; files: extensions/feishu/src/send.ts, extensions/feishu/src/send.test.ts, extensions/feishu/src/post.ts)
  • qiangu: Introduced Feishu parent/root inbound context and quoted interactive-card fetching, which is the caller path that makes this parser visible to users. (role: quoted-message context contributor; confidence: medium; commits: 4ad49de89de7; files: extensions/feishu/src/bot.ts, extensions/feishu/src/send.ts, extensions/feishu/src/send.test.ts)
  • WilsonLiu95: Introduced the Feishu rich-text post parser that current main now uses as the interactive-card post-format fallback. (role: adjacent post parser contributor; confidence: medium; commits: 8818464f5f94; files: extensions/feishu/src/post.ts, extensions/feishu/src/post.test.ts)

Codex review notes: model internal, reasoning high; reviewed against 66880a5d736c.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 30, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label May 30, 2026
@barnacle-openclaw barnacle-openclaw Bot removed the stale Marked as stale due to inactivity label May 30, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 30, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 14, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu clawsweeper Tracked by ClawSweeper automation merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants