fix(feishu): sanitize markdown in streaming cards to prevent truncation#1433
Open
BingqingLyu wants to merge 3 commits intomainfrom
Open
fix(feishu): sanitize markdown in streaming cards to prevent truncation#1433BingqingLyu wants to merge 3 commits intomainfrom
BingqingLyu wants to merge 3 commits intomainfrom
Conversation
Rebased onto current main. Adds sanitizeCardKitMarkdown() to balance unclosed backtick fences/spans and escape bare angle brackets that cause Card Kit streaming to truncate output. Also strips leaked reasoning tags from streaming text and falls back to post format when replying to avoid older clients showing upgrade prompt.
The oxlint no-control-characters rule flags \x00 as unexpected control characters. Switch to Unicode Private Use Area codepoints \uE001/\uE002 which serve the same sentinel purpose without triggering the linter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes openclaw#26708
When an LLM response streamed via Feishu Card Kit contains unmatched backticks or bare angle brackets, the message gets truncated. This is because Card Kit's incremental markdown parser treats unmatched opening backticks as starting a code span/block that never closes, and bare
<as unclosed HTML tags.Changes
sanitizeCardKitMarkdownfunction instreaming-card.ts:updateCardContentcallssanitizeCardKitMarkdownbefore sending to Card KittruncateSummarystrips backticks and angle brackets from notification summaryTest plan
if x < 10) — verify no truncation