fix(update): suppress handoff newer-config warning (#81235)

Merged via squash.

Prepared head SHA: 61a5c975bf
Co-authored-by: giodl73-repo <giodl@microsoft.com>
Co-authored-by: galiniliev <5711535+galiniliev@users.noreply.github.com>
Reviewed-by: @galiniliev
This commit is contained in:
Gio Della-Libera
2026-05-12 22:01:21 -07:00
committed by GitHub
parent 94fdc56b64
commit f141a086fc
4 changed files with 25 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ const classifyPortListener = vi.hoisted(() =>
vi.fn<(_listener: unknown, _port: number) => PortListenerKind>(() => "gateway"),
);
const probeGateway = vi.hoisted(() => vi.fn());
const createConfigIO = vi.hoisted(() => vi.fn());
const readBestEffortConfig = vi.hoisted(() => vi.fn(async () => ({})));
const resolveGatewayProbeAuthSafeWithSecretInputs = vi.hoisted(() =>
vi.fn<(_opts: unknown) => Promise<{ auth: { token?: string; password?: string } }>>(async () => ({
@@ -26,9 +27,7 @@ vi.mock("../../gateway/probe.js", () => ({
}));
vi.mock("../../config/io.js", () => ({
createConfigIO: () => ({
readBestEffortConfig: () => readBestEffortConfig(),
}),
createConfigIO: (opts: unknown) => createConfigIO(opts),
}));
vi.mock("../../gateway/probe-auth.js", () => ({
@@ -139,6 +138,10 @@ describe("inspectGatewayRestart", () => {
inspectPortUsage.mockReset();
readBestEffortConfig.mockReset();
readBestEffortConfig.mockResolvedValue({});
createConfigIO.mockReset();
createConfigIO.mockReturnValue({
readBestEffortConfig: () => readBestEffortConfig(),
});
resolveGatewayProbeAuthSafeWithSecretInputs.mockReset();
resolveGatewayProbeAuthSafeWithSecretInputs.mockResolvedValue({ auth: {} });
inspectPortUsage.mockResolvedValue({
@@ -442,6 +445,13 @@ describe("inspectGatewayRestart", () => {
expect(authResolveInput.cfg?.gateway?.auth?.mode).toBe("token");
expect(authResolveInput.cfg?.gateway?.auth?.token).toBe("probe-token");
expect(authResolveInput.mode).toBe("local");
expect(createConfigIO).toHaveBeenCalledWith(
expect.objectContaining({
env: serviceEnv,
pluginValidation: "skip",
suppressFutureVersionWarning: true,
}),
);
const probeInput = firstCallArg(probeGateway) as {
auth?: { token?: string; password?: string };
env?: NodeJS.ProcessEnv;
@@ -637,6 +647,8 @@ describe("inspectGatewayRestart", () => {
});
it("annotates stopped-free early exits with the actual elapsed time", async () => {
Object.defineProperty(process, "platform", { value: "linux", configurable: true });
const snapshot = await waitForStoppedFreeGatewayRestart();
expect(snapshot.healthy).toBe(false);

View File

@@ -274,6 +274,7 @@ async function resolveGatewayRestartProbeAuth(
const cfg = await createConfigIO({
env: mergedEnv,
pluginValidation: "skip",
suppressFutureVersionWarning: true,
})
.readBestEffortConfig()
.catch((): OpenClawConfig => ({}));