refactor: format restart handoff diagnostics · openclaw/openclaw@3e53580
shakkernerd
·
2026-05-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,7 @@ import path from "node:path";
|
4 | 4 | import { afterEach, describe, expect, it } from "vitest"; |
5 | 5 | import { |
6 | 6 | consumeGatewayRestartHandoffForExitedProcessSync, |
| 7 | +formatGatewayRestartHandoffDiagnostic, |
7 | 8 | GATEWAY_SUPERVISOR_RESTART_HANDOFF_FILENAME, |
8 | 9 | GATEWAY_SUPERVISOR_RESTART_HANDOFF_KIND, |
9 | 10 | readGatewayRestartHandoffSync, |
@@ -248,4 +249,26 @@ describe("gateway restart handoff", () => {
|
248 | 249 | }), |
249 | 250 | ).toMatchObject({ pid: 12_345 }); |
250 | 251 | }); |
| 252 | + |
| 253 | +it("formats a concise diagnostic line for status surfaces", () => { |
| 254 | +expect( |
| 255 | +formatGatewayRestartHandoffDiagnostic( |
| 256 | +{ |
| 257 | +kind: GATEWAY_SUPERVISOR_RESTART_HANDOFF_KIND, |
| 258 | +version: 1, |
| 259 | +intentId: "intent-1", |
| 260 | +pid: 12_345, |
| 261 | +createdAt: 10_000, |
| 262 | +expiresAt: 70_000, |
| 263 | +reason: "plugin source changed", |
| 264 | +source: "plugin-change", |
| 265 | +restartKind: "full-process", |
| 266 | +supervisorMode: "launchd", |
| 267 | +}, |
| 268 | +12_500, |
| 269 | +), |
| 270 | +).toBe( |
| 271 | +"Recent restart handoff: full-process via launchd; source=plugin-change; reason=plugin source changed; pid=12345; age=2s; expiresIn=57s", |
| 272 | +); |
| 273 | +}); |
251 | 274 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。