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

推荐订阅源

N
Netflix TechBlog - Medium
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
博客园 - Franky
F
Fortinet All Blogs
D
Docker
博客园 - 司徒正美
腾讯CDC
Recent Announcements
Recent Announcements
The Cloudflare Blog
B
Blog RSS Feed
GbyAI
GbyAI
T
Tailwind CSS Blog
雷峰网
雷峰网
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志

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(xiaomi): cap tts request timeouts · openclaw/openclaw...
steipete · 2026-05-30 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -8,6 +8,8 @@ vi.mock("openclaw/plugin-sdk/media-runtime", () => ({

88
99

import { buildXiaomiSpeechProvider } from "./speech-provider.js";

1010
11+

const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;

12+
1113

describe("buildXiaomiSpeechProvider", () => {

1214

const provider = buildXiaomiSpeechProvider();

1315

@@ -208,6 +210,37 @@ describe("buildXiaomiSpeechProvider", () => {

208210

});

209211

});

210212
213+

it("caps oversized TTS request timeouts before scheduling or fetching", async () => {

214+

const audio = Buffer.from("fake-mp3-audio").toString("base64");

215+

const timeoutSpy = vi

216+

.spyOn(globalThis, "setTimeout")

217+

.mockImplementation((() => 1) as typeof setTimeout);

218+

const clearTimeoutSpy = vi

219+

.spyOn(globalThis, "clearTimeout")

220+

.mockImplementation(() => undefined);

221+

vi.mocked(globalThis.fetch).mockResolvedValueOnce(

222+

new Response(JSON.stringify({ choices: [{ message: { audio: { data: audio } } }] }), {

223+

status: 200,

224+

headers: { "Content-Type": "application/json" },

225+

}),

226+

);

227+
228+

try {

229+

await provider.synthesize({

230+

text: "Hello from OpenClaw.",

231+

cfg: {} as never,

232+

providerConfig: { apiKey: "sk-test" },

233+

target: "audio-file",

234+

timeoutMs: MAX_TIMER_TIMEOUT_MS + 1_000_000,

235+

});

236+
237+

expect(timeoutSpy).toHaveBeenCalledWith(expect.any(Function), MAX_TIMER_TIMEOUT_MS);

238+

} finally {

239+

timeoutSpy.mockRestore();

240+

clearTimeoutSpy.mockRestore();

241+

}

242+

});

243+
211244

it("throws when API key is missing", async () => {

212245

const savedKey = process.env.XIAOMI_API_KEY;

213246

delete process.env.XIAOMI_API_KEY;

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,5 @@

11

import { transcodeAudioBufferToOpus } from "openclaw/plugin-sdk/media-runtime";

2+

import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";

23

import { assertOkOrThrowProviderError } from "openclaw/plugin-sdk/provider-http";

34

import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";

45

import type {

@@ -205,8 +206,9 @@ async function xiaomiTTS(params: {

205206

timeoutMs: number;

206207

}): Promise<Buffer> {

207208

const { text, apiKey, baseUrl, model, voice, format, style, timeoutMs } = params;

209+

const requestTimeoutMs = resolveTimerTimeoutMs(timeoutMs, 1);

208210

const controller = new AbortController();

209-

const timeout = setTimeout(() => controller.abort(), timeoutMs);

211+

const timeout = setTimeout(() => controller.abort(), requestTimeoutMs);

210212
211213

try {

212214

const { response, release } = await fetchWithSsrFGuard({

@@ -224,7 +226,7 @@ async function xiaomiTTS(params: {

224226

}),

225227

signal: controller.signal,

226228

},

227-

timeoutMs,

229+

timeoutMs: requestTimeoutMs,

228230

policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(baseUrl),

229231

auditContext: "xiaomi.tts",

230232

});