mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
fix(update): preserve RPC pre-update config
This commit is contained in:
@@ -95,6 +95,10 @@ import {
|
||||
type ResolvedGlobalInstallTarget,
|
||||
} from "../../infra/update-global.js";
|
||||
import { cleanupStaleManagedServiceUpdateHandoffs } from "../../infra/update-managed-service-handoff-cleanup.js";
|
||||
import {
|
||||
POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV,
|
||||
type PreUpdateConfigRestoreInput,
|
||||
} from "../../infra/update-post-core-context.js";
|
||||
import { runGatewayUpdate, type UpdateRunResult } from "../../infra/update-runner.js";
|
||||
import { normalizePluginsConfig, resolveEffectiveEnableState } from "../../plugins/config-state.js";
|
||||
import {
|
||||
@@ -167,7 +171,6 @@ const POST_CORE_UPDATE_CHANNEL_ENV = "OPENCLAW_UPDATE_POST_CORE_CHANNEL";
|
||||
const POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV = "OPENCLAW_UPDATE_POST_CORE_REQUESTED_CHANNEL";
|
||||
const POST_CORE_UPDATE_RESULT_PATH_ENV = "OPENCLAW_UPDATE_POST_CORE_RESULT_PATH";
|
||||
const POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV = "OPENCLAW_UPDATE_POST_CORE_INSTALL_RECORDS_PATH";
|
||||
const POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV = "OPENCLAW_UPDATE_POST_CORE_SOURCE_CONFIG_PATH";
|
||||
const POST_CORE_UPDATE_STARTED_AT_ENV = "OPENCLAW_UPDATE_POST_CORE_STARTED_AT_MS";
|
||||
const POST_CORE_UPDATE_RESULT_POLL_MS = 100;
|
||||
const PRE_UPDATE_CONFIG_SNAPSHOT_MAX_AGE_MS = 6 * 60 * 60 * 1000;
|
||||
@@ -222,11 +225,6 @@ type PostCorePluginUpdateResult = NonNullable<
|
||||
NonNullable<UpdateRunResult["postUpdate"]>["plugins"]
|
||||
>;
|
||||
|
||||
type PreUpdateConfigRestoreInput = {
|
||||
sourceConfig: OpenClawConfig;
|
||||
authoredConfig: OpenClawConfig;
|
||||
};
|
||||
|
||||
type MissingPluginInstallPayload = {
|
||||
pluginId: string;
|
||||
installPath?: string;
|
||||
@@ -2470,14 +2468,19 @@ export async function updateFinalizeCommand(opts: UpdateFinalizeOptions): Promis
|
||||
|
||||
const root = await resolveUpdateRoot();
|
||||
let configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
|
||||
const preFinalizeConfig = configSnapshot.valid
|
||||
? {
|
||||
sourceConfig: configSnapshot.sourceConfig,
|
||||
authoredConfig: isRecord(configSnapshot.parsed)
|
||||
? (configSnapshot.parsed as OpenClawConfig)
|
||||
: configSnapshot.sourceConfig,
|
||||
}
|
||||
: undefined;
|
||||
const preFinalizeConfig =
|
||||
(await readPostCorePreUpdateSourceConfig({
|
||||
sourceConfigPath: process.env[POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV],
|
||||
currentSnapshot: configSnapshot,
|
||||
})) ??
|
||||
(configSnapshot.valid
|
||||
? {
|
||||
sourceConfig: configSnapshot.sourceConfig,
|
||||
authoredConfig: isRecord(configSnapshot.parsed)
|
||||
? (configSnapshot.parsed as OpenClawConfig)
|
||||
: configSnapshot.sourceConfig,
|
||||
}
|
||||
: undefined);
|
||||
const requestedChannel = normalizeUpdateChannel(opts.channel);
|
||||
if (opts.channel && !requestedChannel) {
|
||||
defaultRuntime.error(`--channel must be "stable", "beta", or "dev" (got "${opts.channel}")`);
|
||||
|
||||
Reference in New Issue
Block a user