it("returns supervised when launchd hints are present on macOS (no kickstart)", () => {
clearSupervisorHints();
expectLaunchdSupervisedWithoutKickstart({ launchJobLabel: "ai.openclaw.gateway" });
});
it("returns supervised on macOS when launchd label is set (no kickstart)", () => {
expectLaunchdSupervisedWithoutKickstart({ launchJobLabel: "ai.openclaw.gateway" });
});
it("launchd supervisor never returns failed regardless of triggerOpenClawRestart outcome", () => {
clearSupervisorHints();
setPlatform("darwin");
process.env.OPENCLAW_LAUNCHD_LABEL = "ai.openclaw.gateway"; // Even if triggerOpenClawRestart *would* fail, launchd path must not call it.
triggerOpenClawRestartMock.mockReturnValue({
ok: false,
method: "launchctl",
detail: "Bootstrap failed: 5: Input/output error",
}); const result = restartGatewayProcessWithFreshPid();
expect(result.mode).toBe("supervised");
expect(result.mode).not.toBe("failed");
expect(triggerOpenClawRestartMock).not.toHaveBeenCalled();
});
it("does not schedule kickstart on non-darwin platforms", () => {
setPlatform("linux");
process.env.INVOCATION_ID = "abc123";
process.env.OPENCLAW_LAUNCHD_LABEL = "ai.openclaw.gateway";
const result = restartGatewayProcessWithFreshPid();
it("returns supervised when XPC_SERVICE_NAME is set by launchd", () => {
clearSupervisorHints();
setPlatform("darwin");
process.env.XPC_SERVICE_NAME = "ai.openclaw.gateway"; const result = restartGatewayProcessWithFreshPid();
expect(result.mode).toBe("supervised");
expect(triggerOpenClawRestartMock).not.toHaveBeenCalled();
expect(spawnMock).not.toHaveBeenCalled();
});
it("returns supervised when OPENCLAW_LAUNCHD_LABEL is set (stock launchd plist)", () => {
clearSupervisorHints();
expectLaunchdSupervisedWithoutKickstart();
});
it("returns supervised when OPENCLAW_SYSTEMD_UNIT is set", () => {
clearSupervisorHints();
setPlatform("linux");
process.env.OPENCLAW_SYSTEMD_UNIT = "openclaw-gateway.service"; const result = restartGatewayProcessWithFreshPid();
expect(result.mode).toBe("supervised");
expect(spawnMock).not.toHaveBeenCalled();
});
it("returns supervised when OpenClaw gateway task markers are set on Windows", () => {
clearSupervisorHints();
setPlatform("win32");
process.env.OPENCLAW_SERVICE_MARKER = "openclaw";
process.env.OPENCLAW_SERVICE_KIND = "gateway";
triggerOpenClawRestartMock.mockReturnValue({ ok: true, method: "schtasks" }); const result = restartGatewayProcessWithFreshPid();
expect(result.mode).toBe("supervised");
expect(triggerOpenClawRestartMock).toHaveBeenCalledOnce();
expect(spawnMock).not.toHaveBeenCalled();
});
it("keeps generic service markers out of non-Windows supervisor detection", () => {
clearSupervisorHints();
setPlatform("linux");
process.env.OPENCLAW_SERVICE_MARKER = "openclaw";
process.env.OPENCLAW_SERVICE_KIND = "gateway";
spawnMock.mockReturnValue({ pid: 4242, unref: vi.fn() });
const result = restartGatewayProcessWithFreshPid();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.