


























@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
22import type { OpenClawConfig } from "../config/config.js";
3344const callGateway = vi.hoisted(() => vi.fn());
5+const note = vi.hoisted(() => vi.fn());
5667vi.mock("../gateway/call.js", () => ({
78buildGatewayConnectionDetails: vi.fn(() => ({
@@ -10,6 +11,10 @@ vi.mock("../gateway/call.js", () => ({
1011 callGateway,
1112}));
121314+vi.mock("../terminal/note.js", () => ({
15+ note,
16+}));
17+1318vi.mock("./health.js", () => ({
1419healthCommand: vi.fn(),
1520}));
@@ -21,6 +26,7 @@ describe("checkGatewayHealth", () => {
21262227beforeEach(() => {
2328callGateway.mockReset();
29+note.mockReset();
2430});
25312632it("uses a lightweight status RPC for the restart liveness gate", async () => {
@@ -43,6 +49,25 @@ describe("checkGatewayHealth", () => {
4349timeoutMs: 6000,
4450});
4551expect(runtime.error).not.toHaveBeenCalled();
52+expect(note).not.toHaveBeenCalledWith(expect.any(String), "Gateway version skew");
53+});
54+55+it("notes CLI and gateway version skew when the gateway reports another runtime version", async () => {
56+callGateway.mockResolvedValueOnce({ runtimeVersion: "2026.4.23" }).mockResolvedValueOnce({});
57+const runtime = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
58+59+await expect(
60+checkGatewayHealth({ runtime: runtime as never, cfg, timeoutMs: 3000 }),
61+).resolves.toEqual({ healthOk: true, status: { runtimeVersion: "2026.4.23" } });
62+63+expect(note).toHaveBeenCalledWith(
64+expect.stringContaining("Gateway version: 2026.4.23"),
65+"Gateway version skew",
66+);
67+expect(note).toHaveBeenCalledWith(
68+expect.stringContaining("stale global wrapper"),
69+"Gateway version skew",
70+);
4671});
47724873it("does not run follow-up channel probes when liveness fails", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。