fix(cli): suppress self-update version warnings

This commit is contained in:
Vincent Koc
2026-05-25 08:07:55 +02:00
parent aa50c51902
commit e2bd20f0aa
4 changed files with 122 additions and 1 deletions

View File

@@ -2750,6 +2750,7 @@ async function continuePostCoreUpdateInFreshProcess(params: {
stdio: childStdio,
env: {
...stripGatewayServiceMarkerEnv(disableUpdatedPackageCompileCacheEnv(process.env)),
OPENCLAW_UPDATE_IN_PROGRESS: "1",
[POST_CORE_UPDATE_ENV]: "1",
[POST_CORE_UPDATE_CHANNEL_ENV]: params.channel,
...(params.requestedChannel
@@ -2906,7 +2907,25 @@ async function markControlPlaneUpdateRestartSentinelFailureBestEffort(params: {
}
}
async function withUpdateInProgressEnv<T>(run: () => Promise<T>): Promise<T> {
const previousUpdateInProgress = process.env.OPENCLAW_UPDATE_IN_PROGRESS;
process.env.OPENCLAW_UPDATE_IN_PROGRESS = "1";
return run().finally(() => {
if (previousUpdateInProgress === undefined) {
delete process.env.OPENCLAW_UPDATE_IN_PROGRESS;
} else {
process.env.OPENCLAW_UPDATE_IN_PROGRESS = previousUpdateInProgress;
}
});
}
export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
return await withUpdateInProgressEnv(async () => {
await updateCommandInternal(opts);
});
}
async function updateCommandInternal(opts: UpdateCommandOptions): Promise<void> {
suppressDeprecations();
await cleanupStaleManagedServiceUpdateHandoffs().catch(() => undefined);
const invocationCwd = tryResolveInvocationCwd();