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

推荐订阅源

G
Google Developers Blog
宝玉的分享
宝玉的分享
月光博客
月光博客
B
Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
博客园_首页
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
A
About on SuperTechFans
Y
Y Combinator Blog
L
LangChain Blog
有赞技术团队
有赞技术团队
D
Docker
爱范儿
爱范儿
博客园 - 司徒正美
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net

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(run-node): clean child groups on forwarded signals · ...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -42,6 +42,7 @@ const buildScript = "scripts/tsdown-build.mjs";

4242

const bundledPluginAssetsScript = "scripts/bundled-plugin-assets.mjs";

4343

const compilerArgs = [buildScript, "--no-clean"];

4444

const bundledPluginAssetBuildArgs = [bundledPluginAssetsScript, "--phase", "build"];

45+

const RUN_NODE_SIGNAL_FORCE_KILL_AFTER_MS = 5_000;

45464647

const runtimePostBuildWatchedPaths = [

4748

"scripts/copy-bundled-plugin-metadata.mjs",

@@ -929,10 +930,37 @@ const resolveRunNodeDiagnosticArgs = (deps) => {

929930

return args;

930931

};

931932933+

const shouldUseRunNodeChildProcessGroup = (deps) =>

934+

deps.platform !== "win32" && deps.process.stdin?.isTTY !== true;

935+936+

const signalSpawnedProcess = (childProcess, signal, useProcessGroup, deps) => {

937+

if (useProcessGroup && typeof childProcess.pid === "number") {

938+

try {

939+

deps.signalProcess(-childProcess.pid, signal);

940+

return;

941+

} catch (error) {

942+

if (error?.code === "ESRCH" || error?.code === "EPERM") {

943+

return;

944+

}

945+

}

946+

}

947+

try {

948+

childProcess.kill?.(signal);

949+

} catch {

950+

// Best-effort only. Exit handling still happens via the child "exit" event.

951+

}

952+

};

953+932954

const waitForSpawnedProcess = async (childProcess, deps) => {

933955

let forwardedSignal = null;

956+

let forceKillTimer = null;

957+

let cleanedForwardedSignalGroup = false;

958+

const useProcessGroup = shouldUseRunNodeChildProcessGroup(deps);

934959935960

const cleanupSignals = () => {

961+

if (forceKillTimer) {

962+

clearTimeout(forceKillTimer);

963+

}

936964

if (onSigInt) {

937965

deps.process.off("SIGINT", onSigInt);

938966

}

@@ -946,11 +974,11 @@ const waitForSpawnedProcess = async (childProcess, deps) => {

946974

return;

947975

}

948976

forwardedSignal = signal;

949-

try {

950-

childProcess.kill?.(signal);

951-

} catch {

952-

// Best-effort only. Exit handling still happens via the child "exit" event.

953-

}

977+

signalSpawnedProcess(childProcess, signal, useProcessGroup, deps);

978+

forceKillTimer = setTimeout(() => {

979+

forceKillTimer = null;

980+

signalSpawnedProcess(childProcess, "SIGKILL", useProcessGroup, deps);

981+

}, RUN_NODE_SIGNAL_FORCE_KILL_AFTER_MS);

954982

};

955983956984

const onSigInt = () => {

@@ -978,6 +1006,10 @@ const waitForSpawnedProcess = async (childProcess, deps) => {

9781006

settle({ exitCode: 1, exitSignal: null, forwardedSignal });

9791007

});

9801008

childProcess.on("exit", (exitCode, exitSignal) => {

1009+

if (forwardedSignal && !cleanedForwardedSignalGroup) {

1010+

cleanedForwardedSignalGroup = true;

1011+

signalSpawnedProcess(childProcess, "SIGKILL", useProcessGroup, deps);

1012+

}

9811013

settle({ exitCode, exitSignal, forwardedSignal });

9821014

});

9831015

});

@@ -998,8 +1030,10 @@ const getInterruptedSpawnExitCode = (res) => {

99810309991031

const runOpenClaw = async (deps) => {

10001032

const diagnosticArgs = resolveRunNodeDiagnosticArgs(deps);

1033+

const useProcessGroup = shouldUseRunNodeChildProcessGroup(deps);

10011034

const nodeProcess = deps.spawn(deps.execPath, [...diagnosticArgs, "openclaw.mjs", ...deps.args], {

10021035

cwd: deps.cwd,

1036+

detached: useProcessGroup,

10031037

env: deps.env,

10041038

stdio: deps.outputTee ? ["inherit", "pipe", "pipe"] : "inherit",

10051039

});

@@ -1353,11 +1387,13 @@ const shouldRunQaCoverageReportFromSource = (deps, buildRequirement) =>

1353138713541388

const runQaParityReportFromSource = async (deps) => {

13551389

const sourceEntrypoint = path.join(deps.cwd, "scripts", "qa-parity-report.ts");

1390+

const useProcessGroup = shouldUseRunNodeChildProcessGroup(deps);

13561391

const nodeProcess = deps.spawn(

13571392

deps.execPath,

13581393

["--import", "tsx", sourceEntrypoint, ...deps.args.slice(2)],

13591394

{

13601395

cwd: deps.cwd,

1396+

detached: useProcessGroup,

13611397

env: deps.env,

13621398

stdio: deps.outputTee ? ["inherit", "pipe", "pipe"] : "inherit",

13631399

},

@@ -1373,11 +1409,13 @@ const runQaParityReportFromSource = async (deps) => {

1373140913741410

const runQaCoverageReportFromSource = async (deps) => {

13751411

const sourceEntrypoint = path.join(deps.cwd, "scripts", "qa-coverage-report.ts");

1412+

const useProcessGroup = shouldUseRunNodeChildProcessGroup(deps);

13761413

const nodeProcess = deps.spawn(

13771414

deps.execPath,

13781415

["--import", "tsx", sourceEntrypoint, ...deps.args.slice(2)],

13791416

{

13801417

cwd: deps.cwd,

1418+

detached: useProcessGroup,

13811419

env: deps.env,

13821420

stdio: deps.outputTee ? ["inherit", "pipe", "pipe"] : "inherit",

13831421

},

@@ -1406,6 +1444,8 @@ export async function runNodeMain(params = {}) {

14061444

cwd: params.cwd ?? process.cwd(),

14071445

args: params.args ?? process.argv.slice(2),

14081446

env: params.env ? { ...params.env } : { ...process.env },

1447+

platform: params.platform ?? process.platform,

1448+

signalProcess: params.signalProcess ?? process.kill,

14091449

runRuntimePostBuild: params.runRuntimePostBuild ?? runRuntimePostBuild,

14101450

};

14111451

@@ -1496,6 +1536,7 @@ export async function runNodeMain(params = {}) {

14961536

async () => {

14971537

const assetBuild = deps.spawn(buildCmd, bundledPluginAssetBuildArgs, {

14981538

cwd: deps.cwd,

1539+

detached: shouldUseRunNodeChildProcessGroup(deps),

14991540

env: deps.env,

15001541

stdio: ["inherit", "pipe", "pipe"],

15011542

});

@@ -1511,6 +1552,7 @@ export async function runNodeMain(params = {}) {

1511155215121553

const build = deps.spawn(buildCmd, compilerArgs, {

15131554

cwd: deps.cwd,

1555+

detached: shouldUseRunNodeChildProcessGroup(deps),

15141556

env: {

15151557

...deps.env,

15161558

[RUN_NODE_SKIP_DTS_BUILD_ENV]: deps.env[RUN_NODE_SKIP_DTS_BUILD_ENV] ?? "1",