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

推荐订阅源

IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
小众软件
小众软件
F
Fortinet All Blogs
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
J
Java Code Geeks
WordPress大学
WordPress大学
The Cloudflare 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(release): finish candidate timeout cleanup promptly ·...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -24,6 +24,7 @@ export const ARTIFACT_TARBALL_SCAN_MAX_ENTRIES = 10_000;

2424

const COMMAND_STDOUT_CAPTURE_MAX_CHARS = 8 * 1024 * 1024;

2525

const COMMAND_STDERR_CAPTURE_MAX_CHARS = 128 * 1024;

2626

const COMMAND_TIMEOUT_KILL_AFTER_MS = 5_000;

27+

const COMMAND_PROCESS_TREE_EXIT_POLL_MS = 50;

2728

const ACTIVE_CHILD_KILLERS = new Set();

2829

const SIGNAL_EXIT_CODES = {

2930

SIGHUP: 129,

@@ -195,7 +196,7 @@ function run(command, args, options = {}) {

195196

});

196197

let timedOut = false;

197198

let killTimer;

198-

let timeoutReject;

199+

let forceKillAt;

199200

const killChild = (signal) => {

200201

if (useProcessGroup && child.pid) {

201202

try {

@@ -209,11 +210,13 @@ function run(command, args, options = {}) {

209210

};

210211

const terminateChild = () => {

211212

killChild("SIGTERM");

213+

const killAfterMs = options.killAfterMs ?? COMMAND_TIMEOUT_KILL_AFTER_MS;

214+

forceKillAt = Date.now() + killAfterMs;

212215

killTimer = setTimeout(() => {

213216

killTimer = undefined;

217+

forceKillAt = undefined;

214218

killChild("SIGKILL");

215-

timeoutReject?.();

216-

}, options.killAfterMs ?? COMMAND_TIMEOUT_KILL_AFTER_MS);

219+

}, killAfterMs);

217220

};

218221

const timeout =

219222

options.timeoutMs === undefined

@@ -244,6 +247,7 @@ function run(command, args, options = {}) {

244247

}

245248

if (killTimer && !timedOut) {

246249

clearTimeout(killTimer);

250+

forceKillAt = undefined;

247251

}

248252

ACTIVE_CHILD_KILLERS.delete(killChild);

249253

if (

@@ -261,7 +265,13 @@ function run(command, args, options = {}) {

261265

`${command} ${args.join(" ")} timed out after ${options.timeoutMs}ms`,

262266

);

263267

if (killTimer) {

264-

timeoutReject = () => reject(timeoutError);

268+

void finishTimedOutProcessTree(child, {

269+

forceKillAt,

270+

killChild,

271+

killTimer,

272+

killAfterMs: options.killAfterMs ?? COMMAND_TIMEOUT_KILL_AFTER_MS,

273+

useProcessGroup,

274+

}).then(() => reject(timeoutError), reject);

265275

return;

266276

}

267277

reject(timeoutError);

@@ -286,6 +296,54 @@ function run(command, args, options = {}) {

286296

});

287297

}

288298299+

async function finishTimedOutProcessTree(

300+

child,

301+

{ forceKillAt, killAfterMs, killChild, killTimer, useProcessGroup },

302+

) {

303+

const graceRemainingMs =

304+

forceKillAt === undefined ? killAfterMs : Math.max(0, forceKillAt - Date.now());

305+

if (graceRemainingMs > 0) {

306+

await waitForProcessTreeExit(child, graceRemainingMs, useProcessGroup);

307+

}

308+

clearTimeout(killTimer);

309+

if (processTreeIsAlive(child, useProcessGroup)) {

310+

killChild("SIGKILL");

311+

await waitForProcessTreeExit(child, killAfterMs, useProcessGroup);

312+

}

313+

}

314+315+

function childHasExited(child) {

316+

return child.exitCode !== null || child.signalCode !== null;

317+

}

318+319+

function processTreeIsAlive(child, useProcessGroup) {

320+

if (!child || typeof child.pid !== "number") {

321+

return false;

322+

}

323+

if (!useProcessGroup) {

324+

return !childHasExited(child);

325+

}

326+

try {

327+

process.kill(-child.pid, 0);

328+

return true;

329+

} catch (error) {

330+

return error?.code === "EPERM";

331+

}

332+

}

333+334+

async function waitForProcessTreeExit(child, timeoutMs, useProcessGroup) {

335+

const deadlineAt = Date.now() + timeoutMs;

336+

while (Date.now() < deadlineAt) {

337+

if (!processTreeIsAlive(child, useProcessGroup)) {

338+

return true;

339+

}

340+

await new Promise((resolvePoll) => {

341+

setTimeout(resolvePoll, COMMAND_PROCESS_TREE_EXIT_POLL_MS);

342+

});

343+

}

344+

return !processTreeIsAlive(child, useProcessGroup);

345+

}

346+289347

function appendBoundedCommandOutput(buffer, chunk, maxChars) {

290348

const nextText = buffer.text + String(chunk);

291349

if (nextText.length <= maxChars) {