mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 20:41:46 +00:00
fix: dedupe inbound Telegram DM replies per agent (#40519)
Merged via squash.
Prepared head SHA: 6e235e7d1f
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -1539,6 +1539,38 @@ describe("dispatchReplyFromConfig", () => {
|
||||
expect(replyResolver).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("deduplicates same-agent inbound replies across main and direct session keys", async () => {
|
||||
setNoAbort();
|
||||
const cfg = emptyConfig;
|
||||
const replyResolver = vi.fn(async () => ({ text: "hi" }) as ReplyPayload);
|
||||
const baseCtx = buildTestCtx({
|
||||
Provider: "telegram",
|
||||
Surface: "telegram",
|
||||
OriginatingChannel: "telegram",
|
||||
OriginatingTo: "telegram:7463849194",
|
||||
MessageSid: "msg-1",
|
||||
SessionKey: "agent:main:main",
|
||||
});
|
||||
|
||||
await dispatchReplyFromConfig({
|
||||
ctx: baseCtx,
|
||||
cfg,
|
||||
dispatcher: createDispatcher(),
|
||||
replyResolver,
|
||||
});
|
||||
await dispatchReplyFromConfig({
|
||||
ctx: {
|
||||
...baseCtx,
|
||||
SessionKey: "agent:main:telegram:direct:7463849194",
|
||||
},
|
||||
cfg,
|
||||
dispatcher: createDispatcher(),
|
||||
replyResolver,
|
||||
});
|
||||
|
||||
expect(replyResolver).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("emits message_received hook with originating channel metadata", async () => {
|
||||
setNoAbort();
|
||||
hookMocks.runner.hasHooks.mockReturnValue(true);
|
||||
|
||||
Reference in New Issue
Block a user