Skip to content

Commit b8b878e

Browse files
authored
fix(plugins): preserve startup release during repair (#120085)
* fix(plugins): preserve startup compatibility version * chore(ci): refresh merge context
1 parent 01281ad commit b8b878e

4 files changed

Lines changed: 48 additions & 1 deletion

‎src/cli/update-cli/post-core-plugin-convergence.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,22 @@ describe("runPostCorePluginConvergence", () => {
154154
});
155155
});
156156

157+
it("uses an explicit compatibility host version for startup convergence", async () => {
158+
const cfg = { plugins: { entries: {} } } as unknown as OpenClawConfig;
159+
await runPostCorePluginConvergence({
160+
cfg,
161+
env: { OPENCLAW_COMPATIBILITY_HOST_VERSION: "2026.5.12" },
162+
compatibilityHostVersion: "2026.7.2-beta.7",
163+
});
164+
expect(mocks.repairMissingConfiguredPluginInstalls).toHaveBeenCalledWith({
165+
cfg,
166+
env: {
167+
OPENCLAW_COMPATIBILITY_HOST_VERSION: "2026.7.2-beta.7",
168+
OPENCLAW_UPDATE_POST_CORE_CONVERGENCE: "1",
169+
},
170+
});
171+
});
172+
157173
it("returns ok when no warnings/failures and includes repair changes", async () => {
158174
mocks.repairMissingConfiguredPluginInstalls.mockResolvedValue({
159175
changes: ['Repaired missing configured plugin "discord".'],

‎src/cli/update-cli/post-core-plugin-convergence.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function formatPeerLinkPackageReadWarning(failure: { error: unknown }): PostCore
151151
export async function runPostCorePluginConvergence(params: {
152152
cfg: OpenClawConfig;
153153
env: NodeJS.ProcessEnv;
154+
compatibilityHostVersion?: string;
154155
/**
155156
* Optional in-memory install records from earlier post-core steps (e.g.
156157
* `syncPluginsForUpdateChannel`, `updateNpmInstalledPlugins`) whose
@@ -165,7 +166,7 @@ export async function runPostCorePluginConvergence(params: {
165166
}): Promise<PostCoreConvergenceResult> {
166167
const env: NodeJS.ProcessEnv = {
167168
...params.env,
168-
OPENCLAW_COMPATIBILITY_HOST_VERSION: VERSION,
169+
OPENCLAW_COMPATIBILITY_HOST_VERSION: params.compatibilityHostVersion ?? VERSION,
169170
[UPDATE_POST_CORE_CONVERGENCE_ENV]: "1",
170171
};
171172
const prunedBaseline = params.baselineInstallRecords

‎src/commands/doctor-config-preflight-plugin-verification.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
formatPluginVerificationDiagnostic,
99
type DegradedPlugin,
1010
} from "../plugins/runtime-degraded-state.js";
11+
import { resolveCompatibilityHostVersion } from "../version.js";
1112
import { measureDoctorConfigPreflightStep } from "./doctor-config-preflight-measure.js";
1213

1314
type StartupPluginVerificationDiagnostic = {
@@ -95,6 +96,7 @@ export async function runStartupUpgradeConvergence(params: {
9596
runPostCorePluginConvergence({
9697
cfg: params.cfg,
9798
env: params.env,
99+
compatibilityHostVersion: resolveCompatibilityHostVersion(params.env),
98100
baselineInstallRecords: plan.installRecords,
99101
}),
100102
params.measure,

‎src/commands/doctor-config-preflight.state-migration.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ describe("runDoctorConfigPreflight state migration", () => {
639639
expect(runPostCorePluginConvergence).toHaveBeenCalledWith({
640640
cfg: { gateway: { mode: "local", port: 19091 } },
641641
env: process.env,
642+
compatibilityHostVersion: expect.any(String),
642643
baselineInstallRecords: {},
643644
});
644645
expect(recordSuccessfulStartupMigrations).toHaveBeenCalledWith({
@@ -649,6 +650,33 @@ describe("runDoctorConfigPreflight state migration", () => {
649650
expect(startupMigrationLeaseRelease).toHaveBeenCalledOnce();
650651
});
651652

653+
it("pins startup plugin convergence to the explicit compatibility host version", async () => {
654+
needsStartupMigrationCheckpoint.mockReturnValue(true);
655+
const previousHostVersion = process.env.OPENCLAW_COMPATIBILITY_HOST_VERSION;
656+
process.env.OPENCLAW_COMPATIBILITY_HOST_VERSION = "2026.7.2-beta.7";
657+
658+
try {
659+
await runDoctorConfigPreflight({
660+
migrateLegacyConfig: false,
661+
invalidConfigNote: false,
662+
requireStartupMigrationCheckpoint: true,
663+
});
664+
} finally {
665+
if (previousHostVersion === undefined) {
666+
delete process.env.OPENCLAW_COMPATIBILITY_HOST_VERSION;
667+
} else {
668+
process.env.OPENCLAW_COMPATIBILITY_HOST_VERSION = previousHostVersion;
669+
}
670+
}
671+
672+
expect(runPostCorePluginConvergence).toHaveBeenCalledWith({
673+
cfg: { gateway: { mode: "local", port: 19091 } },
674+
env: expect.any(Object),
675+
compatibilityHostVersion: "2026.7.2-beta.7",
676+
baselineInstallRecords: {},
677+
});
678+
});
679+
652680
it("refuses startup when plugin migration inputs change during convergence", async () => {
653681
needsStartupMigrationCheckpoint.mockReturnValue(true);
654682
pluginMigrationFingerprint

0 commit comments

Comments
 (0)