fix(gateway): explain ignored restart signal

Add actionable operator guidance when an unauthorized SIGUSR1 gateway restart is ignored because unmanaged restart is disabled.

The change is log-only: restart authorization and scheduling semantics are unchanged, and the existing run-loop test now asserts both the reason warning and the recovery hint.

Refs #79577
Refs #78110
Refs #82433

Co-authored-by: wAngByg <281221101+wAngByg@users.noreply.github.com>
This commit is contained in:
Ashd.LW.
2026-05-31 01:38:35 +08:00
committed by GitHub
parent 9e3d5310cc
commit bc77f7a00a
2 changed files with 13 additions and 1 deletions

View File

@@ -1205,6 +1205,13 @@ describe("runGatewayLoop", () => {
expect(gatewayLog.warn).toHaveBeenCalledWith(
"SIGUSR1 restart ignored (not authorized; commands.restart=false or use gateway tool).",
);
expect(gatewayLog.warn).toHaveBeenCalledTimes(2);
expect(gatewayLog.warn).toHaveBeenNthCalledWith(
2,
"An unauthorized SIGUSR1 restart signal was received and ignored. " +
"If a pending gateway restart needs to be applied, run `openclaw gateway restart` " +
"or restart the gateway through your service manager.",
);
});
});

View File

@@ -1,5 +1,6 @@
import { randomUUID } from "node:crypto";
import net from "node:net";
import { clearRuntimeConfigSnapshot } from "../../config/runtime-snapshot.js";
import {
captureGatewayRestartTraceHandoff,
createGatewayRestartTraceHandoffEnv,
@@ -12,7 +13,6 @@ import { formatErrorMessage } from "../../infra/errors.js";
import { acquireGatewayLock } from "../../infra/gateway-lock.js";
import { createSubsystemLogger } from "../../logging/subsystem.js";
import type { RuntimeEnv } from "../../runtime.js";
import { clearRuntimeConfigSnapshot } from "../../config/runtime-snapshot.js";
import { createLazyImportLoader } from "../../shared/lazy-promise.js";
const gatewayLog = createSubsystemLogger("gateway");
const LAUNCHD_SUPERVISED_RESTART_EXIT_DELAY_MS = 1500;
@@ -743,6 +743,11 @@ export async function runGatewayLoop(params: {
gatewayLog.warn(
"SIGUSR1 restart ignored (not authorized; commands.restart=false or use gateway tool).",
);
gatewayLog.warn(
"An unauthorized SIGUSR1 restart signal was received and ignored. " +
"If a pending gateway restart needs to be applied, run `openclaw gateway restart` " +
"or restart the gateway through your service manager.",
);
return;
}
if (shuttingDown) {