Discord: honor accountId across channel actions (refs #1489)

This commit is contained in:
Sergii Kozak
2026-01-23 00:50:50 -08:00
parent dc89bc4004
commit 716f901504
8 changed files with 322 additions and 146 deletions

View File

@@ -5,6 +5,10 @@ vi.mock("../../gateway/call.js", () => ({
callGateway: (opts: unknown) => callGatewayMock(opts),
}));
vi.mock("../agent-scope.js", () => ({
resolveSessionAgentId: () => "agent-123",
}));
import { createCronTool } from "./cron-tool.js";
describe("cron tool", () => {
@@ -85,6 +89,23 @@ describe("cron tool", () => {
});
});
it("does not default agentId when job.agentId is null", async () => {
const tool = createCronTool({ agentSessionKey: "main" });
await tool.execute("call-null", {
action: "add",
job: {
name: "wake-up",
schedule: { atMs: 123 },
agentId: null,
},
});
const call = callGatewayMock.mock.calls[0]?.[0] as {
params?: { agentId?: unknown };
};
expect(call?.params?.agentId).toBeNull();
});
it("adds recent context for systemEvent reminders when contextMessages > 0", async () => {
callGatewayMock
.mockResolvedValueOnce({