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

推荐订阅源

博客园_首页
H
Help Net Security
腾讯CDC
宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
爱范儿
爱范儿
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
D
Docker
V
V2EX
Last Week in AI
Last Week in AI
G
Google Developers Blog
IT之家
IT之家
C
Check Point Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东

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 outbound timeout guard authoritative ...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -14,11 +14,15 @@ const createTelegramBot = (opts: import("./bot.types.js").TelegramBotOptions) =>

1414

telegramDeps: telegramBotDepsForTest,

1515

});

161617-

function createWrappedTelegramClientFetch(proxyFetch: typeof fetch) {

17+

function createWrappedTelegramClientFetch(

18+

proxyFetch: typeof fetch,

19+

config?: import("openclaw/plugin-sdk/config-types").OpenClawConfig,

20+

) {

1821

const shutdown = new AbortController();

1922

botCtorSpy.mockClear();

2023

createTelegramBot({

2124

token: "tok",

25+

...(config ? { config } : {}),

2226

fetchAbortSignal: shutdown.signal,

2327

proxyFetch,

2428

});

@@ -111,6 +115,53 @@ describe("createTelegramBot fetch abort", () => {

111115

vi.useRealTimers();

112116

});

113117118+

it("uses the longer outbound text timeout for sendMessage", async () => {

119+

vi.useFakeTimers();

120+

const fetchSpy = vi.fn(

121+

(_input: RequestInfo | URL, init?: RequestInit) =>

122+

new Promise<AbortSignal>((resolve) => {

123+

const signal = init?.signal as AbortSignal;

124+

signal.addEventListener("abort", () => resolve(signal), { once: true });

125+

}),

126+

);

127+

const { clientFetch } = createWrappedTelegramClientFetch(fetchSpy as unknown as typeof fetch);

128+129+

const observedSignalPromise = clientFetch("https://api.telegram.org/bot123456:ABC/sendMessage");

130+

await vi.advanceTimersByTimeAsync(60_000);

131+

const observedSignal = (await observedSignalPromise) as AbortSignal;

132+133+

expect(observedSignal).toBeInstanceOf(AbortSignal);

134+

expect(observedSignal.aborted).toBe(true);

135+

vi.useRealTimers();

136+

});

137+138+

it("lets configured timeoutSeconds extend outbound method guards", async () => {

139+

vi.useFakeTimers();

140+

const fetchSpy = vi.fn(

141+

(_input: RequestInfo | URL, init?: RequestInit) =>

142+

new Promise<AbortSignal>((resolve) => {

143+

const signal = init?.signal as AbortSignal;

144+

signal.addEventListener("abort", () => resolve(signal), { once: true });

145+

}),

146+

);

147+

const { clientFetch } = createWrappedTelegramClientFetch(

148+

fetchSpy as unknown as typeof fetch,

149+

{

150+

channels: { telegram: { timeoutSeconds: 90 } },

151+

} as never,

152+

);

153+154+

const observedSignalPromise = clientFetch(

155+

"https://api.telegram.org/bot123456:ABC/editMessageText",

156+

);

157+

await vi.advanceTimersByTimeAsync(90_000);

158+

const observedSignal = (await observedSignalPromise) as AbortSignal;

159+160+

expect(observedSignal).toBeInstanceOf(AbortSignal);

161+

expect(observedSignal.aborted).toBe(true);

162+

vi.useRealTimers();

163+

});

164+114165

it("retries timed-out control calls once after forcing transport fallback", async () => {

115166

vi.useFakeTimers();

116167

const forceFallback = vi.fn(() => true);

@@ -168,6 +219,33 @@ describe("createTelegramBot fetch abort", () => {

168219

},

169220

);

170221222+

it("retries timed-out sendChatAction once after forcing transport fallback", async () => {

223+

vi.useFakeTimers();

224+

const forceFallback = vi.fn(() => true);

225+

const fetchSpy = vi

226+

.fn()

227+

.mockImplementationOnce(

228+

(_input: RequestInfo | URL, init?: RequestInit) =>

229+

new Promise((_resolve, reject) => {

230+

const signal = init?.signal as AbortSignal;

231+

signal.addEventListener("abort", () => reject(signal.reason), { once: true });

232+

}),

233+

)

234+

.mockResolvedValueOnce({ ok: true } as Response);

235+

const { clientFetch } = createWrappedTelegramClientFetchWithTransport({

236+

fetch: fetchSpy as unknown as typeof fetch,

237+

forceFallback,

238+

});

239+240+

const resultPromise = clientFetch("https://api.telegram.org/bot123456:ABC/sendChatAction");

241+

await vi.advanceTimersByTimeAsync(60_000);

242+243+

await expect(resultPromise).resolves.toEqual({ ok: true });

244+

expect(forceFallback).toHaveBeenCalledWith("request-timeout");

245+

expect(fetchSpy).toHaveBeenCalledTimes(2);

246+

vi.useRealTimers();

247+

});

248+171249

it("preserves the original fetch error when tagging cannot attach metadata", async () => {

172250

const frozenError = Object.freeze(

173251

Object.assign(new TypeError("fetch failed"), {