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).
This commit is contained in:
daymade
2026-03-08 19:24:30 +08:00
committed by Peter Steinberger
parent 5f45e76d61
commit 03aea082d0
2 changed files with 2 additions and 7 deletions

View File

@@ -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();
});

View File

@@ -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();