惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
量子位
GbyAI
GbyAI
腾讯CDC
T
Tailwind CSS Blog
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
Docker
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
Jina AI
Jina AI
IT之家
IT之家
Y
Y Combinator Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(update): preserve config during update repair · openc...
Jerry-Xin · 2026-05-14 · via Recent Commits to openclaw:main

@@ -1,4 +1,5 @@

11

import { spawn, type ChildProcess } from "node:child_process";

2+

import { existsSync } from "node:fs";

23

import fs from "node:fs/promises";

34

import os from "node:os";

45

import path from "node:path";

@@ -8,6 +9,7 @@ import {

89

ensureCompletionCacheExists,

910

} from "../../commands/doctor-completion.js";

1011

import { doctorCommand } from "../../commands/doctor.js";

12+

import { createPreUpdateConfigSnapshot } from "../../config/backup-rotation.js";

1113

import {

1214

ConfigMutationConflictError,

1315

assertConfigWriteAllowedInCurrentMode,

@@ -17,6 +19,7 @@ import {

1719

} from "../../config/config.js";

1820

import { formatConfigIssueLines } from "../../config/issue-format.js";

1921

import { asResolvedSourceConfig, asRuntimeConfig } from "../../config/materialize.js";

22+

import { CONFIG_PATH } from "../../config/paths.js";

2023

import type { OpenClawConfig } from "../../config/types.openclaw.js";

2124

import type { PluginInstallRecord } from "../../config/types.plugins.js";

2225

import { GATEWAY_SERVICE_KIND, GATEWAY_SERVICE_MARKER } from "../../daemon/constants.js";

@@ -138,6 +141,13 @@ const POST_INSTALL_DOCTOR_SERVICE_ENV_KEYS = [

138141

] as const;

139142

const POST_UPDATE_PLUGIN_REPAIR_GUIDANCE = "Run openclaw doctor --fix to attempt automatic repair.";

140143144+

async function createUpdateConfigSnapshot(): Promise<void> {

145+

await createPreUpdateConfigSnapshot({

146+

configPath: CONFIG_PATH,

147+

fs: { writeFile: fs.writeFile, readFile: fs.readFile, existsSync },

148+

});

149+

}

150+141151

const UPDATE_QUIPS = [

142152

"Leveled up! New skills unlocked. You're welcome.",

143153

"Fresh code, same lobster. Miss me?",

@@ -1025,6 +1035,7 @@ async function runPackageInstallUpdate(params: {

10251035

postVerifyStep: async (verifiedPackageRoot) => {

10261036

const entryPath = await resolveGatewayInstallEntrypoint(verifiedPackageRoot);

10271037

if (entryPath) {

1038+

await createUpdateConfigSnapshot();

10281039

return await runUpdateStep({

10291040

name: `${CLI_NAME} doctor`,

10301041

argv: [resolveNodeRunner(), entryPath, "doctor", "--non-interactive", "--fix"],

@@ -1645,9 +1656,11 @@ async function maybeRestartService(params: {

16451656

// that already produced the expected gateway version, a second kickstart

16461657

// would only race the healthy supervisor-owned process.

16471658

if (!refreshedGatewayAlreadyHealthy && params.restartScriptPath) {

1659+

await createUpdateConfigSnapshot();

16481660

await runRestartScript(params.restartScriptPath);

16491661

restartInitiated = true;

16501662

} else if (!refreshedGatewayAlreadyHealthy && params.refreshServiceEnv && isPackageUpdate) {

1663+

await createUpdateConfigSnapshot();

16511664

restarted = await runUpdatedInstallGatewayRestart({

16521665

result: params.result,

16531666

jsonMode: Boolean(params.opts.json),

@@ -1658,6 +1671,7 @@ async function maybeRestartService(params: {

16581671

!refreshedGatewayAlreadyHealthy &&

16591672

shouldUseLegacyProcessRestartAfterUpdate({ updateMode: params.result.mode })

16601673

) {

1674+

await createUpdateConfigSnapshot();

16611675

restarted = await runDaemonRestart();

16621676

} else if (!refreshedGatewayAlreadyHealthy && !params.opts.json) {

16631677

defaultRuntime.log(theme.muted("No installed gateway service found; skipped restart."));

@@ -1684,6 +1698,7 @@ async function maybeRestartService(params: {

16841698

if (!params.opts.json && restarted) {

16851699

defaultRuntime.log(theme.success("Daemon restarted successfully."));

16861700

defaultRuntime.log("");

1701+

await createUpdateConfigSnapshot();

16871702

process.env.OPENCLAW_UPDATE_IN_PROGRESS = "1";

16881703

process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = "1";

16891704

try {