fix: harden iMessage echo dedupe and reasoning suppression (#25897)

This commit is contained in:
Peter Steinberger
2026-02-25 00:43:44 +00:00
parent a9ce6bd79b
commit 2a11c09a8d
13 changed files with 273 additions and 40 deletions

View File

@@ -123,4 +123,30 @@ describe("deliverReplies", () => {
}),
);
});
it("records outbound text and message ids in sent-message cache", async () => {
const remember = vi.fn();
chunkTextWithModeMock.mockImplementation((text: string) => text.split("|"));
await deliverReplies({
replies: [{ text: "first|second" }],
target: "chat_id:30",
client,
accountId: "acct-3",
runtime,
maxBytes: 2048,
textLimit: 4000,
sentMessageCache: { remember },
});
expect(remember).toHaveBeenCalledWith("acct-3:chat_id:30", { text: "first|second" });
expect(remember).toHaveBeenCalledWith("acct-3:chat_id:30", {
text: "first",
messageId: "imsg-1",
});
expect(remember).toHaveBeenCalledWith("acct-3:chat_id:30", {
text: "second",
messageId: "imsg-1",
});
});
});