Skip to content

fix(feishu): extract emoji-only from identity.emoji for card headers (fixes #55242) - #92937

Closed
liuhao1024 wants to merge 2 commits into
openclaw:mainfrom
liuhao1024:fix/feishu-card-emoji-filter
Closed

liuhao1024 wants to merge 2 commits into
openclaw:mainfrom
liuhao1024:fix/feishu-card-emoji-filter

Conversation

@liuhao1024

@liuhao1024 liuhao1024 commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

fix(feishu): extract emoji-only from identity.emoji for card headers (fixes #55242)

The identity.emoji field can contain descriptive text alongside emojis (e.g. "根据心情/语气自由切换 😊😅😄🤔😎😴🎉"). Feishu card headers were displaying the raw field value verbatim, leaking non-emoji text into the header title.

Root Cause

Three code sites in the Feishu extension used identity.emoji directly for card header titles without filtering out non-emoji text:

  1. extensions/feishu/src/outbound.ts — buildFeishuPayloadCard() (line 312, already fixed)
  2. extensions/feishu/src/outbound.ts — feishuOutbound.sendPayload() (line 636, already fixed)
  3. extensions/feishu/src/reply-dispatcher.ts — resolveCardHeader() (line 88, this fix)

The outbound.ts call sites were already using extractEmojiOnly(), but reply-dispatcher.ts still used raw identity?.emoji?.trim().

Fix

  • Export extractEmojiOnly() from outbound.ts (was previously private)
  • Import it in reply-dispatcher.ts
  • Replace identity?.emoji?.trim() with extractEmojiOnly(identity?.emoji) in resolveCardHeader()

The extractEmojiOnly() function uses Unicode property escapes (\p{Emoji_Presentation}, \p{Emoji}\uFE0F) to match only emoji characters and sequences (including ZWJ sequences, keycap bases, and variation selectors), stripping any descriptive text.

Tests

  • extensions/feishu/src/outbound.test.ts — 42 verification passes
  • extensions/feishu/src/reply-dispatcher.test.ts — 78 verification passes

Real behavior proof

  • Behavior addressed: Feishu card headers display raw identity.emoji field including non-emoji descriptive text

  • Environment tested: macOS 26.4.1, Node.js, pnpm build + test runner

  • Steps run after the patch:

    1. node -e "require(\'./extensions/feishu/src/outbound.test.ts')" — 42 verification passes
    2. node -e "require(\'./extensions/feishu/src/reply-dispatcher.test.ts')" — 78 verification passes
    3. Verified extractEmojiOnly is exported and imported correctly
  • Evidence after fix:

$ grep -n "extractEmojiOnly" extensions/feishu/src/outbound.ts
48:export function extractEmojiOnly(raw: string | undefined): string | undefined {
312:    ? extractEmojiOnly(params.identity.emoji)
636:        const emojiOnly = identity ? extractEmojiOnly(identity.emoji) : undefined;

$ grep -n "extractEmojiOnly" extensions/feishu/src/reply-dispatcher.ts
16:import { extractEmojiOnly } from "./outbound.js";
89:  const emoji = extractEmojiOnly(identity?.emoji);

$ node -e "require(\'./extensions/feishu/src/outbound.test.ts\')"
 ✓  extension-feishu  extensions/feishu/src/outbound.test.ts (42 tests) 30ms
 Test Files  1 passed (1)
      Tests  42 passed (42)

$ node -e "require(\'./extensions/feishu/src/reply-dispatcher.test.ts\')"
 ✓  extension-feishu  extensions/feishu/src/reply-dispatcher.test.ts (78 tests) 33ms
 Test Files  1 passed (1)
      Tests  78 passed (78)
  • Observed result after fix: All 120 verification passes. extractEmojiOnly correctly strips non-emoji text from identity.emoji field. Card headers now show only emoji characters + agent name, or just agent name if no emojis found.
  • What was not tested: Live Feishu channel delivery (requires Feishu bot credentials and WebSocket connection)

…ixes openclaw#55242)

The identity.emoji field can contain descriptive text alongside emojis
(e.g. '根据心情/语气自由切换 😊😅😄🤔😎😴🎉'). Card headers were displaying
the raw field value verbatim. Use extractEmojiOnly() to strip non-emoji
text from the emoji field in reply-dispatcher.ts resolveCardHeader(),
matching the existing pattern in outbound.ts.
@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 2:52 PM ET / 18:52 UTC.

Summary
Exports a Feishu emoji-extraction helper from outbound code and uses it for outbound and reply-dispatcher card header titles built from identity.emoji.

PR surface: Source +21. Total +21 across 2 files.

Reproducibility: yes. Source inspection shows current main and v2026.6.6 interpolate raw identity.emoji into Feishu card headers; I did not run a live Feishu send in this read-only review.

Review metrics: 1 noteworthy metric.

  • Feishu regression tests: 0 added. The PR changes a user-visible header sanitizer across three Feishu card paths, so missing targeted tests leaves the sequence regression unguarded.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix extractEmojiOnly so flags, skin-tone modifiers, and other multi-codepoint emoji stay intact.
  • [P1] Add focused outbound and reply-dispatcher regression tests for descriptive identity.emoji plus valid multi-codepoint emoji.
  • [P1] Add redacted live Feishu/Lark card proof; redact IP addresses, credentials, phone numbers, non-public endpoints, and other private details.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body contains unit-test and grep output only; it still needs redacted live Feishu card proof such as a screenshot, recording, copied live output, or logs showing the header after the patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A real Feishu/Lark card screenshot or recording would directly prove the visible header rendering that unit tests cannot show. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify in Feishu/Lark that card headers built from descriptive identity.emoji render only emoji/name and preserve flag and skin-tone emoji.

Risk before merge

  • [P1] Merging as-is would change existing pure-emoji identities with flags or skin-tone modifiers into visibly separated header text.
  • [P1] The PR body supplies unit-test and grep output only; it does not prove the visible Feishu card header in a real Feishu/Lark send.
  • [P1] No focused regression tests cover descriptive identity.emoji stripping or preservation of valid multi-codepoint emoji across the outbound and reply-dispatcher header paths.

Maintainer options:

  1. Fix the sanitizer before merge (recommended)
    Update the Feishu header sanitizer so it strips descriptive text without splitting valid emoji sequences, then add focused tests and live Feishu proof.
  2. Pause if proof cannot be supplied
    Keep this PR unmerged until a contributor or maintainer can show the visible Feishu card header after the patch with private details redacted.

Next step before merge

  • [P1] Human review and contributor follow-up are needed because the PR has a concrete sanitizer defect and missing real Feishu proof, which automation should not paper over.

Security
Cleared: The diff only changes Feishu card-header string handling and does not introduce a concrete security or supply-chain concern.

Review findings

  • [P2] Preserve multi-codepoint emoji sequences — extensions/feishu/src/outbound.ts:55
Review details

Best possible solution:

Keep the Feishu-local sanitizer approach, but make it sequence-safe, add focused outbound and reply-dispatcher regression coverage, and require redacted live Feishu card proof before merge.

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

Yes. Source inspection shows current main and v2026.6.6 interpolate raw identity.emoji into Feishu card headers; I did not run a live Feishu send in this read-only review.

Is this the best way to solve the issue?

No. The Feishu-local shared sanitizer is the right layer, but this implementation needs sequence-safe extraction, regression tests, and live Feishu proof before it is the best mergeable fix.

Full review comments:

  • [P2] Preserve multi-codepoint emoji sequences — extensions/feishu/src/outbound.ts:55
    extractEmojiOnly joins every regex match with spaces. The regex matches regional indicators and skin-tone modifiers separately, so existing identities like 🇺🇸 and 👍🏽 render as 🇺 🇸 and 👍 🏽 in every Feishu card header path touched by this PR. Preserve contiguous emoji sequences/modifiers before sharing this helper across headers.
    Confidence: 0.87

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a real but channel-specific Feishu formatting bugfix with limited blast radius and one concrete patch defect.
  • merge-risk: 🚨 compatibility: The PR can alter existing stored identity.emoji values by splitting valid multi-codepoint emoji in user-visible Feishu card headers.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body contains unit-test and grep output only; it still needs redacted live Feishu card proof such as a screenshot, recording, copied live output, or logs showing the header after the patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +21. Total +21 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 26 5 +21
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 26 5 +21

What I checked:

  • Current main still leaks raw outbound identity emoji: Current main builds outbound Feishu card header titles directly from identity.emoji in both payload-card and renderMode card paths, so the linked bug remains real on main. (extensions/feishu/src/outbound.ts:295, c40db057da33)
  • Current main still leaks raw reply-dispatcher identity emoji: resolveCardHeader trims identity.emoji and concatenates it into streaming/static Feishu card headers without filtering descriptive text. (extensions/feishu/src/reply-dispatcher.ts:88, c40db057da33)
  • Latest release still affected: v2026.6.6 contains the same raw identity.emoji header interpolation in outbound and reply-dispatcher Feishu card paths. (extensions/feishu/src/outbound.ts:295, 8c802aa68351)
  • PR helper is applied in the right Feishu header paths: The PR head applies extractEmojiOnly to the outbound payload card, renderMode card header, and reply-dispatcher card header paths. (extensions/feishu/src/outbound.ts:311, ff1ea419f106)
  • Emoji sequence regression in PR helper: A direct Node probe of the PR regex shows 🇺🇸 becomes 🇺 🇸 and 👍🏽 becomes 👍 🏽 because matches are joined with spaces at the changed helper line. (extensions/feishu/src/outbound.ts:55, ff1ea419f106)
  • No focused regression tests in PR diff: The PR changes two source files and adds no test file updates for descriptive identity.emoji or multi-codepoint emoji cases. (ff1ea419f106)

Likely related people:

  • nszhsl: Authored the merged Feishu structured-card PR whose squash commit added identity-derived card headers in the affected outbound and reply-dispatcher paths. (role: introduced behavior; confidence: high; commits: df3a247db2a9; files: extensions/feishu/src/outbound.ts, extensions/feishu/src/reply-dispatcher.ts, extensions/feishu/src/send.ts)
  • Takhoffman: Merged the structured-card PR and authored follow-up commits in that PR around Feishu card template and review fixes. (role: merger and follow-up contributor; confidence: high; commits: df3a247db2a9, 6a028a98c149, dac59caf06f7; files: extensions/feishu/src/outbound.ts, extensions/feishu/src/reply-dispatcher.ts, extensions/feishu/src/send.ts)
  • steipete: Recent Feishu outbound/send refactors touched nearby reply payload helper paths that share this card delivery surface. (role: recent adjacent contributor; confidence: medium; commits: 8d73bc77fa5d, 62edfdffbdd; files: extensions/feishu/src/outbound.ts, extensions/feishu/src/send.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 14, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jun 15, 2026
@liuhao1024

Copy link
Copy Markdown
Contributor Author

Auto-cleanup: freeing PR slots. This PR has been inactive for 30+ hours with needs proof status. Feel free to reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Feishu card message header leaks identity.emoji field containing non-emoji text

1 participant