






















@@ -7,6 +7,7 @@ import type {
77GatewayAuthMode,
88GatewayBindMode,
99GatewayTailscaleMode,
10+ReadConfigFileSnapshotWithPluginMetadataResult,
1011} from "../../config/config.js";
1112import { formatConfigIssueSummary } from "../../config/issue-format.js";
1213import { CONFIG_PATH, resolveGatewayPort, resolveStateDir } from "../../config/paths.js";
@@ -271,18 +272,21 @@ function getGatewayStartGuardErrors(params: {
271272272273async function readGatewayStartupConfig(params: {
273274startupTrace: ReturnType<typeof createGatewayCliStartupTrace>;
274-}): Promise<{ cfg: OpenClawConfig; snapshot: ConfigFileSnapshot | null }> {
275+}): Promise<{
276+cfg: OpenClawConfig;
277+snapshot: ConfigFileSnapshot | null;
278+startupConfigSnapshotRead?: ReadConfigFileSnapshotWithPluginMetadataResult;
279+}> {
275280const {
276- readBestEffortConfig,
277- readConfigFileSnapshot,
281+ readConfigFileSnapshotWithPluginMetadata,
278282 recoverConfigFromLastKnownGood,
279283 recoverConfigFromJsonRootSuffix,
280284} = await import("../../config/config.js");
281-let cfg = await params.startupTrace.measure("cli.config-load", () => readBestEffortConfig());
282-let snapshot: ConfigFileSnapshot | null = await params.startupTrace.measure(
283-"cli.config-snapshot",
284-() => readConfigFileSnapshot().catch(() => null),
285-);
285+let snapshotRead: ReadConfigFileSnapshotWithPluginMetadataResult | null =
286+ await params.startupTrace.measure("cli.config-snapshot", () =>
287+ readConfigFileSnapshotWithPluginMetadata().catch(() => null),
288+);
289+let snapshot: ConfigFileSnapshot | null = snapshotRead?.snapshot ?? null;
286290if (snapshot?.exists && !snapshot.valid) {
287291const invalidSnapshot = snapshot;
288292const recovered = await params.startupTrace.measure("cli.config-recovery", () =>
@@ -317,9 +321,10 @@ async function readGatewayStartupConfig(params: {
317321`gateway: failed to persist config auto-recovery notice: ${formatErrorMessage(err)}`,
318322);
319323}
320-snapshot = await params.startupTrace.measure("cli.config-snapshot-reload", () =>
321-readConfigFileSnapshot().catch(() => null),
324+snapshotRead = await params.startupTrace.measure("cli.config-snapshot-reload", () =>
325+readConfigFileSnapshotWithPluginMetadata().catch(() => null),
322326);
327+snapshot = snapshotRead?.snapshot ?? null;
323328} else {
324329const repaired = await params.startupTrace.measure("cli.config-prefix-recovery", () =>
325330recoverConfigFromJsonRootSuffix(invalidSnapshot),
@@ -328,16 +333,19 @@ async function readGatewayStartupConfig(params: {
328333gatewayLog.warn(
329334`gateway: repaired invalid effective config by stripping a non-JSON prefix: ${invalidSnapshot.path}`,
330335);
331-snapshot = await params.startupTrace.measure("cli.config-snapshot-reload", () =>
332-readConfigFileSnapshot().catch(() => null),
336+snapshotRead = await params.startupTrace.measure("cli.config-snapshot-reload", () =>
337+readConfigFileSnapshotWithPluginMetadata().catch(() => null),
333338);
339+snapshot = snapshotRead?.snapshot ?? null;
334340}
335341}
336342}
337-if (snapshot?.valid) {
338-cfg = snapshot.config;
339-}
340-return { cfg, snapshot };
343+const cfg = snapshot?.config ?? {};
344+return {
345+ cfg,
346+ snapshot,
347+ ...(snapshotRead ? { startupConfigSnapshotRead: snapshotRead } : {}),
348+};
341349}
342350343351function resolveGatewayRunOptions(opts: GatewayRunOpts, command?: Command): GatewayRunOpts {
@@ -563,7 +571,9 @@ async function runGatewayCommand(opts: GatewayRunOpts) {
563571}
564572565573gatewayLog.info("loading configuration…");
566-const { cfg, snapshot } = await readGatewayStartupConfig({ startupTrace });
574+const { cfg, snapshot, startupConfigSnapshotRead } = await readGatewayStartupConfig({
575+ startupTrace,
576+});
567577void maybeLogPendingControlUiBuild(cfg).catch((err) => {
568578gatewayLog.warn(`Control UI asset check failed: ${String(err)}`);
569579});
@@ -842,6 +852,7 @@ async function runGatewayCommand(opts: GatewayRunOpts) {
842852auth: authOverride,
843853tailscale: tailscaleOverride,
844854 startupStartedAt,
855+ ...(startupConfigSnapshotRead ? { startupConfigSnapshotRead } : {}),
845856}),
846857});
847858此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。