From 03aea082d05476f0cfba7ca2826b384bba17a540 Mon Sep 17 00:00:00 2001 From: daymade Date: Sun, 8 Mar 2026 19:24:30 +0800 Subject: [PATCH] chore: condense inline comments per code review Remove redundant rationale from test body (test names already convey it) and trim the production comment to what/consequence/link (mechanism details live in #39760). --- src/infra/process-respawn.test.ts | 3 --- src/infra/process-respawn.ts | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/infra/process-respawn.test.ts b/src/infra/process-respawn.test.ts index 06ccfff5b9e..c2d2d3afd0d 100644 --- a/src/infra/process-respawn.test.ts +++ b/src/infra/process-respawn.test.ts @@ -54,8 +54,6 @@ function expectLaunchdSupervisedWithoutKickstart(params?: { launchJobLabel?: str process.env.OPENCLAW_LAUNCHD_LABEL = "ai.openclaw.gateway"; const result = restartGatewayProcessWithFreshPid(); expect(result.mode).toBe("supervised"); - // launchd path no longer calls triggerOpenClawRestart — it relies on - // KeepAlive=true to restart the service after the caller exits. expect(triggerOpenClawRestartMock).not.toHaveBeenCalled(); expect(spawnMock).not.toHaveBeenCalled(); } @@ -74,7 +72,6 @@ describe("restartGatewayProcessWithFreshPid", () => { process.env.LAUNCH_JOB_LABEL = "ai.openclaw.gateway"; const result = restartGatewayProcessWithFreshPid(); expect(result.mode).toBe("supervised"); - // launchd relies on KeepAlive=true — no kickstart call needed. expect(triggerOpenClawRestartMock).not.toHaveBeenCalled(); expect(spawnMock).not.toHaveBeenCalled(); }); diff --git a/src/infra/process-respawn.ts b/src/infra/process-respawn.ts index ad96133ebb6..8bf1503b18f 100644 --- a/src/infra/process-respawn.ts +++ b/src/infra/process-respawn.ts @@ -31,10 +31,8 @@ export function restartGatewayProcessWithFreshPid(): GatewayRespawnResult { const supervisor = detectRespawnSupervisor(process.env); if (supervisor) { // launchd: exit(0) is sufficient — KeepAlive=true restarts the service. - // Calling `kickstart -k` from within the service itself races with - // launchd's async bootout state machine: the spawnSync timeout kills the - // launchctl child, but launchd continues the bootout and eventually - // SIGKILLs this process, leaving the LaunchAgent permanently unloaded. + // Self-issued `kickstart -k` races with launchd's bootout state machine + // and can leave the LaunchAgent permanently unloaded. // See: https://github.com/openclaw/openclaw/issues/39760 if (supervisor === "schtasks") { const restart = triggerOpenClawRestart();