

























@@ -6,9 +6,11 @@ import {
66buildGatewayInstallEntrypointCandidates as resolveGatewayInstallEntrypointCandidates,
77resolveGatewayInstallEntrypoint,
88} from "../../daemon/gateway-entrypoint.js";
9+import type { UpdateRunResult } from "../../infra/update-runner.js";
910import {
1011buildInvalidConfigPostCoreUpdateResult,
1112collectMissingPluginInstallPayloads,
13+formatPostUpdateGatewayRecoveryInstructions,
1214recoverInstalledLaunchAgentAfterUpdate,
1315recoverLaunchAgentAndRecheckGatewayHealth,
1416resolvePostCoreUpdateChildStdio,
@@ -348,6 +350,52 @@ describe("shouldUseLegacyProcessRestartAfterUpdate", () => {
348350expect(shouldUseLegacyProcessRestartAfterUpdate({ updateMode: "unknown" })).toBe(true);
349351});
350352});
353+354+describe("formatPostUpdateGatewayRecoveryInstructions", () => {
355+const result: UpdateRunResult = {
356+status: "error",
357+mode: "git",
358+steps: [],
359+durationMs: 0,
360+};
361+362+it("uses systemd wording on Linux instead of macOS LaunchAgent instructions", () => {
363+const [line] = formatPostUpdateGatewayRecoveryInstructions(result, "linux");
364+365+expect(line).toContain("the systemd user service");
366+expect(line).toContain("openclaw gateway restart");
367+expect(line).toContain("openclaw gateway install --force");
368+expect(line).toContain("openclaw gateway status --deep");
369+expect(line).not.toContain("Linux reports");
370+expect(line).not.toContain("macOS");
371+expect(line).not.toContain("LaunchAgent");
372+});
373+374+it("keeps LaunchAgent recovery wording on macOS", () => {
375+const [line] = formatPostUpdateGatewayRecoveryInstructions(result, "darwin");
376+377+expect(line).toContain("the LaunchAgent is installed but not loaded");
378+expect(line).toContain("logged-in macOS user session");
379+});
380+381+it("uses Windows service-manager wording on Windows", () => {
382+const [line] = formatPostUpdateGatewayRecoveryInstructions(result, "win32");
383+384+expect(line).toContain("the gateway Scheduled Task or Windows login item");
385+expect(line).not.toContain("LaunchAgent");
386+expect(line).not.toContain("Startup-folder");
387+});
388+389+it("uses generic service-manager wording for unsupported Node platforms", () => {
390+const [line] = formatPostUpdateGatewayRecoveryInstructions(result, "freebsd");
391+392+expect(line).toContain("local service manager");
393+expect(line).not.toContain("systemd");
394+expect(line).not.toContain("LaunchAgent");
395+expect(line).not.toContain("Scheduled Task");
396+});
397+});
398+351399describe("recoverInstalledLaunchAgentAfterUpdate", () => {
352400it("re-bootstraps an installed-but-not-loaded macOS LaunchAgent after update", async () => {
353401const service = {} as never;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。