Skip to content

Commit 5cca163

Browse files
committed
fix(signal): use newlines in debounced messages
1 parent af24487 commit 5cca163

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

extensions/signal/src/monitor/event-handler.inbound-context.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ describe("signal createSignalEventHandler inbound context", () => {
336336
).resolves.toEqual({ author: "+15550002222", body: "edited hello" });
337337
});
338338

339-
it("preserves the last debounced message body for native reply quote metadata", async () => {
339+
it("joins debounced message bodies with newlines and preserves the last for replies", async () => {
340340
vi.useFakeTimers();
341341
const deliverRepliesMock = vi.fn().mockResolvedValue(undefined);
342342
dispatchInboundMessageMock.mockImplementationOnce(async (params: any) => {
@@ -386,7 +386,8 @@ describe("signal createSignalEventHandler inbound context", () => {
386386
expect(deliverRepliesMock).toHaveBeenCalledTimes(1);
387387
});
388388
const context = requireCapturedContext();
389-
expect(context.BodyForAgent).toBe("first debounced message\\nsecond debounced message");
389+
expect(context.BodyForAgent).toBe("first debounced message\nsecond debounced message");
390+
expect(context.CommandBody).toBe("first debounced message\nsecond debounced message");
390391
expect(context.ReplyToId).toBe("1700000000002");
391392
expect(context.ReplyThreading).toEqual({ implicitCurrentMessage: "allow" });
392393
expect(deliverRepliesMock.mock.calls[0]?.[0]).toMatchObject({
@@ -2070,8 +2071,8 @@ describe("signal createSignalEventHandler inbound context", () => {
20702071

20712072
const context = requireCapturedContext();
20722073
expect(context.BodyForAgent).toContain("[signal attachment unavailable]");
2073-
expect(context.RawBody).toBe("first request\\nsecond request");
2074-
expect(context.CommandBody).toBe("first request\\nsecond request");
2074+
expect(context.RawBody).toBe("first request\nsecond request");
2075+
expect(context.CommandBody).toBe("first request\nsecond request");
20752076
} finally {
20762077
vi.useRealTimers();
20772078
}

extensions/signal/src/monitor/event-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,11 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
731731
const combinedText = entries
732732
.map((entry) => entry.bodyText)
733733
.filter(Boolean)
734-
.join("\\n");
734+
.join("\n");
735735
const combinedCommandBody = entries
736736
.map((entry) => entry.commandBody)
737737
.filter(Boolean)
738-
.join("\\n");
738+
.join("\n");
739739
if (!combinedText.trim()) {
740740
await settle();
741741
return;

0 commit comments

Comments
 (0)