






















@@ -1,5 +1,8 @@
11import { beforeEach, describe, expect, it, vi } from "vitest";
2-import type { RestartSentinelPayload } from "../../infra/restart-sentinel.js";
2+import {
3+DEFAULT_RESTART_SUCCESS_CONTINUATION_MESSAGE,
4+type RestartSentinelPayload,
5+} from "../../infra/restart-sentinel.js";
36import type { UpdateInstallSurface, UpdateRunResult } from "../../infra/update-runner.js";
4758// Capture the sentinel payload written during update.run
@@ -102,6 +105,7 @@ vi.mock("./restart-request.js", () => ({
102105parseRestartRequestParams: (params: Record<string, unknown>) => ({
103106sessionKey: params.sessionKey,
104107note: params.note,
108+continuationMessage: params.continuationMessage,
105109restartDelayMs: undefined,
106110}),
107111}));
@@ -167,7 +171,10 @@ describe("update.run sentinel deliveryContext", () => {
167171to: "webchat:user-123",
168172accountId: "default",
169173});
170-expect(capturedPayload!.continuation).toBeUndefined();
174+expect(capturedPayload!.continuation).toEqual({
175+kind: "agentTurn",
176+message: DEFAULT_RESTART_SUCCESS_CONTINUATION_MESSAGE,
177+});
171178});
172179173180it("omits deliveryContext when no sessionKey is provided", async () => {
@@ -193,7 +200,25 @@ describe("update.run sentinel deliveryContext", () => {
193200accountId: "workspace-1",
194201});
195202expect(capturedPayload!.threadId).toBe("1234567890.123456");
196-expect(capturedPayload!.continuation).toBeUndefined();
203+expect(capturedPayload!.continuation).toEqual({
204+kind: "agentTurn",
205+message: DEFAULT_RESTART_SUCCESS_CONTINUATION_MESSAGE,
206+});
207+});
208+209+it("uses an explicit continuationMessage in successful update sentinels", async () => {
210+capturedPayload = undefined;
211+212+await invokeUpdateRun({
213+sessionKey: "agent:main:webchat:dm:user-123",
214+continuationMessage: "Check the running version and finish the update report.",
215+});
216+217+expect(capturedPayload).toBeDefined();
218+expect(capturedPayload!.continuation).toEqual({
219+kind: "agentTurn",
220+message: "Check the running version and finish the update report.",
221+});
197222});
198223});
199224@@ -234,10 +259,16 @@ describe("update.run restart scheduling", () => {
234259235260let payload: { ok: boolean; restart: unknown } | undefined;
236261237-await invokeUpdateRun({}, (_ok: boolean, response: unknown) => {
238-const typed = response as { ok: boolean; restart: unknown };
239-payload = typed;
240-});
262+await invokeUpdateRun(
263+{
264+sessionKey: "agent:main:webchat:dm:user-123",
265+continuationMessage: "This should not run after a failed update.",
266+},
267+(_ok: boolean, response: unknown) => {
268+const typed = response as { ok: boolean; restart: unknown };
269+payload = typed;
270+},
271+);
241272242273expect(scheduleGatewaySigusr1RestartMock).not.toHaveBeenCalled();
243274expect(payload?.ok).toBe(false);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。