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

推荐订阅源

博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
腾讯CDC
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
Engineering at Meta
Engineering at Meta
博客园_首页
B
Blog RSS Feed
D
Docker
M
MIT News - Artificial intelligence
爱范儿
爱范儿
I
InfoQ

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(check): clean managed child groups after forwarded si...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -140,70 +140,89 @@ describe("managed-child-process", () => {

140140

}

141141

});

142142143-

posixIt("kills the managed child process group when the runner is terminated", async () => {

144-

const dir = createTempDir("openclaw-managed-child-");

145-

const childPath = path.join(dir, "child.mjs");

146-

const runnerPath = path.join(dir, "runner.mjs");

147-

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

148-

const runnerReadyPath = path.join(dir, "runner.ready");

149-

const helperUrl = pathToFileURL(path.resolve("scripts/lib/managed-child-process.mjs")).href;

150-151-

fs.writeFileSync(

152-

childPath,

153-

`

154-

import fs from "node:fs";

155-156-

fs.writeFileSync(process.argv[2], String(process.pid));

157-

for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {

158-

process.on(signal, () => process.exit(0));

159-

}

143+

posixIt(

144+

"kills managed child process group descendants when the runner is terminated",

145+

async () => {

146+

const dir = createTempDir("openclaw-managed-child-");

147+

const childPath = path.join(dir, "child.mjs");

148+

const runnerPath = path.join(dir, "runner.mjs");

149+

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

150+

const descendantPidPath = path.join(dir, "descendant.pid");

151+

const runnerReadyPath = path.join(dir, "runner.ready");

152+

const helperUrl = pathToFileURL(path.resolve("scripts/lib/managed-child-process.mjs")).href;

153+154+

fs.writeFileSync(

155+

childPath,

156+

`

157+

import { spawn } from "node:child_process";

158+

import fs from "node:fs";

159+160+

const descendant = spawn(process.execPath, [

161+

"-e",

162+

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

163+

], { stdio: "ignore" });

164+

fs.writeFileSync(process.argv[2], String(process.pid));

165+

fs.writeFileSync(process.argv[3], String(descendant.pid));

166+

for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {

167+

process.on(signal, () => process.exit(0));

168+

}

160169

setInterval(() => {}, 1_000);

161170

`,

162-

"utf8",

163-

);

164-

fs.writeFileSync(

165-

runnerPath,

166-

`

171+

"utf8",

172+

);

173+

fs.writeFileSync(

174+

runnerPath,

175+

`

167176

import fs from "node:fs";

168177

import { runManagedCommand } from ${JSON.stringify(helperUrl)};

169178170-

process.exitCode = await runManagedCommand({

171-

bin: process.execPath,

172-

args: [${JSON.stringify(childPath)}, ${JSON.stringify(childPidPath)}],

173-

stdio: "ignore",

174-

onReady: () => fs.writeFileSync(${JSON.stringify(runnerReadyPath)}, "1"),

175-

});

179+

process.exitCode = await runManagedCommand({

180+

bin: process.execPath,

181+

args: [${JSON.stringify(childPath)}, ${JSON.stringify(childPidPath)}, ${JSON.stringify(descendantPidPath)}],

182+

stdio: "ignore",

183+

onReady: () => fs.writeFileSync(${JSON.stringify(runnerReadyPath)}, "1"),

184+

});

176185

`,

177-

"utf8",

178-

);

179-180-

const runner = spawn(process.execPath, [runnerPath], {

181-

stdio: "ignore",

182-

});

183-

const runnerPid = expectProcessPid(runner.pid);

184-

let childPid = 0;

186+

"utf8",

187+

);

185188186-

try {

187-

await waitFor(() => fs.existsSync(runnerReadyPath));

188-

await waitFor(() => fs.existsSync(childPidPath));

189-

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

190-

expect(Number.isInteger(childPid)).toBe(true);

191-

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

192-193-

process.kill(runnerPid, "SIGTERM");

194-

const result = await waitForClose(runner);

195-196-

expect(result).toEqual({ code: 143, signal: null });

197-

await waitFor(() => !isProcessAlive(childPid), 1_500);

198-

} finally {

199-

if (isProcessAlive(runnerPid)) {

200-

process.kill(runnerPid, "SIGKILL");

201-

}

202-

if (childPid && isProcessAlive(childPid)) {

203-

process.kill(childPid, "SIGKILL");

189+

const runner = spawn(process.execPath, [runnerPath], {

190+

stdio: "ignore",

191+

});

192+

const runnerPid = expectProcessPid(runner.pid);

193+

let childPid = 0;

194+

let descendantPid = 0;

195+196+

try {

197+

await waitFor(() => fs.existsSync(runnerReadyPath));

198+

await waitFor(() => fs.existsSync(childPidPath));

199+

await waitFor(() => fs.existsSync(descendantPidPath));

200+

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

201+

descendantPid = Number(fs.readFileSync(descendantPidPath, "utf8"));

202+

expect(Number.isInteger(childPid)).toBe(true);

203+

expect(Number.isInteger(descendantPid)).toBe(true);

204+

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

205+

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

206+207+

process.kill(runnerPid, "SIGTERM");

208+

const result = await waitForClose(runner);

209+210+

expect(result).toEqual({ code: 143, signal: null });

211+

await waitFor(() => !isProcessAlive(childPid), 1_500);

212+

await waitFor(() => !isProcessAlive(descendantPid), 1_500);

213+

} finally {

214+

if (isProcessAlive(runnerPid)) {

215+

process.kill(runnerPid, "SIGKILL");

216+

}

217+

if (childPid && isProcessAlive(childPid)) {

218+

process.kill(childPid, "SIGKILL");

219+

}

220+

if (descendantPid && isProcessAlive(descendantPid)) {

221+

process.kill(descendantPid, "SIGKILL");

222+

}

204223

}

205-

}

206-

});

224+

},

225+

);

207226

});

208227209228

async function waitFor(condition: () => boolean, timeoutMs = 3_000) {