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

推荐订阅源

A
About on SuperTechFans
G
Google Developers Blog
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
小众软件
小众软件
月光博客
月光博客
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
P
Proofpoint News Feed
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
The Cloudflare Blog
博客园_首页
美团技术团队
大猫的无限游戏
大猫的无限游戏
B
Blog
IT之家
IT之家
Jina AI
Jina AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point 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): escalate e2e watchdog termination · openclaw/o...
vincentkoc · 2026-05-28 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -53,6 +53,17 @@ const child = spawn(command, args, {

5353

stdio: "inherit",

5454

});

5555

let timedOut = false;

56+

let parentSignal = null;

57+

let parentSignalTimer = null;

58+

const signalExitCodes = new Map([

59+

["SIGHUP", 129],

60+

["SIGINT", 130],

61+

["SIGTERM", 143],

62+

]);

63+

const killGraceMs = Number.parseInt(

64+

process.env.OPENCLAW_DOCKER_TIMEOUT_KILL_GRACE_MS || "30000",

65+

10,

66+

);

5667

const killTarget = process.platform === "win32" ? child.pid : -child.pid;

5768

const killChild = (signal) => {

5869

if (!child.pid) {

@@ -70,18 +81,35 @@ const timer = setTimeout(() => {

7081

timedOut = true;

7182

console.error(`Docker command timed out after ${timeoutValue}`);

7283

killChild("SIGTERM");

73-

setTimeout(() => killChild("SIGKILL"), 30_000).unref();

84+

setTimeout(() => killChild("SIGKILL"), killGraceMs).unref();

7485

}, timeoutMs);

7586

const forwardSignal = (signal) => {

87+

if (parentSignal) {

88+

killChild("SIGKILL");

89+

process.exit(signalExitCodes.get(signal) ?? 1);

90+

}

91+

parentSignal = signal;

92+

clearTimeout(timer);

7693

killChild(signal);

94+

parentSignalTimer = setTimeout(() => {

95+

killChild("SIGKILL");

96+

process.exit(signalExitCodes.get(signal) ?? 1);

97+

}, killGraceMs);

98+

parentSignalTimer.unref();

7799

};

78100

process.once("SIGINT", forwardSignal);

79101

process.once("SIGTERM", forwardSignal);

80102

child.on("exit", (code, signal) => {

81103

clearTimeout(timer);

104+

if (parentSignalTimer) {

105+

clearTimeout(parentSignalTimer);

106+

}

82107

if (timedOut) {

83108

process.exit(124);

84109

}

110+

if (parentSignal) {

111+

process.exit(signalExitCodes.get(parentSignal) ?? 1);

112+

}

85113

if (code !== null) {

86114

process.exit(code);

87115

}

Original file line numberDiff line numberDiff line change

@@ -91,6 +91,17 @@ const child = spawn(command, args, {

9191

stdio: "inherit",

9292

});

9393

let timedOut = false;

94+

let parentSignal = null;

95+

let parentSignalTimer = null;

96+

const signalExitCodes = new Map([

97+

["SIGHUP", 129],

98+

["SIGINT", 130],

99+

["SIGTERM", 143],

100+

]);

101+

const killGraceMs = Number.parseInt(

102+

process.env.OPENCLAW_E2E_TIMEOUT_KILL_GRACE_MS || "30000",

103+

10,

104+

);

94105

const killTarget = process.platform === "win32" ? child.pid : -child.pid;

95106

const killChild = (signal) => {

96107

if (!child.pid) {

@@ -108,18 +119,35 @@ const timer = setTimeout(() => {

108119

timedOut = true;

109120

console.error(`OpenClaw E2E command timed out after ${timeoutValue}`);

110121

killChild("SIGTERM");

111-

setTimeout(() => killChild("SIGKILL"), 30_000).unref();

122+

setTimeout(() => killChild("SIGKILL"), killGraceMs).unref();

112123

}, timeoutMs);

113124

const forwardSignal = (signal) => {

125+

if (parentSignal) {

126+

killChild("SIGKILL");

127+

process.exit(signalExitCodes.get(signal) ?? 1);

128+

}

129+

parentSignal = signal;

130+

clearTimeout(timer);

114131

killChild(signal);

132+

parentSignalTimer = setTimeout(() => {

133+

killChild("SIGKILL");

134+

process.exit(signalExitCodes.get(signal) ?? 1);

135+

}, killGraceMs);

136+

parentSignalTimer.unref();

115137

};

116138

process.once("SIGINT", forwardSignal);

117139

process.once("SIGTERM", forwardSignal);

118140

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

119141

clearTimeout(timer);

142+

if (parentSignalTimer) {

143+

clearTimeout(parentSignalTimer);

144+

}

120145

if (timedOut) {

121146

process.exit(124);

122147

}

148+

if (parentSignal) {

149+

process.exit(signalExitCodes.get(parentSignal) ?? 1);

150+

}

123151

if (code !== null) {

124152

process.exit(code);

125153

}

Original file line numberDiff line numberDiff line change

@@ -516,6 +516,68 @@ stderr="$(<"$TMPDIR/stderr")"

516516

}

517517

});

518518
519+

it("escalates Docker watchdog children that ignore parent termination", () => {

520+

const workDir = mkdtempSync(join(tmpdir(), "openclaw-docker-node-signal-"));

521+
522+

try {

523+

const binDir = join(workDir, "bin");

524+

mkdirSync(binDir);

525+

writeFileSync(

526+

join(binDir, "node"),

527+

`#!/bin/bash\nexec ${shellQuote(process.execPath)} "$@"\n`,

528+

);

529+

writeFileSync(

530+

join(binDir, "docker"),

531+

`#!/bin/bash

532+

printf "%s\\n" "$$" >"$TMPDIR/docker-pid"

533+

printf "%s\\n" "$PPID" >"$TMPDIR/watchdog-pid"

534+

trap "" TERM

535+

while true; do /bin/sleep 1; done

536+

`,

537+

);

538+

chmodSync(join(binDir, "node"), 0o755);

539+

chmodSync(join(binDir, "docker"), 0o755);

540+

const rootDir = process.cwd();

541+

const script = `

542+

set -euo pipefail

543+

ROOT_DIR=${shellQuote(rootDir)}

544+

TMPDIR=${shellQuote(workDir)}

545+

export ROOT_DIR TMPDIR

546+

export PATH="$TMPDIR/bin"

547+

export DOCKER_COMMAND_TIMEOUT=30s

548+

export OPENCLAW_DOCKER_TIMEOUT_KILL_GRACE_MS=100

549+
550+

source "$ROOT_DIR/scripts/lib/docker-e2e-container.sh"

551+
552+

docker_e2e_docker_cmd run demo &

553+

watchdog_pid="$!"

554+

for ((i = 0; i < 100; i += 1)); do

555+

[ -s "$TMPDIR/docker-pid" ] && [ -s "$TMPDIR/watchdog-pid" ] && break

556+

/bin/sleep 0.02

557+

done

558+

[ -s "$TMPDIR/docker-pid" ]

559+

[ -s "$TMPDIR/watchdog-pid" ]

560+

kill -TERM "$(/bin/cat "$TMPDIR/watchdog-pid")"

561+

set +e

562+

wait "$watchdog_pid"

563+

status="$?"

564+

set -e

565+

[ "$status" = "143" ]

566+

docker_pid="$(/bin/cat "$TMPDIR/docker-pid")"

567+

for ((i = 0; i < 100; i += 1)); do

568+

kill -0 "$docker_pid" 2>/dev/null || exit 0

569+

/bin/sleep 0.02

570+

done

571+

echo "docker child still alive after watchdog termination" >&2

572+

exit 1

573+

`;

574+
575+

execFileSync("bash", ["-lc", script], { encoding: "utf8" });

576+

} finally {

577+

rmSync(workDir, { recursive: true, force: true });

578+

}

579+

});

580+
519581

it("uses plain timeout when kill-after is unsupported", () => {

520582

const workDir = mkdtempSync(join(tmpdir(), "openclaw-docker-plain-timeout-"));

521583
Original file line numberDiff line numberDiff line change

@@ -378,6 +378,72 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {

378378

}

379379

});

380380
381+

it("escalates Node watchdog children that ignore parent termination", () => {

382+

const tempDir = fs.mkdtempSync(

383+

path.join(os.tmpdir(), "openclaw-e2e-instance-node-watchdog-signal-"),

384+

);

385+

try {

386+

writeNodeShim(tempDir);

387+

const childPath = path.join(tempDir, "ignore-term.cjs");

388+

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

389+

const watchdogPidPath = path.join(tempDir, "watchdog.pid");

390+

fs.writeFileSync(

391+

childPath,

392+

[

393+

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

394+

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

395+

"fs.writeFileSync(process.argv[3], String(process.ppid));",

396+

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

397+

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

398+

"",

399+

].join("\n"),

400+

);

401+
402+

const script = `

403+

set -euo pipefail

404+

source ${shellQuote(helperPath)}

405+

export OPENCLAW_E2E_TIMEOUT_KILL_GRACE_MS=100

406+

openclaw_e2e_maybe_timeout 30s node ${shellQuote(childPath)} ${shellQuote(pidPath)} ${shellQuote(watchdogPidPath)} &

407+

wrapper_pid="$!"

408+

for ((i = 0; i < 100; i += 1)); do

409+

[ -s ${shellQuote(pidPath)} ] && [ -s ${shellQuote(watchdogPidPath)} ] && break

410+

/bin/sleep 0.02

411+

done

412+

[ -s ${shellQuote(pidPath)} ]

413+

[ -s ${shellQuote(watchdogPidPath)} ]

414+

kill -TERM "$(/bin/cat ${shellQuote(watchdogPidPath)})"

415+

set +e

416+

wait "$wrapper_pid"

417+

status="$?"

418+

set -e

419+

[ "$status" = "143" ]

420+

child_pid="$(/bin/cat ${shellQuote(pidPath)})"

421+

for ((i = 0; i < 100; i += 1)); do

422+

kill -0 "$child_pid" 2>/dev/null || exit 0

423+

/bin/sleep 0.02

424+

done

425+

echo "child still alive after watchdog termination" >&2

426+

exit 1

427+

`;

428+
429+

const result = spawnSync(

430+

"/bin/bash",

431+

["-c", script],

432+

{

433+

encoding: "utf8",

434+

env: shellTestEnv({

435+

PATH: tempDir,

436+

}),

437+

timeout: 5_000,

438+

},

439+

);

440+
441+

expectShellSuccess(result);

442+

} finally {

443+

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

444+

}

445+

});

446+
381447

it("bounds HTTP readiness probes when a server accepts connections but never responds", () => {

382448

const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-http-probe-"));

383449

try {