@@ -23,6 +23,7 @@ const recordLatestUpdateRestartSentinelMock = vi.fn();
|
23 | 23 | const isRestartEnabledMock = vi.fn(() => true); |
24 | 24 | const readPackageVersionMock = vi.fn(async () => "1.0.0"); |
25 | 25 | const detectRespawnSupervisorMock = vi.fn<() => RespawnSupervisor | null>(() => null); |
| 26 | +const normalizeUpdateChannelMock = vi.fn((): "stable" | "beta" | "dev" | null => null); |
26 | 27 | const startManagedServiceUpdateHandoffMock = vi.fn(async () => ({ |
27 | 28 | status: "started" as const, |
28 | 29 | pid: 12345, |
@@ -101,7 +102,7 @@ vi.mock("../../infra/supervisor-markers.js", () => ({
|
101 | 102 | })); |
102 | 103 | |
103 | 104 | vi.mock("../../infra/update-channels.js", () => ({ |
104 | | -normalizeUpdateChannel: () => undefined, |
| 105 | +normalizeUpdateChannel: normalizeUpdateChannelMock, |
105 | 106 | })); |
106 | 107 | |
107 | 108 | vi.mock("../../infra/update-runner.js", () => ({ |
@@ -155,6 +156,8 @@ beforeEach(() => {
|
155 | 156 | isRestartEnabledMock.mockReturnValue(true); |
156 | 157 | readPackageVersionMock.mockClear(); |
157 | 158 | readPackageVersionMock.mockResolvedValue("1.0.0"); |
| 159 | +normalizeUpdateChannelMock.mockReset(); |
| 160 | +normalizeUpdateChannelMock.mockReturnValue(null); |
158 | 161 | detectRespawnSupervisorMock.mockReset(); |
159 | 162 | detectRespawnSupervisorMock.mockReturnValue(null); |
160 | 163 | runGatewayUpdateMock.mockClear(); |
@@ -533,6 +536,25 @@ describe("update.run restart scheduling", () => {
|
533 | 536 | expect(readCapturedPayload().status).toBe("skipped"); |
534 | 537 | }); |
535 | 538 | |
| 539 | +it("does not pass the stored stable channel to supervised git handoff CLI", async () => { |
| 540 | +normalizeUpdateChannelMock.mockReturnValueOnce("stable"); |
| 541 | +detectRespawnSupervisorMock.mockReturnValueOnce("launchd"); |
| 542 | +mockGitInstallSurface("/tmp/openclaw-git"); |
| 543 | + |
| 544 | +const payload = await withProcessEnv({ OPENCLAW_LAUNCHD_LABEL: "ai.openclaw.gateway" }, () => |
| 545 | +captureUpdateRunPayload(), |
| 546 | +); |
| 547 | + |
| 548 | +expect(runGatewayUpdateMock).not.toHaveBeenCalled(); |
| 549 | +expect(startManagedServiceUpdateHandoffMock).toHaveBeenCalledTimes(1); |
| 550 | +const [handoffParams] = firstMockCall( |
| 551 | +startManagedServiceUpdateHandoffMock, |
| 552 | +"managed handoff", |
| 553 | +) as [{ channel?: string }]; |
| 554 | +expect(handoffParams).not.toHaveProperty("channel"); |
| 555 | +expect(payload?.handoff?.command).not.toContain("--channel"); |
| 556 | +}); |
| 557 | + |
536 | 558 | it("keeps unsupervised git/dev updates on the in-process gateway update path", async () => { |
537 | 559 | runGatewayUpdateMock.mockResolvedValueOnce({ |
538 | 560 | status: "ok", |
|