From 58d8218609fbce426ad932d6b093e8f21382ab16 Mon Sep 17 00:00:00 2001 From: Claude Lin & Lay Date: Fri, 21 Aug 2026 19:38:14 +0900 Subject: [PATCH] fix(sidecar): stop prefixing the speaker into the channel content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit セッション側に届いた行が「liplus-chat-room · マスター: マスター: ハロ~」と なり、発言者名が二重になっていた。 pushToChannel が params.content を `${user}: ${content}` として組み立てる一方、 params.meta.user にも同じ名前を入れていた。ホストは channel source と meta.user を自分で描画するため、content へ混ぜた名前が二つ目として現れる。 content を本文のみにした。発言者は meta.user が運ぶ。 発言者はメタデータで運ぶものであって本文へ混ぜるものではない。混ぜると本文が 発言そのものでなくなり、エージェントが引用や解析をするときに名前が本文の一部と して扱われる。 参照実装が content に要約文字列を組み立てているのは、あちらが webhook イベント という発言者のいない通知を扱っているため。発言者のある会話でそのまま真似たのが 誤りだった。 テストは match から equal に変えた。部分一致では名前の混入を検出できない。 #28 --- sidecar/src/index.ts | 5 ++++- sidecar/test/round-trip.test.mjs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sidecar/src/index.ts b/sidecar/src/index.ts index fa31128..005dbfd 100644 --- a/sidecar/src/index.ts +++ b/sidecar/src/index.ts @@ -196,7 +196,10 @@ function pushToChannel(frame: SayFrame): void { void mcp.notification({ method: "notifications/claude/channel", params: { - content: `${user}: ${content}`, + // Body only. The speaker rides in meta, which the host renders itself — + // putting the name here too produced "マスター: マスター: ハロ~" (#28), + // and it leaves the body no longer equal to what was said. + content, meta: { chat_id: CHAT_ID, message_id: frame.message_id ?? randomUUID(), diff --git a/sidecar/test/round-trip.test.mjs b/sidecar/test/round-trip.test.mjs index 4d9234a..ad33ec1 100644 --- a/sidecar/test/round-trip.test.mjs +++ b/sidecar/test/round-trip.test.mjs @@ -179,7 +179,9 @@ test("room say reaches the channel, and say_to_room reaches the room", async (t) ); const pushed = await nextNotification("notifications/claude/channel"); - assert.match(pushed.params.content, /Master: 聞こえる?/); + // Body only: the speaker belongs in meta, and the host renders it. Mixing it + // into the body showed the name twice on screen (#28). + assert.equal(pushed.params.content, "聞こえる?"); assert.equal(pushed.params.meta.chat_id, "test-room"); assert.equal(pushed.params.meta.message_id, "m-1"); assert.equal(pushed.params.meta.user, "Master");