fix(signal): canonicalize message targets in tool and inbound flows

This commit is contained in:
Josh Avant
2026-02-17 14:17:22 -08:00
committed by GitHub
parent 9a2c39419e
commit b20339a232
6 changed files with 135 additions and 30 deletions

View File

@@ -62,6 +62,39 @@ describe("buildThreadingToolContext", () => {
expect(result.currentChannelId).toBe("chat:99");
});
it("normalizes signal direct targets for tool context", () => {
const sessionCtx = {
Provider: "signal",
ChatType: "direct",
From: "signal:+15550001",
To: "signal:+15550002",
} as TemplateContext;
const result = buildThreadingToolContext({
sessionCtx,
config: cfg,
hasRepliedRef: undefined,
});
expect(result.currentChannelId).toBe("+15550001");
});
it("preserves signal group ids for tool context", () => {
const sessionCtx = {
Provider: "signal",
ChatType: "group",
To: "signal:group:VWATOdKF2hc8zdOS76q9tb0+5BI522e03QLDAq/9yPg=",
} as TemplateContext;
const result = buildThreadingToolContext({
sessionCtx,
config: cfg,
hasRepliedRef: undefined,
});
expect(result.currentChannelId).toBe("group:VWATOdKF2hc8zdOS76q9tb0+5BI522e03QLDAq/9yPg=");
});
it("uses the sender handle for iMessage direct chats", () => {
const sessionCtx = {
Provider: "imessage",