fix(ui): strip inbound metadata blocks and guard reply-tag streaming (clean rewrite) (#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 commit is contained in:
Vincent Koc
2026-02-20 18:41:32 -08:00
committed by GitHub
parent 0e068194ad
commit 9a6b26d427
5 changed files with 69 additions and 4 deletions

View File

@@ -1,4 +1,8 @@
import { stripEnvelope, stripMessageIdHints } from "../shared/chat-envelope.js";
import {
stripEnvelope,
stripInboundMetadataBlocks,
stripMessageIdHints,
} from "../shared/chat-envelope.js";
export { stripEnvelope };
@@ -12,7 +16,7 @@ function stripEnvelopeFromContent(content: unknown[]): { content: unknown[]; cha
if (entry.type !== "text" || typeof entry.text !== "string") {
return item;
}
const stripped = stripMessageIdHints(stripEnvelope(entry.text));
const stripped = stripMessageIdHints(stripEnvelope(stripInboundMetadataBlocks(entry.text)));
if (stripped === entry.text) {
return item;
}
@@ -39,7 +43,7 @@ export function stripEnvelopeFromMessage(message: unknown): unknown {
const next: Record<string, unknown> = { ...entry };
if (typeof entry.content === "string") {
const stripped = stripMessageIdHints(stripEnvelope(entry.content));
const stripped = stripMessageIdHints(stripEnvelope(stripInboundMetadataBlocks(entry.content)));
if (stripped !== entry.content) {
next.content = stripped;
changed = true;
@@ -51,7 +55,7 @@ export function stripEnvelopeFromMessage(message: unknown): unknown {
changed = true;
}
} else if (typeof entry.text === "string") {
const stripped = stripMessageIdHints(stripEnvelope(entry.text));
const stripped = stripMessageIdHints(stripEnvelope(stripInboundMetadataBlocks(entry.text)));
if (stripped !== entry.text) {
next.text = stripped;
changed = true;