mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:10:42 +00:00
fix: stabilize Parallels update restart checks
This commit is contained in:
@@ -351,6 +351,35 @@ describe("inspectGatewayRestart", () => {
|
||||
expect(snapshot.versionMismatch).toBeUndefined();
|
||||
});
|
||||
|
||||
it("accepts matching-version restart liveness when the probe lacks operator scope", async () => {
|
||||
probeGateway.mockResolvedValue({
|
||||
ok: false,
|
||||
close: null,
|
||||
connectLatencyMs: 12,
|
||||
error: "missing scope: operator.read",
|
||||
auth: { capability: "connected_no_operator_scope" },
|
||||
server: { version: "2026.4.24", connId: "new" },
|
||||
});
|
||||
|
||||
const snapshot = await inspectGatewayRestartWithSnapshot({
|
||||
runtime: { status: "running", pid: 8000 },
|
||||
expectedVersion: "2026.4.24",
|
||||
portUsage: {
|
||||
port: 18789,
|
||||
status: "busy",
|
||||
listeners: [{ pid: 8000, commandLine: "openclaw-gateway" }],
|
||||
hints: [],
|
||||
},
|
||||
});
|
||||
|
||||
expect(snapshot).toMatchObject({
|
||||
healthy: true,
|
||||
gatewayVersion: "2026.4.24",
|
||||
expectedVersion: "2026.4.24",
|
||||
});
|
||||
expect(snapshot.versionMismatch).toBeUndefined();
|
||||
});
|
||||
|
||||
it("stops waiting once the restarted gateway reports the wrong version", async () => {
|
||||
probeGateway.mockResolvedValue({
|
||||
ok: true,
|
||||
|
||||
@@ -237,8 +237,14 @@ async function confirmGatewayReachable(params: {
|
||||
timeoutMs: 3_000,
|
||||
includeDetails: params.includeHealthDetails === true,
|
||||
});
|
||||
const reachedGateway =
|
||||
probe.ok ||
|
||||
looksLikeAuthClose(probe.close?.code, probe.close?.reason) ||
|
||||
(probe.connectLatencyMs != null &&
|
||||
probe.server?.version != null &&
|
||||
probe.auth.capability === "connected_no_operator_scope");
|
||||
return {
|
||||
reachable: probe.ok || looksLikeAuthClose(probe.close?.code, probe.close?.reason),
|
||||
reachable: reachedGateway,
|
||||
gatewayVersion: probe.server?.version ?? null,
|
||||
activatedPluginErrors: readActivatedPluginErrors(probe.health),
|
||||
channelProbeErrors: readChannelProbeErrors(probe.health),
|
||||
|
||||
Reference in New Issue
Block a user