From b588f04a029d7da5eb74db9690fe0c79bbf79811 Mon Sep 17 00:00:00 2001 From: Bryan Marty Date: Wed, 11 Mar 2026 07:44:15 +0000 Subject: [PATCH] fix: distinguish skipped restarts from successful restarts in user message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formatRestartSentinelUserMessage now returns a distinct message for status=skipped instead of falling through to the success message. Previously, skipped updates (e.g. update.run with nothing to update) would be reported as 'Gateway restarted successfully.' — misleading operators into thinking a restart occurred when it did not. Adds two new tests for the skipped status case. --- src/infra/restart-sentinel.test.ts | 23 +++++++++++++++++++++++ src/infra/restart-sentinel.ts | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/infra/restart-sentinel.test.ts b/src/infra/restart-sentinel.test.ts index 8816376624c..e69cdfb5baf 100644 --- a/src/infra/restart-sentinel.test.ts +++ b/src/infra/restart-sentinel.test.ts @@ -210,6 +210,29 @@ describe("formatRestartSentinelUserMessage", () => { expect(formatRestartSentinelUserMessage(payload)).toBe("Gateway restart failed."); }); + it("returns skipped message for skipped status", () => { + const payload = { + kind: "update" as const, + status: "skipped" as const, + ts: Date.now(), + }; + expect(formatRestartSentinelUserMessage(payload)).toBe( + "Gateway restart skipped (no restart was performed).", + ); + }); + + it("returns skipped message for skipped status even with a note", () => { + const payload = { + kind: "update" as const, + status: "skipped" as const, + ts: Date.now(), + message: "update already up to date", + }; + const result = formatRestartSentinelUserMessage(payload); + expect(result).toBe("Gateway restart skipped (no restart was performed)."); + expect(result).not.toContain("already up to date"); + }); + it("never includes doctorHint", () => { const payload = { kind: "config-patch" as const, diff --git a/src/infra/restart-sentinel.ts b/src/infra/restart-sentinel.ts index 3feb660088b..c15e2aee7cb 100644 --- a/src/infra/restart-sentinel.ts +++ b/src/infra/restart-sentinel.ts @@ -137,6 +137,9 @@ export function formatRestartSentinelUserMessage(payload: RestartSentinelPayload if (payload.status === "error") { return "Gateway restart failed."; } + if (payload.status === "skipped") { + return "Gateway restart skipped (no restart was performed)."; + } return "Gateway restarted successfully."; }