fix: preserve consumed update restart status · openclaw/openclaw@082a4fa
shakkernerd
·
2026-06-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -292,7 +292,8 @@ vi.mock("./server-methods/agent-timestamp.js", () => ({
|
292 | 292 | timestampOptsFromConfig: mocks.timestampOptsFromConfig, |
293 | 293 | })); |
294 | 294 | |
295 | | -const { scheduleRestartSentinelWake } = await import("./server-restart-sentinel.js"); |
| 295 | +const { getLatestUpdateRestartSentinel, scheduleRestartSentinelWake } = |
| 296 | +await import("./server-restart-sentinel.js"); |
296 | 297 | |
297 | 298 | function expectRecordFields( |
298 | 299 | record: unknown, |
@@ -1312,6 +1313,38 @@ describe("scheduleRestartSentinelWake", () => {
|
1312 | 1313 | expect(mocks.recordInboundSessionAndDispatchReply).toHaveBeenCalledTimes(1); |
1313 | 1314 | }); |
1314 | 1315 | |
| 1316 | +it("keeps a consumed update sentinel available for reconnect status polling", async () => { |
| 1317 | +const payload = { |
| 1318 | +kind: "update", |
| 1319 | +status: "ok", |
| 1320 | +ts: 123, |
| 1321 | +sessionKey: "agent:main:main", |
| 1322 | +deliveryContext: { |
| 1323 | +channel: "whatsapp", |
| 1324 | +to: "+15550002", |
| 1325 | +accountId: "acct-2", |
| 1326 | +}, |
| 1327 | +stats: { |
| 1328 | +mode: "git", |
| 1329 | +root: "/repo", |
| 1330 | +before: { version: "1.0.0" }, |
| 1331 | +after: { version: "2.0.0" }, |
| 1332 | +steps: [], |
| 1333 | +reason: null, |
| 1334 | +durationMs: 10, |
| 1335 | +}, |
| 1336 | +} as const; |
| 1337 | +mocks.readRestartSentinel.mockResolvedValue({ |
| 1338 | +version: 1, |
| 1339 | + payload, |
| 1340 | +}); |
| 1341 | + |
| 1342 | +await scheduleRestartSentinelWake({ deps: {} as never }); |
| 1343 | + |
| 1344 | +expect(mocks.removeRestartSentinelFile).toHaveBeenCalledWith("/tmp/restart-sentinel.json"); |
| 1345 | +expect(getLatestUpdateRestartSentinel()).toEqual(payload); |
| 1346 | +}); |
| 1347 | + |
1315 | 1348 | it("does not wake the main session when the sentinel has no sessionKey", async () => { |
1316 | 1349 | mocks.readRestartSentinel.mockResolvedValue({ |
1317 | 1350 | payload: { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。