fix: warn on same-base prerelease configs

This commit is contained in:
Peter Steinberger
2026-03-24 02:02:31 +00:00
parent 85ed1a8986
commit 2d5f822ca1

View File

@@ -53,7 +53,11 @@ import {
validateConfigObjectRawWithPlugins,
validateConfigObjectWithPlugins,
} from "./validation.js";
import { compareOpenClawVersions, isSameOpenClawStableFamily } from "./version.js";
import {
compareOpenClawVersions,
isSameOpenClawStableFamily,
parseOpenClawVersion,
} from "./version.js";
// Re-export for backwards compatibility
export { CircularIncludeError, ConfigIncludeError } from "./includes.js";
@@ -622,9 +626,24 @@ function warnIfConfigFromFuture(cfg: OpenClawConfig, logger: Pick<typeof console
if (!touched) {
return;
}
const currentVersion = parseOpenClawVersion(VERSION);
const touchedVersion = parseOpenClawVersion(touched);
if (!currentVersion || !touchedVersion) {
return;
}
if (isSameOpenClawStableFamily(VERSION, touched)) {
return;
}
const sameBaseRelease =
currentVersion.major === touchedVersion.major &&
currentVersion.minor === touchedVersion.minor &&
currentVersion.patch === touchedVersion.patch;
if (sameBaseRelease && touchedVersion.prerelease?.length) {
logger.warn(
`Config was last written by a newer OpenClaw (${touched}); current version is ${VERSION}.`,
);
return;
}
const cmp = compareOpenClawVersions(VERSION, touched);
if (cmp === null) {
return;