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

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

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(scripts): clamp audit request timer · openclaw/opencl...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -14,6 +14,7 @@ const MIN_SEVERITY = "high";

1414

export const BULK_ADVISORY_ERROR_BODY_MAX_CHARS = 4096;

1515

export const BULK_ADVISORY_RESPONSE_BODY_MAX_BYTES = 8 * 1024 * 1024;

1616

export const BULK_ADVISORY_REQUEST_TIMEOUT_MS = 60_000;

17+

const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;

1718

const SEVERITY_RANK = {

1819

info: 0,

1920

low: 1,

@@ -695,9 +696,11 @@ function parsePositiveIntegerEnv(name, fallback) {

695696

}

696697
697698

function resolveBulkAdvisoryRequestTimeoutMs() {

698-

return parsePositiveIntegerEnv(

699-

"OPENCLAW_PNPM_AUDIT_BULK_TIMEOUT_MS",

700-

BULK_ADVISORY_REQUEST_TIMEOUT_MS,

699+

return clampTimerTimeoutMs(

700+

parsePositiveIntegerEnv(

701+

"OPENCLAW_PNPM_AUDIT_BULK_TIMEOUT_MS",

702+

BULK_ADVISORY_REQUEST_TIMEOUT_MS,

703+

),

701704

);

702705

}

703706

@@ -708,15 +711,21 @@ function resolveBulkAdvisoryResponseBodyMaxBytes() {

708711

);

709712

}

710713
714+

function clampTimerTimeoutMs(valueMs) {

715+

const value = Number.isFinite(valueMs) ? valueMs : BULK_ADVISORY_REQUEST_TIMEOUT_MS;

716+

return Math.min(Math.max(Math.floor(value), 1), MAX_TIMER_TIMEOUT_MS);

717+

}

718+
711719

async function withBulkAdvisoryTimeout({ label, timeoutMs, run }) {

720+

const resolvedTimeoutMs = clampTimerTimeoutMs(timeoutMs);

712721

const controller = new AbortController();

713722

let timeout;

714723

const timeoutPromise = new Promise((_resolve, reject) => {

715724

timeout = setTimeout(() => {

716-

const error = new Error(`${label} exceeded timeout of ${timeoutMs}ms`);

725+

const error = new Error(`${label} exceeded timeout of ${resolvedTimeoutMs}ms`);

717726

controller.abort(error);

718727

reject(error);

719-

}, timeoutMs);

728+

}, resolvedTimeoutMs);

720729

});

721730

try {

722731

return await Promise.race([run({ signal: controller.signal, timeoutPromise }), timeoutPromise]);

Original file line numberDiff line numberDiff line change

@@ -2,6 +2,7 @@

22

import { mkdtemp, rm, writeFile } from "node:fs/promises";

33

import { tmpdir } from "node:os";

44

import path from "node:path";

5+

import { MAX_TIMER_TIMEOUT_MS } from "@openclaw/normalization-core/number-coercion";

56

import { describe, expect, it } from "vitest";

67

import {

78

collectProdResolvedPackagesFromLockfile,

@@ -274,6 +275,32 @@ snapshots:

274275

expect(signal?.aborted).toBe(true);

275276

});

276277
278+

it("clamps oversized bulk advisory request timers before scheduling", async () => {

279+

let signal: AbortSignal | undefined;

280+

const request = fetchBulkAdvisories({

281+

payload: { axios: ["1.0.0"] },

282+

timeoutMs: MAX_TIMER_TIMEOUT_MS + 1,

283+

fetchImpl: (async (_url, init) => {

284+

signal = init?.signal ?? undefined;

285+

await new Promise<void>((resolve, reject) => {

286+

const timer = setTimeout(resolve, 25);

287+

signal?.addEventListener(

288+

"abort",

289+

() => {

290+

clearTimeout(timer);

291+

reject(new Error("aborted"));

292+

},

293+

{ once: true },

294+

);

295+

});

296+

return new Response("{}", { status: 200 });

297+

}) as typeof fetch,

298+

});

299+
300+

await expect(request).resolves.toEqual({});

301+

expect(signal?.aborted).toBe(false);

302+

});

303+
277304

it("cancels stalled successful bulk advisory response bodies on request timeout", async () => {

278305

let cancelled = false;

279306

const body = new ReadableStream({