From fb4aa7eaba572d499f3d56a7b6b78ce4ded04544 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 13 Mar 2026 22:00:22 +0000 Subject: [PATCH] fix: tighten shared chat envelope coverage --- src/shared/chat-envelope.test.ts | 2 ++ src/shared/chat-envelope.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/chat-envelope.test.ts b/src/shared/chat-envelope.test.ts index 0bd513c1b..ca214f373 100644 --- a/src/shared/chat-envelope.test.ts +++ b/src/shared/chat-envelope.test.ts @@ -14,6 +14,7 @@ describe("shared/chat-envelope", () => { expect(stripEnvelope("hello")).toBe("hello"); expect(stripEnvelope("[note] hello")).toBe("[note] hello"); expect(stripEnvelope("[2026/01/24 13:36] hello")).toBe("[2026/01/24 13:36] hello"); + expect(stripEnvelope("[Teams] hello")).toBe("[Teams] hello"); }); it("removes standalone message id hint lines but keeps inline mentions", () => { @@ -21,6 +22,7 @@ describe("shared/chat-envelope", () => { expect(stripMessageIdHints("hello\n [message_id: abc123] \nworld")).toBe("hello\nworld"); expect(stripMessageIdHints("[message_id: abc123]\nhello")).toBe("hello"); expect(stripMessageIdHints("[message_id: abc123]")).toBe(""); + expect(stripMessageIdHints("hello\r\n[MESSAGE_ID: abc123]\r\nworld")).toBe("hello\nworld"); expect(stripMessageIdHints("I typed [message_id: abc123] inline")).toBe( "I typed [message_id: abc123] inline", ); diff --git a/src/shared/chat-envelope.ts b/src/shared/chat-envelope.ts index 409a41357..b6bb1457a 100644 --- a/src/shared/chat-envelope.ts +++ b/src/shared/chat-envelope.ts @@ -39,7 +39,7 @@ export function stripEnvelope(text: string): string { } export function stripMessageIdHints(text: string): string { - if (!text.includes("[message_id:")) { + if (!/\[message_id:/i.test(text)) { return text; } const lines = text.split(/\r?\n/);