fix: skip dm history limit for non-dm sessions

This commit is contained in:
Ayaan Zaidi
2026-01-11 22:18:15 +05:30
parent 23717c5036
commit a4385dc920
2 changed files with 14 additions and 0 deletions

View File

@@ -399,6 +399,19 @@ describe("getDmHistoryLimitFromSessionKey", () => {
).toBe(10);
});
it("returns undefined for non-dm session kinds", () => {
const config = {
slack: { dmHistoryLimit: 10 },
telegram: { dmHistoryLimit: 15 },
} as ClawdbotConfig;
expect(
getDmHistoryLimitFromSessionKey("agent:beta:slack:channel:C1", config),
).toBeUndefined();
expect(
getDmHistoryLimitFromSessionKey("telegram:slash:123", config),
).toBeUndefined();
});
it("returns undefined for unknown provider", () => {
const config = { telegram: { dmHistoryLimit: 15 } } as ClawdbotConfig;
expect(