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

推荐订阅源

A
About on SuperTechFans
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
aimingoo的专栏
aimingoo的专栏
I
InfoQ
C
Check Point Blog
IT之家
IT之家
MyScale Blog
MyScale Blog
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
Last Week in AI
Last Week in AI
GbyAI
GbyAI
P
Proofpoint News Feed
量子位
Stack Overflow Blog
Stack Overflow Blog
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
B
Blog
T
The Blog of Author Tim Ferriss
H
Help Net Security
云风的 BLOG
云风的 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): wait for gateway child process groups · open...
vincentkoc · 2026-06-18 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -978,6 +978,47 @@ describe("buildQaRuntimeEnv", () => {

978978

expect([child.exitCode, child.signalCode]).not.toEqual([null, null]);

979979

});

980980
981+

it("does not trust an exited gateway wrapper while its process group is alive", async () => {

982+

const child = Object.assign(new EventEmitter(), {

983+

pid: 12346,

984+

exitCode: 0 as number | null,

985+

signalCode: null as string | null,

986+

kill: vi.fn(),

987+

});

988+

let sawForceKill = false;

989+

let postKillLivenessChecks = 0;

990+

const processKill = vi.spyOn(process, "kill").mockImplementation((_pid, signal) => {

991+

if (signal === "SIGKILL") {

992+

sawForceKill = true;

993+

return true;

994+

}

995+

if (signal === 0 && sawForceKill) {

996+

postKillLivenessChecks += 1;

997+

if (postKillLivenessChecks >= 2) {

998+

throw Object.assign(new Error("no such process"), { code: "ESRCH" });

999+

}

1000+

}

1001+

return true;

1002+

});

1003+
1004+

await testing.stopQaGatewayChildProcessTree(

1005+

child as unknown as Parameters<typeof testing.stopQaGatewayChildProcessTree>[0],

1006+

{

1007+

gracefulTimeoutMs: 1,

1008+

forceTimeoutMs: 50,

1009+

},

1010+

);

1011+
1012+

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

1013+

expect(child.kill).not.toHaveBeenCalled();

1014+

} else {

1015+

expect(processKill).toHaveBeenCalledWith(-12346, "SIGTERM");

1016+

expect(processKill).toHaveBeenCalledWith(-12346, "SIGKILL");

1017+

expect(postKillLivenessChecks).toBe(2);

1018+

expect(child.kill).not.toHaveBeenCalled();

1019+

}

1020+

});

1021+
9811022

it("treats bind collisions as retryable gateway startup errors", () => {

9821023

expect(

9831024

testing.isRetryableGatewayStartupError(

Original file line numberDiff line numberDiff line change

@@ -354,6 +354,28 @@ function hasChildExited(child: ChildProcess) {

354354

return child.exitCode !== null || child.signalCode !== null;

355355

}

356356
357+

function isProcessAlreadyExitedError(error: unknown): boolean {

358+

return (error as NodeJS.ErrnoException | undefined)?.code === "ESRCH";

359+

}

360+
361+

function isQaGatewayChildProcessTreeAlive(child: ChildProcess) {

362+

if (!child.pid) {

363+

return false;

364+

}

365+

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

366+

return !hasChildExited(child);

367+

}

368+

try {

369+

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

370+

return true;

371+

} catch (error) {

372+

if (isProcessAlreadyExitedError(error)) {

373+

return false;

374+

}

375+

return !hasChildExited(child);

376+

}

377+

}

378+
357379

function signalQaGatewayChildProcessTree(child: ChildProcess, signal: NodeJS.Signals) {

358380

if (!child.pid) {

359381

return;

@@ -374,22 +396,21 @@ function signalQaGatewayChildProcessTree(child: ChildProcess, signal: NodeJS.Sig

374396

}

375397
376398

async function waitForQaGatewayChildExit(child: ChildProcess, timeoutMs: number) {

377-

if (hasChildExited(child)) {

378-

return true;

399+

const deadline = Date.now() + timeoutMs;

400+

while (Date.now() <= deadline) {

401+

if (!isQaGatewayChildProcessTreeAlive(child)) {

402+

return true;

403+

}

404+

await sleep(Math.min(25, Math.max(0, deadline - Date.now())));

379405

}

380-

return await Promise.race([

381-

new Promise<boolean>((resolve) => {

382-

child.once("exit", () => resolve(true));

383-

}),

384-

sleep(timeoutMs).then(() => false),

385-

]);

406+

return !isQaGatewayChildProcessTreeAlive(child);

386407

}

387408
388409

async function stopQaGatewayChildProcessTree(

389410

child: ChildProcess,

390411

opts?: { gracefulTimeoutMs?: number; forceTimeoutMs?: number },

391412

) {

392-

if (hasChildExited(child)) {

413+

if (!isQaGatewayChildProcessTreeAlive(child)) {

393414

return;

394415

}

395416

signalQaGatewayChildProcessTree(child, "SIGTERM");