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

推荐订阅源

V
V2EX
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
博客园 - 【当耐特】
月光博客
月光博客
C
Check Point Blog
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
美团技术团队
N
Netflix TechBlog - Medium
Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
L
LangChain Blog
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(qa-lab): keep lifecycle probe timeout trees tracked ·...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main
11

// Plugin Lifecycle Probe tests cover QA Lab plugin lifecycle evidence.

22

import { EventEmitter } from "node:events";

3-

import { mkdirSync, writeFileSync } from "node:fs";

3+

import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";

44

import path from "node:path";

55

import { afterEach, describe, expect, it, vi } from "vitest";

66

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

@@ -17,6 +17,32 @@ function makeTempDir(): string {

1717

return tempDirs.make("openclaw-plugin-lifecycle-probe-");

1818

}

191920+

function isProcessRunning(pid: number): boolean {

21+

try {

22+

process.kill(pid, 0);

23+

return true;

24+

} catch {

25+

return false;

26+

}

27+

}

28+29+

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

30+

await new Promise((resolve) => {

31+

setTimeout(resolve, ms);

32+

});

33+

}

34+35+

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

36+

const deadline = Date.now() + timeoutMs;

37+

while (Date.now() < deadline) {

38+

if (existsSync(pathToCheck)) {

39+

return;

40+

}

41+

await sleep(25);

42+

}

43+

throw new Error(`Timed out waiting for ${pathToCheck}`);

44+

}

45+2046

class FakeCommandChild extends EventEmitter {

2147

readonly signals: string[] = [];

2248

@@ -109,4 +135,47 @@ describe("plugin lifecycle matrix probe", () => {

109135

vi.useRealTimers();

110136

}

111137

});

138+139+

it("keeps fallback SIGKILL armed for ignored-stdio descendants", async () => {

140+

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

141+

return;

142+

}

143+144+

const dir = makeTempDir();

145+

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

146+

let descendantPid: number | undefined;

147+

try {

148+

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

149+

const parentScript = [

150+

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

151+

"import { writeFileSync } from 'node:fs';",

152+

`const child = spawn(process.execPath, ['-e', ${JSON.stringify(childScript)}], { stdio: 'ignore' });`,

153+

"child.unref();",

154+

"writeFileSync(process.env.OPENCLAW_TEST_DESCENDANT_PID, String(child.pid));",

155+

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

156+

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

157+

].join("\n");

158+159+

const run = probeTesting.runCommand(

160+

process.execPath,

161+

["--input-type=module", "-e", parentScript],

162+

{

163+

env: { ...process.env, OPENCLAW_TEST_DESCENDANT_PID: descendantPidPath },

164+

timeoutKillGraceMs: 250,

165+

timeoutMs: 500,

166+

},

167+

);

168+

await waitForFile(descendantPidPath, 2_000);

169+

await sleep(300);

170+171+

await expect(run).rejects.toThrow(/timed out after 500ms/u);

172+173+

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

174+

expect(isProcessRunning(descendantPid)).toBe(false);

175+

} finally {

176+

if (descendantPid && isProcessRunning(descendantPid)) {

177+

process.kill(descendantPid, "SIGKILL");

178+

}

179+

}

180+

});

112181

});