fix(ui): strip inbound metadata blocks and guard reply-tag streaming (clean rewrite)#22346
Merged
vincentkoc merged 3 commits intomainfrom Feb 21, 2026
Merged
Conversation
4 tasks
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This was referenced Feb 21, 2026
mmyyfirstb
pushed a commit
to mmyyfirstb/openclaw
that referenced
this pull request
Feb 21, 2026
…(clean rewrite) (openclaw#22346) * fix(ui): strip inbound metadata blocks from user messages * chore: clean up metadata-strip format and changelog credit * Update src/shared/chat-envelope.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
mreedr
pushed a commit
to mreedr/openclaw-custom
that referenced
this pull request
Feb 24, 2026
…(clean rewrite) (openclaw#22346) * fix(ui): strip inbound metadata blocks from user messages * chore: clean up metadata-strip format and changelog credit * Update src/shared/chat-envelope.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…(clean rewrite) (openclaw#22346) * fix(ui): strip inbound metadata blocks from user messages * chore: clean up metadata-strip format and changelog credit * Update src/shared/chat-envelope.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
VikrantSingh01
added a commit
to VikrantSingh01/openclaw
that referenced
this pull request
Mar 19, 2026
The `\-` inside a character class is unnecessary when `-` is at the end. Fixes oxlint no-useless-escape error introduced in openclaw#22346.
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
…(clean rewrite) (openclaw#22346) * fix(ui): strip inbound metadata blocks from user messages * chore: clean up metadata-strip format and changelog credit * Update src/shared/chat-envelope.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
ogt-redknie
pushed a commit
to ogt-redknie/OPENX
that referenced
this pull request
May 2, 2026
…(clean rewrite) (openclaw#22346) * fix(ui): strip inbound metadata blocks from user messages * chore: clean up metadata-strip format and changelog credit * Update src/shared/chat-envelope.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
This is a clean reroute of the closed PR for this change.
origin/mainand squashed to a single clean commit.This supersedes #21643. The original PR became stale due a detached/dirty head after history churn while attempting rebase/cleanup.
Closes #21548.
Greptile Summary
This PR enhances security by preventing inbound metadata blocks from leaking into chat history and fixes streaming artifacts when reply tags are being processed.
Key changes:
stripInboundMetadataBlocks()function to remove untrusted metadata prefixes (like "Conversation info (untrusted metadata):", "Sender (untrusted metadata):", etc.) from user messages at display boundarieschat-sanitize.ts, applying it before envelope and message ID strippingstripTrailingDirective()to handle incomplete reply-tag streaming by removing trailing[characters that haven't formed complete[[directive]]tags yetThe implementation correctly strips multiple consecutive metadata blocks at the start of messages using a loop with regex matching, then trims the result. The regex pattern properly escapes special characters in the header strings before building the alternation pattern.
Confidence Score: 4/5
[guard is a simple defensive check that prevents streaming artifacts.src/shared/chat-envelope.tsline 27 to verify regex escape pattern is completeLast reviewed commit: 900afd4