


























@@ -95,7 +95,11 @@ describe("createTelegramSendChatActionHandler", () => {
95959696// Second call should mention backoff in logs
9797await expect(handler.sendChatAction(123, "typing")).rejects.toThrow("401");
98-expect(logger).toHaveBeenCalledWith(expect.stringContaining("backoff"));
98+expect(logger.mock.calls).toEqual([
99+["sendChatAction 401 error (1/5). Retrying with exponential backoff."],
100+["sendChatAction backoff: waiting 1000ms before retry (failure 1/5)"],
101+["sendChatAction 401 error (2/5). Retrying with exponential backoff."],
102+]);
99103});
100104101105it("suspends after maxConsecutive401 failures", async () => {
@@ -112,7 +116,9 @@ describe("createTelegramSendChatActionHandler", () => {
112116await expect(handler.sendChatAction(123, "typing")).rejects.toThrow("401");
113117114118expect(handler.isSuspended()).toBe(true);
115-expect(logger).toHaveBeenCalledWith(expect.stringContaining("CRITICAL"));
119+expect(logger.mock.calls.at(-1)).toEqual([
120+"CRITICAL: sendChatAction suspended after 3 consecutive 401 errors. Bot token is likely invalid. Telegram may DELETE the bot if requests continue. Replace the token and restart: openclaw channels restart telegram",
121+]);
116122117123// Subsequent calls are silently skipped
118124await handler.sendChatAction(123, "typing");
@@ -141,7 +147,9 @@ describe("createTelegramSendChatActionHandler", () => {
141147await handler.sendChatAction(123, "typing");
142148143149expect(handler.isSuspended()).toBe(false);
144-expect(logger).toHaveBeenCalledWith(expect.stringContaining("recovered"));
150+expect(logger.mock.calls.at(-1)).toEqual([
151+"sendChatAction recovered after 2 consecutive 401 failures",
152+]);
145153});
146154147155it("does not count non-401 errors toward suspension", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。