Skip to content

fix(feishu): parse code blocks and share_chat messages#28591

Merged
Takhoffman merged 2 commits into
openclaw:mainfrom
kevinWangSheng:fix/feishu-code-blocks
Feb 28, 2026
Merged

fix(feishu): parse code blocks and share_chat messages#28591
Takhoffman merged 2 commits into
openclaw:mainfrom
kevinWangSheng:fix/feishu-code-blocks

Conversation

@kevinWangSheng

Copy link
Copy Markdown
Contributor

Summary

Fixes #28578 - 飞书扩展无法解析富文本中的代码块和合并转发消息

Changes

  1. Code block parsing: Added support for parsing code, code_block, and pre tags in rich text (post) messages
  2. share_chat handling: Added handling for share_chat message type (merged/forwarded messages)

Testing

  • All existing tests pass (9 tests in bot.test.ts)

Issue Reference

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS labels Feb 27, 2026
@greptile-apps

greptile-apps Bot commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds parsing support for code blocks and forwarded messages in Feishu's rich text format, addressing issue #28578.

Changes

  • Code block parsing: Handles code, code_block, and pre tags in post (rich text) messages
    • code and code_block formatted as inline code with single backticks
    • pre formatted as fenced code blocks with language support
  • share_chat handling: Returns placeholder message for forwarded/merged messages since actual content requires additional API calls

Assessment

The implementation follows existing code patterns in parsePostContent, using similar property access patterns (element.text || element.content) and defensive programming. The changes are minimal, focused, and don't modify any critical logic paths. All existing tests pass according to the PR description.

Confidence Score: 4/5

  • Safe to merge with minimal risk - focused changes for parsing enhancement
  • Small, well-contained changes that add new parsing capabilities without modifying existing logic. Follows established code patterns and includes defensive error handling. The placeholder approach for share_chat messages is reasonable given API limitations.
  • No files require special attention

Last reviewed commit: b974b23

Kevin Shenghui and others added 2 commits February 27, 2026 20:00
- Add support for parsing code/code_block tags in rich text posts
- Add support for parsing pre (preformatted text) tags with language
- Handle share_chat message type for forwarded/merged messages

Fixes: openclaw#28578
@Takhoffman Takhoffman force-pushed the fix/feishu-code-blocks branch from b974b23 to 7c3b05d Compare February 28, 2026 02:15
@Takhoffman Takhoffman merged commit da00ead into openclaw:main Feb 28, 2026
9 checks passed
@Takhoffman

Copy link
Copy Markdown
Contributor

PR #28591 - fix(feishu): parse code blocks and share_chat messages (#28591)

Merged via squash.

  • Merge commit: da00ead
  • Verified: pnpm install --frozen-lockfile, pnpm build, pnpm check, pnpm test:macmini
  • Changes made:
    M CHANGELOG.md
    M extensions/feishu/src/bot.checkBotMentioned.test.ts
    M extensions/feishu/src/bot.ts
  • Why these changes were made:
    Issue 飞书扩展无法解析富文本中的代码块和合并转发消息 #28578 reported Feishu rich-text code blocks and forwarded messages losing actionable content. The original PR direction was good, but strict review required safer share_chat fallback semantics and explicit regression tests before landing.
  • Changelog: CHANGELOG.md updated=true required=true opt_out=false

Thanks @kevinWangSheng!

r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 28, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
(cherry picked from commit da00ead)

# Conflicts:
#	CHANGELOG.md
#	extensions/feishu/src/bot.checkBotMentioned.test.ts
#	extensions/feishu/src/bot.ts
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
venjiang pushed a commit to venjiang/openclaw that referenced this pull request Mar 2, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
oskarfreye pushed a commit to oskarfreye/openclaw that referenced this pull request Mar 2, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
(cherry picked from commit da00ead)

# Conflicts:
#	CHANGELOG.md
#	extensions/feishu/src/bot.checkBotMentioned.test.ts
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 15, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
(cherry picked from commit da00ead)
alexey-pelykh added a commit to remoteclaw/remoteclaw that referenced this pull request Mar 15, 2026
… thanks @kevinWangSheng (#1458)

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini



(cherry picked from commit da00ead)

Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
… thanks @kevinWangSheng

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

飞书扩展无法解析富文本中的代码块和合并转发消息

2 participants