fix: preserve update compatibility host during release upgrades

(cherry picked from commit 2823725134)
This commit is contained in:
Peter Steinberger
2026-05-20 15:07:51 +01:00
parent 2e389b6a46
commit 1fdeee380e
9 changed files with 78 additions and 24 deletions

View File

@@ -13,6 +13,7 @@ vi.mock("./plugin-payload-validation.js", () => ({
}));
import type { OpenClawConfig } from "../../config/types.openclaw.js";
import { VERSION } from "../../version.js";
import {
convergenceWarningsToOutcomes,
filterRecordsToActive,
@@ -41,6 +42,22 @@ describe("runPostCorePluginConvergence", () => {
cfg,
env: {
OPENCLAW_UPDATE_IN_PROGRESS: "1",
OPENCLAW_COMPATIBILITY_HOST_VERSION: VERSION,
OPENCLAW_UPDATE_POST_CORE_CONVERGENCE: "1",
},
});
});
it("uses the candidate runtime version over a stale inherited host version", async () => {
const cfg = { plugins: { entries: {} } } as unknown as OpenClawConfig;
await runPostCorePluginConvergence({
cfg,
env: { OPENCLAW_COMPATIBILITY_HOST_VERSION: "2026.5.12" },
});
expect(mocks.repairMissingConfiguredPluginInstalls).toHaveBeenCalledWith({
cfg,
env: {
OPENCLAW_COMPATIBILITY_HOST_VERSION: VERSION,
OPENCLAW_UPDATE_POST_CORE_CONVERGENCE: "1",
},
});
@@ -97,6 +114,7 @@ describe("runPostCorePluginConvergence", () => {
expect(mocks.repairMissingConfiguredPluginInstalls).toHaveBeenCalledWith({
cfg,
env: {
OPENCLAW_COMPATIBILITY_HOST_VERSION: VERSION,
OPENCLAW_UPDATE_POST_CORE_CONVERGENCE: "1",
},
baselineRecords: baseline,
@@ -222,6 +240,7 @@ describe("runPostCorePluginConvergence", () => {
expect(mocks.runPluginPayloadSmokeCheck).toHaveBeenCalledWith({
records,
env: {
OPENCLAW_COMPATIBILITY_HOST_VERSION: VERSION,
OPENCLAW_UPDATE_POST_CORE_CONVERGENCE: "1",
},
});

View File

@@ -7,6 +7,7 @@ import {
resolveTrustedSourceLinkedOfficialClawHubSpec,
resolveTrustedSourceLinkedOfficialNpmSpec,
} from "../../plugins/update.js";
import { VERSION } from "../../version.js";
import {
runPluginPayloadSmokeCheck,
type PluginPayloadSmokeFailure,
@@ -62,6 +63,7 @@ export async function runPostCorePluginConvergence(params: {
}): Promise<PostCoreConvergenceResult> {
const env: NodeJS.ProcessEnv = {
...params.env,
OPENCLAW_COMPATIBILITY_HOST_VERSION: VERSION,
[UPDATE_POST_CORE_CONVERGENCE_ENV]: "1",
};

View File

@@ -95,6 +95,7 @@ import { normalizeOptionalString } from "../../shared/string-coerce.js";
import { stylePromptMessage } from "../../terminal/prompt-style.js";
import { theme } from "../../terminal/theme.js";
import { resolveUserPath } from "../../utils.js";
import { VERSION } from "../../version.js";
import { replaceCliName, resolveCliName } from "../cli-name.js";
import { formatCliCommand } from "../command-format.js";
import { installCompletion } from "../completion-runtime.js";
@@ -2886,10 +2887,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
return;
}
const postCoreHostVersion = await readPackageVersion(root);
if (postCoreHostVersion) {
process.env.OPENCLAW_COMPATIBILITY_HOST_VERSION = postCoreHostVersion;
}
process.env.OPENCLAW_COMPATIBILITY_HOST_VERSION = (await readPackageVersion(root)) ?? VERSION;
let postCoreConfigSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
const preUpdateSourceConfig = await readPostCorePreUpdateSourceConfig({