Conversation
OpenClaw core injects inbound metadata (Conversation info, Sender info, etc.) into the user message prompt via buildInboundUserContextPrefix(). Core strips these blocks in its normal UI/prompt replay flow, but the Weixin channel plugin delivers raw LLM output to the user without removing echoed metadata blocks. This causes users to occasionally receive garbage messages containing only metadata JSON. Fix: add stripInboundMetadata() call in the deliver callback after StreamingMarkdownFilter processing. The strip-meta module handles all six metadata block types with optional timestamp prefixes.
Extends stripInboundMetadata() to cover all metadata types that OpenClaw core handles: - MESSAGE_TOOL_DELIVERY_HINTS (4 variants) -- sentinel lines removed - Chat window context blocks -- pattern-matched headers - Untrusted context suffix -- terminal metadata appended by core - active_memory_plugin blocks -- memory plugin context wrapper - Leading timestamp prefix removal - Blank line cleanup after stripped meta blocks Previously only handled the 6 INBOUND_META_SENTINELS, missing these 4 additional metadata patterns that core's strip-inbound-meta.ts handles. Test coverage expanded from 11 to 23 cases. Ref: openclaw core src/auto-reply/reply/strip-inbound-meta.ts
This was referenced Jul 5, 2026
ralf003
added a commit
to ralf003/openclaw-weixin
that referenced
this pull request
Jul 22, 2026
8 tasks
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.
Problem
OpenClaw core injects inbound metadata (Conversation info, Sender info, Thread starter, Reply target, Forwarded message context, Chat history) into the user message prompt via
buildInboundUserContextPrefix(). Core strips these blocks in its normal UI/prompt replay flow withstripInboundMetadata(), but the Weixin channel plugin delivers raw LLM output to the user without removing echoed metadata blocks.This causes users to occasionally receive garbage messages containing only metadata instead of the actual reply.
Solution
Add
stripInboundMetadata()to process outgoing text in the deliver callback after theStreamingMarkdownFilter, removing echoed metadata blocks before the message is sent to the user.Metadata types handled (aligned with core's strip-inbound-meta.ts)
Conversation info,Sender,Thread starter, etc.Delivery: to send a message, use the \message` tool.` etc.Group chat context (untrusted, chronological):Untrusted context (metadata, ...)block<active_memory_plugin>...</active_memory_plugin>[Mon 2026-07-05 09:30 GMT+8]Changes
src/messaging/strip-meta.tswithstripInboundMetadata()(standalone re-implementation synced with core)src/messaging/strip-meta.test.tswith 23 test casesstripInboundMetadata()in the deliver callback afterStreamingMarkdownFilterNote
This is a standalone copy of the logic from openclaw core's
src/auto-reply/reply/strip-inbound-meta.ts, becausestripInboundMetadatais not currently exposed via the plugin SDK. I'll open a core issue requesting SDK exposure so plugins don't need to maintain their own copies.