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

推荐订阅源

WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
月光博客
月光博客
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
U
Unit 42
腾讯CDC
爱范儿
爱范儿
J
Java Code Geeks
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
B
Blog
Stack Overflow Blog
Stack Overflow Blog
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
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(test): finish group report timeout cleanup promptly ·...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -36,6 +36,34 @@ function isProcessAlive(pid: number): boolean {

3636

}

3737

}

383839+

async function sleep(ms: number): Promise<void> {

40+

await new Promise((resolve) => {

41+

setTimeout(resolve, ms);

42+

});

43+

}

44+45+

async function waitForFile(filePath: string, timeoutMs: number): Promise<void> {

46+

const deadlineAt = Date.now() + timeoutMs;

47+

while (Date.now() < deadlineAt) {

48+

if (fs.existsSync(filePath)) {

49+

return;

50+

}

51+

await sleep(25);

52+

}

53+

throw new Error(`timed out waiting for ${filePath}`);

54+

}

55+56+

async function waitForDead(pid: number, timeoutMs: number): Promise<void> {

57+

const deadlineAt = Date.now() + timeoutMs;

58+

while (Date.now() < deadlineAt) {

59+

if (!isProcessAlive(pid)) {

60+

return;

61+

}

62+

await sleep(25);

63+

}

64+

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

65+

}

66+3967

function writeGroupedReport(filePath: string) {

4068

fs.writeFileSync(

4169

filePath,

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

695723

}

696724

});

697725726+

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

727+

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

728+

return;

729+

}

730+731+

const tempDir = makeTempDir();

732+

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

733+

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

734+

const cleanupPath = path.join(tempDir, "child.cleanup");

735+

let childPid: number | undefined;

736+

try {

737+

const childScript = [

738+

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

739+

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

740+

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

741+

" setTimeout(() => {",

742+

` fs.writeFileSync(${JSON.stringify(cleanupPath)}, "clean");`,

743+

" process.exit(0);",

744+

" }, 75);",

745+

"});",

746+

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

747+

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

748+

].join("\n");

749+

const parentScript = [

750+

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

751+

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

752+

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

753+

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

754+

].join("\n");

755+756+

const startedAt = Date.now();

757+

const runPromise = spawnText(process.execPath, ["--eval", parentScript], {

758+

cwd: process.cwd(),

759+

env: process.env,

760+

killGraceMs: 1_000,

761+

timeoutMs: 1_000,

762+

});

763+764+

await waitForFile(readyPath, 2_000);

765+

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

766+

const result = await runPromise;

767+768+

expect(result).toMatchObject({

769+

status: 1,

770+

signal: null,

771+

timedOut: true,

772+

});

773+

expect(fs.readFileSync(cleanupPath, "utf8")).toBe("clean");

774+

expect(Date.now() - startedAt).toBeLessThan(1_700);

775+

await waitForDead(childPid, 2_000);

776+

} finally {

777+

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

778+

process.kill(childPid, "SIGKILL");

779+

}

780+

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

781+

}

782+

});

783+698784

it("streams large child output to a log path without retaining it", async () => {

699785

const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-test-group-report-log-"));

700786

const logPath = path.join(tempDir, "child.log");