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

推荐订阅源

美团技术团队
T
The Blog of Author Tim Ferriss
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
量子位
I
InfoQ
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog
J
Java Code Geeks
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
V
V2EX
腾讯CDC
P
Proofpoint News Feed
A
About on SuperTechFans
爱范儿
爱范儿
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI

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(config): surface backup restore copy failures in audi...
davidangular · 2026-05-02 · via Recent Commits to openclaw:main

@@ -127,6 +127,8 @@ function createConfigObserveAuditRecord(params: {

127127

clobberedPath: string | null;

128128

restoredFromBackup: boolean;

129129

restoredBackupPath: string | null;

130+

restoreErrorCode?: string | null;

131+

restoreErrorMessage?: string | null;

130132

}): ConfigObserveAuditRecord {

131133

return {

132134

ts: params.ts,

@@ -175,6 +177,8 @@ function createConfigObserveAuditRecord(params: {

175177

clobberedPath: params.clobberedPath,

176178

restoredFromBackup: params.restoredFromBackup,

177179

restoredBackupPath: params.restoredBackupPath,

180+

restoreErrorCode: params.restoreErrorCode ?? null,

181+

restoreErrorMessage: params.restoreErrorMessage ?? null,

178182

};

179183

}

180184

@@ -192,6 +196,24 @@ function createConfigObserveAuditAppendParams(

192196

};

193197

}

194198199+

function extractRestoreErrorDetails(error: unknown): {

200+

code: string | null;

201+

message: string | null;

202+

} {

203+

if (!error || typeof error !== "object") {

204+

return { code: null, message: typeof error === "string" ? error : null };

205+

}

206+

const code =

207+

"code" in error && typeof (error as { code?: unknown }).code === "string"

208+

? (error as { code: string }).code

209+

: null;

210+

const message =

211+

"message" in error && typeof (error as { message?: unknown }).message === "string"

212+

? (error as { message: string }).message

213+

: null;

214+

return { code, message };

215+

}

216+195217

function hashConfigRaw(raw: string | null): string {

196218

return crypto

197219

.createHash("sha256")

@@ -637,26 +659,43 @@ export async function maybeRecoverSuspiciousConfigRead(params: {

637659

});

638660639661

let restoredFromBackup = false;

662+

let restoreError: unknown;

640663

try {

641664

await params.deps.fs.promises.copyFile(backupPath, params.configPath);

642665

restoredFromBackup = true;

643-

} catch {}

666+

} catch (error) {

667+

restoreError = error;

668+

}

644669645-

params.deps.logger.warn(

646-

`Config auto-restored from backup: ${params.configPath} (${suspicious.join(", ")})`,

647-

);

670+

const restoreErrorDetails = restoredFromBackup

671+

? { code: null, message: null }

672+

: extractRestoreErrorDetails(restoreError);

673+674+

if (restoredFromBackup) {

675+

params.deps.logger.warn(

676+

`Config auto-restored from backup: ${params.configPath} (${suspicious.join(", ")})`,

677+

);

678+

} else {

679+

params.deps.logger.warn(

680+

`Config auto-restore from backup failed: ${params.configPath} (${suspicious.join(", ")}${

681+

restoreErrorDetails.message ? `; ${restoreErrorDetails.message}` : ""

682+

})`,

683+

);

684+

}

648685

await appendConfigAuditRecord(

649686

createConfigObserveAuditAppendParams(params.deps, {

650687

ts: now,

651688

configPath: params.configPath,

652-

valid: true,

689+

valid: restoredFromBackup,

653690

current,

654691

suspicious,

655692

lastKnownGood: entry.lastKnownGood,

656693

backup,

657694

clobberedPath,

658695

restoredFromBackup,

659696

restoredBackupPath: backupPath,

697+

restoreErrorCode: restoreErrorDetails.code,

698+

restoreErrorMessage: restoreErrorDetails.message,

660699

}),

661700

);

662701

@@ -727,26 +766,43 @@ export function maybeRecoverSuspiciousConfigReadSync(params: {

727766

});

728767729768

let restoredFromBackup = false;

769+

let restoreError: unknown;

730770

try {

731771

params.deps.fs.copyFileSync(backupPath, params.configPath);

732772

restoredFromBackup = true;

733-

} catch {}

773+

} catch (error) {

774+

restoreError = error;

775+

}

734776735-

params.deps.logger.warn(

736-

`Config auto-restored from backup: ${params.configPath} (${suspicious.join(", ")})`,

737-

);

777+

const restoreErrorDetails = restoredFromBackup

778+

? { code: null, message: null }

779+

: extractRestoreErrorDetails(restoreError);

780+781+

if (restoredFromBackup) {

782+

params.deps.logger.warn(

783+

`Config auto-restored from backup: ${params.configPath} (${suspicious.join(", ")})`,

784+

);

785+

} else {

786+

params.deps.logger.warn(

787+

`Config auto-restore from backup failed: ${params.configPath} (${suspicious.join(", ")}${

788+

restoreErrorDetails.message ? `; ${restoreErrorDetails.message}` : ""

789+

})`,

790+

);

791+

}

738792

appendConfigAuditRecordSync(

739793

createConfigObserveAuditAppendParams(params.deps, {

740794

ts: now,

741795

configPath: params.configPath,

742-

valid: true,

796+

valid: restoredFromBackup,

743797

current,

744798

suspicious,

745799

lastKnownGood: entry.lastKnownGood,

746800

backup,

747801

clobberedPath,

748802

restoredFromBackup,

749803

restoredBackupPath: backupPath,

804+

restoreErrorCode: restoreErrorDetails.code,

805+

restoreErrorMessage: restoreErrorDetails.message,

750806

}),

751807

);

752808