Strip OpenClaw channel metadata from chat turn user text#388
Open
Strip OpenClaw channel metadata from chat turn user text#388
Conversation
e735088 to
070825e
Compare
|
|
||
| private stripChannelMetadata(text: string): string { | ||
| if (!text) return ""; | ||
| const metadataBlock = |
There was a problem hiding this comment.
🔴 Bug: This heuristic strips any Telegram message that starts with one of these fenced blocks, even if the user authored it intentionally. A user debugging Telegram metadata and pasting a single Conversation info ... block as the first part of their message will have that content silently removed from persistence. Please gate stripping on a trusted adapter signal (or validate the parsed block against envelope metadata) instead of matching only on user-writable text.
070825e to
871cb89
Compare
871cb89 to
6815ae9
Compare
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
computeDeltaand W4b message-hook persistence.stripRecalledMemorybehavior while adding user-side coverage for Telegram metadata pollution from Telegram chat turns persist OpenClaw channel metadata blocks alongside user text, polluting chat-turn memory and recall #380.Related
Files changed
packages/adapter-openclaw/src/ChatTurnWriter.tsstripChannelMetadataand applies it before W4a user pairing and W4b inbound queueing so persisted user text and content-derived identity use stripped text for Telegram runtime wrappers.packages/adapter-openclaw/test/ChatTurnWriter.test.tsMetadata stripping behavior
Conversation infoand optionalSenderwhen they use the(untrusted metadata)heading form.Channel contextafter the wrapper.Channel contextorMessage contextwithout a concrete trusted wrapper source; those labels remain extensibility points rather than active stripping rules.Watermark/hash decision and migration note
deterministicTurnId,contentHash, cross-path stamps, and typed W4b markers use the stripped persisted user text going forward.Sendermetadata-shaped block is indistinguishable from the currentConversation info+Senderruntime wrapper shape. The implementation chooses the issue's required wrapper stripping while bounding repeated/broader-label loss cases in tests.Privacy notes
userTextno longer carries inline Telegramchat_id,message_id,sender_id, sender name, username, or timestamp from the channel metadata wrapper.userTextremains unchanged and is out of scope for Telegram chat turns persist OpenClaw channel metadata blocks alongside user text, polluting chat-turn memory and recall #380.Known risks or follow-ups
Test plan
pnpm install- completed; emitted non-blockingdkg-mcpbin warnings for an unbuilt MCP package and pnpm ignored-build-script notices.pnpm --filter @origintrail-official/dkg-adapter-openclaw exec vitest run test/ChatTurnWriter.test.ts -t T380- passed, 16 tests.pnpm --filter @origintrail-official/dkg-adapter-openclaw exec vitest run test/ChatTurnWriter.test.ts- passed, 187 tests.pnpm --filter @origintrail-official/dkg-core run build- passed.pnpm --filter @origintrail-official/dkg-adapter-openclaw run build- passed.pnpm --filter @origintrail-official/dkg-adapter-openclaw exec vitest run test/ChatTurnWriter.test.ts test/ChatTurnWriter.crashRecovery.test.ts test/ChatTurnWriter.sanitize.test.ts- passed, 198 tests.git diff --check- passed with Windows LF-to-CRLF checkout warnings only.pnpm --filter @origintrail-official/dkg-adapter-openclaw test- ran 984 tests: 981 passed, 1 skipped, 2 failed in unrelated baseline tests:test/adapter-openclaw-extra.test.ts > plugin id equals package nameexpects@origintrail-official/dkg-adapter-openclawbut receivesadapter-openclaw;test/setup.test.ts > writeDkgConfig > mirrors only autoUpdate.enabled from network default and preserves existing pinsexpectsautoUpdate.repoto remain present.