惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
月光博客
月光博客
B
Blog RSS Feed
C
Check Point Blog
WordPress大学
WordPress大学
T
Tailwind CSS Blog
GbyAI
GbyAI
H
Help Net Security
Y
Y Combinator Blog
I
InfoQ
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
美团技术团队
博客园 - 三生石上(FineUI控件)
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
A
About on SuperTechFans
G
Google Developers Blog
爱范儿
爱范儿
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
人人都是产品经理
人人都是产品经理

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(telegram): keep polling watchdog on getUpdates livene...
ai-hpc · 2026-05-07 · via Recent Commits to openclaw:main

@@ -765,17 +765,16 @@ describe("TelegramPollingSession", () => {

765765

});

766766

});

767767768-

it("does not trigger stall restart when non-getUpdates API calls are active", async () => {

768+

it("triggers stall restart when getUpdates is stale despite recent non-getUpdates API success", async () => {

769769

const abort = new AbortController();

770770

const botStop = vi.fn(async () => undefined);

771771

const runnerStop = vi.fn(async () => undefined);

772772

const getApiMiddleware = mockBotCapturingApiMiddleware(botStop);

773773

const resolveFirstTask = mockLongRunningPollingCycle(runnerStop);

774774775775

// t=0: lastGetUpdatesAt and lastApiActivityAt initialized

776-

// t=150_001: watchdog fires (getUpdates stale for 150s)

777-

// But right before watchdog, a sendMessage succeeds at t=150_001

778-

// All subsequent Date.now calls return the same value, giving apiIdle = 0.

776+

// t=150_001: watchdog fires (getUpdates stale for 150s).

777+

// Right before watchdog, a sendMessage succeeds at t=150_001.

779778

const watchdogHarness = installPollingStallWatchdogHarness();

780779781780

const log = vi.fn();

@@ -789,20 +788,19 @@ describe("TelegramPollingSession", () => {

789788

const watchdog = await watchdogHarness.waitForWatchdog();

790789791790

// Simulate a sendMessage call through the middleware before watchdog fires.

792-

// This updates lastApiActivityAt, proving the network is alive.

791+

// This updates unrelated API liveness, but inbound getUpdates remains stale.

793792

const apiMiddleware = getApiMiddleware();

794793

if (apiMiddleware) {

795794

const fakePrev = vi.fn(async () => ({ ok: true }));

796795

await apiMiddleware(fakePrev, "sendMessage", { chat_id: 123, text: "hello" });

797796

}

798797799-

// Now fire the watchdog — getUpdates is stale (120s) but API was just active

798+

// Now fire the watchdog — getUpdates is stale (120s) even though API was just active.

800799

watchdog?.();

801800802-

// The watchdog should NOT have triggered a restart

803-

expect(runnerStop).not.toHaveBeenCalled();

804-

expect(botStop).not.toHaveBeenCalled();

805-

expect(log).not.toHaveBeenCalledWith(expect.stringContaining("Polling stall detected"));

801+

expect(runnerStop).toHaveBeenCalledTimes(1);

802+

expect(botStop).toHaveBeenCalledTimes(1);

803+

expect(log).toHaveBeenCalledWith(expect.stringContaining("Polling stall detected"));

806804807805

// Clean up: abort to end the session

808806

abort.abort();

@@ -813,7 +811,7 @@ describe("TelegramPollingSession", () => {

813811

}

814812

});

815813816-

it("does not trigger stall restart while a recent non-getUpdates API call is in-flight", async () => {

814+

it("triggers stall restart while a recent non-getUpdates API call is in-flight", async () => {

817815

const abort = new AbortController();

818816

const botStop = vi.fn(async () => undefined);

819817

const runnerStop = vi.fn(async () => undefined);

@@ -848,13 +846,12 @@ describe("TelegramPollingSession", () => {

848846

const sendPromise = apiMiddleware(slowPrev, "sendMessage", { chat_id: 123, text: "hello" });

849847850848

// Fire the watchdog while sendMessage is still in-flight.

851-

// The in-flight call started 60s ago, so API liveness is still recent.

849+

// API liveness is still recent, but inbound getUpdates is stale.

852850

watchdog?.();

853851854-

// The watchdog should NOT have triggered a restart

855-

expect(runnerStop).not.toHaveBeenCalled();

856-

expect(botStop).not.toHaveBeenCalled();

857-

expect(log).not.toHaveBeenCalledWith(expect.stringContaining("Polling stall detected"));

852+

expect(runnerStop).toHaveBeenCalledTimes(1);

853+

expect(botStop).toHaveBeenCalledTimes(1);

854+

expect(log).toHaveBeenCalledWith(expect.stringContaining("Polling stall detected"));

858855859856

// Resolve the in-flight call to clean up

860857

resolveSendMessage?.({ ok: true });

@@ -920,7 +917,7 @@ describe("TelegramPollingSession", () => {

920917

}

921918

});

922919923-

it("does not trigger stall restart when a newer non-getUpdates API call starts while an older one is still in-flight", async () => {

920+

it("triggers stall restart when getUpdates is stale despite newer in-flight non-getUpdates API activity", async () => {

924921

const abort = new AbortController();

925922

const botStop = vi.fn(async () => undefined);

926923

const runnerStop = vi.fn(async () => undefined);

@@ -965,13 +962,13 @@ describe("TelegramPollingSession", () => {

965962

{ chat_id: 123, text: "newer" },

966963

);

967964968-

// The older send is stale, but the newer send started just now.

969-

// Watchdog liveness must follow the newest active non-getUpdates call.

965+

// The older send is stale and the newer send started recently.

966+

// Watchdog liveness must still follow getUpdates, not unrelated API calls.

970967

watchdog?.();

971968972-

expect(runnerStop).not.toHaveBeenCalled();

973-

expect(botStop).not.toHaveBeenCalled();

974-

expect(log).not.toHaveBeenCalledWith(expect.stringContaining("Polling stall detected"));

969+

expect(runnerStop).toHaveBeenCalledTimes(1);

970+

expect(botStop).toHaveBeenCalledTimes(1);

971+

expect(log).toHaveBeenCalledWith(expect.stringContaining("Polling stall detected"));

975972976973

resolveFirstSend?.({ ok: true });

977974

resolveSecondSend?.({ ok: true });