Skip to content

Commit 21fba83

Browse files
authored
fix: live updater no-op restarts healthy gateways (#117038)
* fix(updater): route managed health through overlay * style: format live updater probe * test: align live updater readiness types
1 parent 661afc2 commit 21fba83

3 files changed

Lines changed: 50 additions & 5 deletions

File tree

‎.agents/skills/openclaw-live-updater/scripts/update-main.mjs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,11 +1479,7 @@ function verifyGateway(runCommand, checkout, expectedSha, deployment = null) {
14791479
["gateway", "status", "--deep", "--require-rpc", "--json"],
14801480
deployment,
14811481
);
1482-
runBuiltGatewayCli(
1483-
checkout,
1484-
["health", "--port", String(deployment.port), "--verbose", "--json"],
1485-
deployment,
1486-
);
1482+
runBuiltGatewayCli(checkout, ["health", "--verbose", "--json"], deployment);
14871483
return;
14881484
}
14891485
runCommand(

‎test/external-script-modules.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ declare module "*openclaw-live-updater/scripts/update-main.mjs" {
278278
checkout: string,
279279
expectedSha: string,
280280
sleep?: (ms: number) => void,
281+
deployment?: GatewayDeployment | null,
281282
): void;
282283
export function findExactMacTarget(
283284
processes: string,

‎test/scripts/openclaw-live-updater.test.ts‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,54 @@ describe("openclaw live updater", () => {
550550
]);
551551
});
552552

553+
test("routes managed Gateway health through the injected port", () => {
554+
const { root, mirror } = makeFixture();
555+
writeBuild(mirror);
556+
const entrypoint = path.join(mirror, "dist/index.js");
557+
const callsPath = path.join(root, "managed-probe-calls.jsonl");
558+
writeFileSync(
559+
entrypoint,
560+
`import { appendFileSync } from "node:fs";
561+
const args = process.argv.slice(2);
562+
appendFileSync(${JSON.stringify(callsPath)}, JSON.stringify({
563+
args,
564+
port: process.env.OPENCLAW_GATEWAY_PORT,
565+
}) + "\\n");
566+
if (args.includes("--port")) process.exit(2);
567+
`,
568+
);
569+
570+
verifyGatewayReadiness(
571+
() => {
572+
throw new Error("managed probes must use the exact built Gateway CLI");
573+
},
574+
mirror,
575+
git(mirror, "rev-parse", "HEAD"),
576+
() => {},
577+
{
578+
configPath: path.join(root, "openclaw.json"),
579+
entrypoint,
580+
executable: process.execPath,
581+
invocationPrefix: [entrypoint],
582+
port: 18789,
583+
runtime: process.execPath,
584+
},
585+
);
586+
587+
expect(
588+
readFileSync(callsPath, "utf8")
589+
.trim()
590+
.split("\n")
591+
.map((line) => JSON.parse(line)),
592+
).toEqual([
593+
{
594+
args: ["gateway", "status", "--deep", "--require-rpc", "--json"],
595+
port: "18789",
596+
},
597+
{ args: ["health", "--verbose", "--json"], port: "18789" },
598+
]);
599+
});
600+
553601
test("bounds built Gateway CLI probes and cleans their config overlay", () => {
554602
const { root, mirror } = makeFixture();
555603
writeBuild(mirror);

0 commit comments

Comments
 (0)