mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:10:44 +00:00
fix(update): preserve doctor repair writes in legacy handoff
This commit is contained in:
@@ -54,6 +54,21 @@ describe("doctor health contributions", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps repair writes from doctor config preflight writable during legacy update", () => {
|
||||
expect(
|
||||
shouldSkipLegacyUpdateDoctorMetadataWrite({
|
||||
env: { OPENCLAW_UPDATE_IN_PROGRESS: "1" },
|
||||
hasPendingConfigWrite: true,
|
||||
before: { gateway: { mode: "remote" } },
|
||||
after: {
|
||||
gateway: { mode: "remote" },
|
||||
meta: { lastTouchedVersion: "2026.4.27" },
|
||||
wizard: { lastRunCommand: "doctor" },
|
||||
},
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps current update parents writable", () => {
|
||||
expect(
|
||||
shouldSkipLegacyUpdateDoctorMetadataWrite({
|
||||
|
||||
@@ -59,6 +59,7 @@ function omitDoctorWriteMetadata(cfg: OpenClawConfig): OpenClawConfig {
|
||||
|
||||
export function shouldSkipLegacyUpdateDoctorMetadataWrite(params: {
|
||||
env: NodeJS.ProcessEnv;
|
||||
hasPendingConfigWrite?: boolean;
|
||||
before: OpenClawConfig;
|
||||
after: OpenClawConfig;
|
||||
}): boolean {
|
||||
@@ -68,6 +69,9 @@ export function shouldSkipLegacyUpdateDoctorMetadataWrite(params: {
|
||||
if (isTruthyEnvValue(params.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV])) {
|
||||
return false;
|
||||
}
|
||||
if (params.hasPendingConfigWrite === true) {
|
||||
return false;
|
||||
}
|
||||
return isDeepStrictEqual(
|
||||
omitDoctorWriteMetadata(params.before),
|
||||
omitDoctorWriteMetadata(params.after),
|
||||
@@ -533,6 +537,7 @@ async function runWriteConfigHealth(ctx: DoctorHealthFlowContext): Promise<void>
|
||||
if (
|
||||
shouldSkipLegacyUpdateDoctorMetadataWrite({
|
||||
env: ctx.env ?? process.env,
|
||||
hasPendingConfigWrite: ctx.configResult.shouldWriteConfig === true,
|
||||
before: ctx.cfgForPersistence,
|
||||
after: ctx.cfg,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user