@@ -76,10 +76,6 @@ export type RestartSentinel = {
7676 payload: RestartSentinelPayload;
7777};
7878
79- export type RestartSentinelFormatOptions = {
80- state?: "pending" | "completed";
81- };
82-
8379const RESTART_SENTINEL_KEY = "current";
8480const LEGACY_RESTART_SENTINEL_FILENAME = "restart-sentinel.json";
8581type GatewayRestartSentinelDatabase = Pick<OpenClawStateKyselyDatabase, "gateway_restart_sentinel">;
@@ -326,25 +322,20 @@ export async function hasRestartSentinel(env: NodeJS.ProcessEnv = process.env):
326322 }
327323}
328324
329- export function formatRestartSentinelMessage(
330- payload: RestartSentinelPayload,
331- options?: RestartSentinelFormatOptions,
332- ): string {
333- const completedConfigRestart =
334- isRestartRequiredConfigWriteSentinel(payload) && options?.state === "completed";
335- const message = completedConfigRestart ? undefined : payload.message?.trim();
325+ export function formatRestartSentinelMessage(payload: RestartSentinelPayload): string {
326+ const message = payload.message?.trim();
336327 if (message && (!payload.stats || payload.kind === "config-auto-recovery")) {
337328 return message;
338329 }
339- const lines: string[] = [summarizeRestartSentinel(payload, options )];
330+ const lines: string[] = [summarizeRestartSentinel(payload)];
340331 if (message) {
341332 lines.push(message);
342333 }
343334 const reason = payload.stats?.reason?.trim();
344335 if (reason && reason !== message) {
345336 lines.push(`Reason: ${reason}`);
346337 }
347- if (!completedConfigRestart && payload.doctorHint?.trim()) {
338+ if (payload.doctorHint?.trim()) {
348339 lines.push(payload.doctorHint.trim());
349340 }
350341 return lines.join("\n");
@@ -358,18 +349,12 @@ function isRestartRequiredConfigWriteSentinel(payload: RestartSentinelPayload):
358349 );
359350}
360351
361- export function summarizeRestartSentinel(
362- payload: RestartSentinelPayload,
363- options?: RestartSentinelFormatOptions,
364- ): string {
352+ export function summarizeRestartSentinel(payload: RestartSentinelPayload): string {
365353 if (payload.kind === "config-auto-recovery") {
366354 return "Gateway auto-recovery";
367355 }
368356 if (isRestartRequiredConfigWriteSentinel(payload)) {
369357 const mode = payload.stats?.mode ? ` (${payload.stats.mode})` : "";
370- if (options?.state === "completed") {
371- return `Gateway restart completed${mode}`.trim();
372- }
373358 return `Gateway restart required${mode}`.trim();
374359 }
375360 const kind = payload.kind;
0 commit comments