fix(tui): strip inbound metadata blocks from user messages (clean rewrite) (#22345)

* fix(tui): strip inbound metadata blocks from user text

* chore: clean up metadata-strip format and changelog credit

* chore: format tui metadata-strip tests

* test: align metadata-strip regression expectations

* refactor: reuse canonical inbound metadata stripper

* test: allow tmp media fixture paths in media-understanding tests

* refactor: reuse canonical inbound metadata stripper

* format: fix changelog blank line after headings

* test: fix unrelated check typing regressions

* test: align memory async mock embedding signatures

* test: avoid tsgo mock typing pitfall

* test: restore async search mock typings in merge tree

* test: trigger ci rerun without behavior change

* chore: dedupe todays changelog entries

* fix: dedupe sqlite mock keys in qmd manager test

* Update qmd-manager.test.ts

* test: align chat metadata sanitization expectation
This commit is contained in:
Vincent Koc
2026-02-20 23:52:43 -05:00
committed by GitHub
parent 338ae269d6
commit 35be87b09b
10 changed files with 101 additions and 119 deletions

View File

@@ -59,15 +59,13 @@ describe("stripEnvelopeFromMessage", () => {
expect(result.content).toBe("Actual user message");
});
test("does not strip metadata-like blocks that are not a prefix", () => {
test("strips metadata-like blocks even when not a prefix", () => {
const input = {
role: "user",
content:
'Actual text\nConversation info (untrusted metadata):\n```json\n{"message_id": "123"}\n```\n\nFollow-up',
};
const result = stripEnvelopeFromMessage(input) as { content?: string };
expect(result.content).toBe(
'Actual text\nConversation info (untrusted metadata):\n```json\n{"message_id": "123"}\n```\n\nFollow-up',
);
expect(result.content).toBe("Actual text\n\nFollow-up");
});
});