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

推荐订阅源

MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
小众软件
小众软件
F
Fortinet All Blogs
爱范儿
爱范儿
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
C
Check Point Blog
博客园 - 聂微东
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
宝玉的分享
宝玉的分享
Jina AI
Jina AI
H
Hackread – Cybersecurity News, Data Breaches, AI and 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): preserve boundary abort grace · openclaw/op...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -444,16 +444,51 @@ export function runNodeStep(label, args, timeoutMs, params = {}) {

444444

let settled = false;

445445

let canceled = false;

446446

let killTimer;

447+

let killDeadlineAt = 0;

447448

const stdoutWriter = createPrefixedOutputWriter(label, process.stdout);

448449

const stderrWriter = createPrefixedOutputWriter(label, process.stderr);

449450

const killNodeStep = (signal) => signalNodeStep(child, signal);

451+

const processGroupAlive = () => {

452+

if (process.platform === "win32" || !child.pid) {

453+

return false;

454+

}

455+

try {

456+

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

457+

return true;

458+

} catch (error) {

459+

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

460+

}

461+

};

462+

const waitForProcessGroupExit = async (waitMs) => {

463+

const deadlineAt = Date.now() + waitMs;

464+

while (Date.now() < deadlineAt) {

465+

if (!processGroupAlive()) {

466+

return true;

467+

}

468+

await new Promise((resolvePoll) => {

469+

setTimeout(resolvePoll, 25);

470+

});

471+

}

472+

return !processGroupAlive();

473+

};

474+

const waitForCanceledStepTeardown = async () => {

475+

const remainingGraceMs = Math.max(0, killDeadlineAt - Date.now());

476+

if (remainingGraceMs > 0) {

477+

await waitForProcessGroupExit(remainingGraceMs);

478+

}

479+

if (processGroupAlive()) {

480+

killNodeStep("SIGKILL");

481+

await waitForProcessGroupExit(100);

482+

}

483+

};

450484

ACTIVE_NODE_STEP_KILLERS.add(killNodeStep);

451485

const abortStep = () => {

452486

if (settled || canceled) {

453487

return;

454488

}

455489

canceled = true;

456490

killNodeStep("SIGTERM");

491+

killDeadlineAt = Date.now() + NODE_STEP_ABORT_KILL_GRACE_MS;

457492

killTimer = setTimeout(() => {

458493

killTimer = undefined;

459494

killNodeStep("SIGKILL");

@@ -508,27 +543,29 @@ export function runNodeStep(label, args, timeoutMs, params = {}) {

508543

if (settled) {

509544

return;

510545

}

511-

settled = true;

512-

stdoutWriter.flush();

513-

stderrWriter.flush();

514-

if (exitingAfterParentSignal) {

515-

killNodeStep("SIGKILL");

516-

cleanup();

517-

return;

518-

}

519-

if (canceled) {

520-

killNodeStep("SIGKILL");

546+

void (async () => {

547+

settled = true;

548+

stdoutWriter.flush();

549+

stderrWriter.flush();

550+

if (exitingAfterParentSignal) {

551+

killNodeStep("SIGKILL");

552+

cleanup();

553+

return;

554+

}

555+

if (canceled) {

556+

await waitForCanceledStepTeardown();

557+

cleanup();

558+

rejectPromise(new Error(`${label} canceled after sibling failure`));

559+

return;

560+

}

521561

cleanup();

522-

rejectPromise(new Error(`${label} canceled after sibling failure`));

523-

return;

524-

}

525-

cleanup();

526-

if (code === 0) {

527-

resolvePromise();

528-

return;

529-

}

530-

abortSiblingSteps(abortController);

531-

rejectPromise(new Error(`${label} failed with exit code ${code ?? 1}`));

562+

if (code === 0) {

563+

resolvePromise();

564+

return;

565+

}

566+

abortSiblingSteps(abortController);

567+

rejectPromise(new Error(`${label} failed with exit code ${code ?? 1}`));

568+

})();

532569

});

533570

});

534571

}

Original file line numberDiff line numberDiff line change

@@ -17,6 +17,7 @@ import {

1717

runNodeSteps,

1818

runNodeStepsInParallel,

1919

} from "../../scripts/prepare-extension-package-boundary-artifacts.mjs";

20+

import { makeTempDir } from "../helpers/temp-dir.js";

2021
2122

const tempRoots = new Set<string>();

2223

@@ -170,6 +171,49 @@ describe("prepare-extension-package-boundary-artifacts", () => {

170171

},

171172

);

172173
174+

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

175+

"lets aborted sibling descendants drain during kill grace",

176+

async () => {

177+

const rootDir = makeTempDir(tempRoots, "openclaw-boundary-abort-drain-");

178+

const readyPath = path.join(rootDir, "descendant.ready");

179+

const drainedPath = path.join(rootDir, "descendant.drained");

180+

const descendantScript = [

181+

"const fs = require('node:fs');",

182+

"process.on('SIGTERM', () => {",

183+

" setTimeout(() => {",

184+

` fs.writeFileSync(${JSON.stringify(drainedPath)}, 'drained');`,

185+

" process.exit(0);",

186+

" }, 50);",

187+

"});",

188+

`fs.writeFileSync(${JSON.stringify(readyPath)}, 'ready');`,

189+

"setInterval(() => {}, 1000);",

190+

].join("\n");

191+

const parentScript = [

192+

"const { spawn } = require('node:child_process');",

193+

`spawn(process.execPath, ["--eval", ${JSON.stringify(descendantScript)}], { stdio: "ignore" });`,

194+

"process.on('SIGTERM', () => process.exit(0));",

195+

"setInterval(() => {}, 1000);",

196+

].join("\n");

197+
198+

const command = runNodeStepsInParallel([

199+

{

200+

label: "delayed-fail",

201+

args: ["--eval", "setTimeout(() => process.exit(2), 150)"],

202+

timeoutMs: 5_000,

203+

},

204+

{

205+

label: "abort-group-drain",

206+

args: ["--eval", parentScript],

207+

timeoutMs: 60_000,

208+

},

209+

]);

210+
211+

await waitForFile(readyPath, 1_000);

212+

await expect(command).rejects.toThrow("delayed-fail failed with exit code 2");

213+

expect(fs.readFileSync(drainedPath, "utf8")).toBe("drained");

214+

},

215+

);

216+
173217

it("hard-kills timed out prep steps", async () => {

174218

const signals: Array<NodeJS.Signals | number | undefined> = [];

175219

const child = new EventEmitter() as EventEmitter & {