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

推荐订阅源

L
LangChain Blog
S
SegmentFault 最新的问题
V
Visual Studio Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
美团技术团队
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
有赞技术团队
有赞技术团队
量子位
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
博客园 - 叶小钗
月光博客
月光博客
P
Proofpoint News Feed
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow 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(test-report): clean parent-signaled child trees · ope...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main
11

// Test Group Report tests cover test group report script behavior.

2-

import { spawnSync } from "node:child_process";

2+

import { spawn, spawnSync } from "node:child_process";

33

import fs from "node:fs";

44

import os from "node:os";

55

import path from "node:path";

@@ -64,6 +64,21 @@ async function waitForDead(pid: number, timeoutMs: number): Promise<void> {

6464

throw new Error(`timed out waiting for pid ${pid} to exit`);

6565

}

666667+

function waitForChildClose(

68+

child: ReturnType<typeof spawn>,

69+

timeoutMs = 5_000,

70+

): Promise<{ code: number | null; signal: NodeJS.Signals | null }> {

71+

return new Promise((resolve, reject) => {

72+

const timeout = setTimeout(() => {

73+

reject(new Error("child did not close before timeout"));

74+

}, timeoutMs);

75+

child.once("close", (code, signal) => {

76+

clearTimeout(timeout);

77+

resolve({ code, signal });

78+

});

79+

});

80+

}

81+6782

function writeGroupedReport(filePath: string) {

6883

fs.writeFileSync(

6984

filePath,

@@ -723,6 +738,67 @@ describe("scripts/test-group-report child process guard", () => {

723738

}

724739

});

725740741+

it("cleans process-group descendants before forwarding parent SIGTERM", async () => {

742+

if (process.platform === "win32") {

743+

return;

744+

}

745+746+

const tempDir = makeTempDir();

747+

const childPidPath = path.join(tempDir, "child.pid");

748+

const readyPath = path.join(tempDir, "child.ready");

749+

const reportModuleUrl = pathToFileURL(path.resolve("scripts/test-group-report.mjs")).href;

750+

let childPid: number | undefined;

751+

let runner: ReturnType<typeof spawn> | undefined;

752+

try {

753+

const childScript = [

754+

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

755+

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

756+

`fs.writeFileSync(${JSON.stringify(childPidPath)}, String(process.pid));`,

757+

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

758+

].join("\n");

759+

const parentScript = [

760+

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

761+

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

762+

`require("node:fs").writeFileSync(${JSON.stringify(readyPath)}, "ready");`,

763+

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

764+

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

765+

].join("\n");

766+

const runnerScript = [

767+

`import { spawnText } from ${JSON.stringify(reportModuleUrl)};`,

768+

"await spawnText(",

769+

" process.execPath,",

770+

` ["--eval", ${JSON.stringify(parentScript)}],`,

771+

" { cwd: process.cwd(), env: process.env, killGraceMs: 5_000, timeoutMs: 60_000 },",

772+

");",

773+

].join("\n");

774+775+

runner = spawn(process.execPath, ["--input-type=module", "--eval", runnerScript], {

776+

cwd: process.cwd(),

777+

stdio: ["ignore", "ignore", "pipe"],

778+

});

779+

await waitForFile(readyPath, 2_000);

780+

await waitForFile(childPidPath, 2_000);

781+

childPid = Number.parseInt(fs.readFileSync(childPidPath, "utf8"), 10);

782+

expect(isProcessAlive(childPid)).toBe(true);

783+784+

runner.kill("SIGTERM");

785+786+

await expect(waitForChildClose(runner)).resolves.toEqual({

787+

code: null,

788+

signal: "SIGTERM",

789+

});

790+

await waitForDead(childPid, 2_000);

791+

} finally {

792+

if (runner?.pid && isProcessAlive(runner.pid)) {

793+

runner.kill("SIGKILL");

794+

}

795+

if (childPid !== undefined && isProcessAlive(childPid)) {

796+

process.kill(childPid, "SIGKILL");

797+

}

798+

fs.rmSync(tempDir, { recursive: true, force: true });

799+

}

800+

});

801+726802

it("finishes promptly when timed process-group descendants exit cleanly", async () => {

727803

if (process.platform === "win32") {

728804

return;