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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
IT之家
IT之家
Google DeepMind News
Google DeepMind News
D
Docker
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 【当耐特】
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
月光博客
月光博客
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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 gauntlet command timers · openclaw/op...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -36,6 +36,7 @@ const DEFAULT_HOT_WALL_WARN_MS = 30_000;

3636

const DEFAULT_MAX_RSS_WARN_MB = 1536;

3737

const DEFAULT_QA_PLUGIN_CHUNK_SIZE = 12;

3838

const COMMAND_OUTPUT_MAX_BUFFER_BYTES = 16 * 1024 * 1024;

39+

const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;

3940

const ANSI_PATTERN = new RegExp(String.raw`\u001B\[[0-9;]*m`, "gu");

4041
4142

/**

@@ -439,6 +440,15 @@ function stripAnsi(value) {

439440

return value.replace(ANSI_PATTERN, "");

440441

}

441442
443+

function resolveTimerTimeoutMs(valueMs) {

444+

const value = Number.isFinite(valueMs) ? Math.floor(valueMs) : MAX_TIMER_TIMEOUT_MS;

445+

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

446+

}

447+
448+

function resolveOptionalTimerTimeoutMs(valueMs) {

449+

return valueMs === undefined || valueMs <= 0 ? null : resolveTimerTimeoutMs(valueMs);

450+

}

451+
442452

function writeCommandLog(params) {

443453

const { logDir, label, stdout, stderr } = params;

444454

fs.mkdirSync(logDir, { recursive: true });

@@ -487,7 +497,8 @@ export function runMeasuredCommandLive(params) {

487497

let parentTerminationSignal = null;

488498

const maxBufferBytes = params.maxBufferBytes ?? COMMAND_OUTPUT_MAX_BUFFER_BYTES;

489499

const maxRelayBytes = params.consoleOutputMaxBytes ?? maxBufferBytes;

490-

const timeoutKillGraceMs = params.timeoutKillGraceMs ?? 5_000;

500+

const timeoutMs = resolveOptionalTimerTimeoutMs(params.timeoutMs);

501+

const timeoutKillGraceMs = resolveTimerTimeoutMs(params.timeoutKillGraceMs ?? 5_000);

491502

const spawnOptions = mode === "none" ? (params.spawnOptions ?? {}) : {};

492503

const useProcessGroup =

493504

process.platform !== "win32" &&

@@ -519,8 +530,8 @@ export function runMeasuredCommandLive(params) {

519530

return Boolean(error && error.code === "EPERM");

520531

}

521532

};

522-

const waitForProcessGroupExit = async (timeoutMs) => {

523-

const deadlineAt = Date.now() + timeoutMs;

533+

const waitForProcessGroupExit = async (timeoutBudgetMs) => {

534+

const deadlineAt = Date.now() + timeoutBudgetMs;

524535

while (Date.now() < deadlineAt) {

525536

if (!processGroupAlive()) {

526537

return true;

@@ -641,16 +652,16 @@ export function runMeasuredCommandLive(params) {

641652

child.stdout?.on("data", (chunk) => appendOutput("stdout", chunk));

642653

child.stderr?.on("data", (chunk) => appendOutput("stderr", chunk));

643654

const timeout =

644-

params.timeoutMs > 0

655+

timeoutMs !== null

645656

? setTimeout(() => {

646657

timedOut = true;

647658

spawnError = {

648659

code: "ETIMEDOUT",

649-

message: `Command timed out after ${params.timeoutMs}ms`,

660+

message: `Command timed out after ${timeoutMs}ms`,

650661

};

651662

killMeasuredProcess();

652663

scheduleForceKill();

653-

}, params.timeoutMs)

664+

}, timeoutMs)

654665

: null;

655666

timeout?.unref?.();

656667

const finish = (status, signal) => {

Original file line numberDiff line numberDiff line change

@@ -5,6 +5,7 @@ import os from "node:os";

55

import path from "node:path";

66

import { setTimeout as delay } from "node:timers/promises";

77

import { pathToFileURL } from "node:url";

8+

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

89

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

910

import {

1011

buildObservationGuardFailures,

@@ -581,6 +582,26 @@ describe("plugin gateway gauntlet helpers", () => {

581582

await expect(fs.readFile(row.logPath, "utf8")).resolves.toContain("[spawn error] ENOENT");

582583

});

583584
585+

it("clamps oversized measured command timers before scheduling", async () => {

586+

const logDir = path.join(repoRoot, "logs");

587+

const row = await runMeasuredCommandLive({

588+

cwd: repoRoot,

589+

env: process.env,

590+

logDir,

591+

command: process.execPath,

592+

args: ["-e", "setTimeout(() => process.exit(0), 25)"],

593+

label: "oversized-timeout",

594+

phase: "probe",

595+

timeoutKillGraceMs: MAX_TIMER_TIMEOUT_MS + 1,

596+

timeoutMs: MAX_TIMER_TIMEOUT_MS + 1,

597+

timeMode: "none",

598+

});

599+
600+

expect(row.status).toBe(0);

601+

expect(row.timedOut).toBe(false);

602+

await expect(fs.readFile(row.logPath, "utf8")).resolves.not.toContain("ETIMEDOUT");

603+

});

604+
584605

it.runIf(process.platform !== "win32")(

585606

"kills timed-out measured command process groups when the leader exits first",

586607

async () => {