refactor: harden plugin install flow and main DM route pinning

This commit is contained in:
Peter Steinberger
2026-03-02 21:22:32 +00:00
parent af637deed1
commit b782ecb7eb
22 changed files with 737 additions and 269 deletions

View File

@@ -103,4 +103,32 @@ describe("recordInboundSession", () => {
}),
);
});
it("skips last-route updates when main DM owner pin mismatches sender", async () => {
const { recordInboundSession } = await import("./session.js");
const onSkip = vi.fn();
await recordInboundSession({
storePath: "/tmp/openclaw-session-store.json",
sessionKey: "agent:main:telegram:1234:thread:42",
ctx,
updateLastRoute: {
sessionKey: "agent:main:main",
channel: "telegram",
to: "telegram:1234",
mainDmOwnerPin: {
ownerRecipient: "1234",
senderRecipient: "9999",
onSkip,
},
},
onRecordError: vi.fn(),
});
expect(updateLastRouteMock).not.toHaveBeenCalled();
expect(onSkip).toHaveBeenCalledWith({
ownerRecipient: "1234",
senderRecipient: "9999",
});
});
});