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

推荐订阅源

爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
B
Blog
U
Unit 42
B
Blog RSS Feed
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
腾讯CDC
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - 聂微东
MyScale Blog
MyScale Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
Engineering at Meta
Engineering at Meta

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: reuse plugin snapshot for embedded settings · opencl...
shakkernerd · 2026-05-06 · via Recent Commits to openclaw:main

@@ -3,6 +3,11 @@ import path from "node:path";

33

import { afterEach, describe, expect, it, vi } from "vitest";

44

import { createTrackedTempDirs } from "../test-utils/tracked-temp-dirs.js";

556+

const pluginMetadataSnapshotMocks = vi.hoisted(() => ({

7+

isPluginMetadataSnapshotCompatible: vi.fn(),

8+

loadPluginMetadataSnapshot: vi.fn(),

9+

}));

10+611

vi.mock("../infra/boundary-file-read.js", async () => {

712

const fs = await import("node:fs");

813

return {

@@ -107,11 +112,17 @@ vi.mock("../plugins/plugin-metadata-snapshot.js", async () => {

107112

],

108113

};

109114

};

110-

return {

111-

loadPluginMetadataSnapshot: (params: { workspaceDir?: string }) => ({

115+

pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible.mockImplementation(() => false);

116+

pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot.mockImplementation(

117+

(params: { workspaceDir?: string }) => ({

112118

manifestRegistry: loadRegistry(params),

113119

normalizePluginId: (id: string) => id.trim(),

114120

}),

121+

);

122+

return {

123+

isPluginMetadataSnapshotCompatible:

124+

pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible,

125+

loadPluginMetadataSnapshot: pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot,

115126

};

116127

});

117128

@@ -161,6 +172,8 @@ const tempDirs = createTrackedTempDirs();

161172162173

afterEach(async () => {

163174

await tempDirs.cleanup();

175+

pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible.mockClear();

176+

pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot.mockClear();

164177

});

165178166179

async function createWorkspaceBundle(params: {

@@ -181,6 +194,87 @@ async function createWorkspaceBundle(params: {

181194

}

182195183196

describe("loadEnabledBundlePiSettingsSnapshot", () => {

197+

it("reuses a compatible plugin metadata snapshot without loading a fresh one", async () => {

198+

const workspaceDir = await tempDirs.make("openclaw-workspace-");

199+

const pluginRoot = await createWorkspaceBundle({ workspaceDir });

200+

const resolvedPluginRoot = await fs.realpath(pluginRoot);

201+

await fs.writeFile(

202+

path.join(pluginRoot, "settings.json"),

203+

JSON.stringify({ hideThinkingBlock: true }),

204+

"utf-8",

205+

);

206+207+

pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible.mockReturnValueOnce(true);

208+

pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot.mockClear();

209+210+

const snapshot = loadEnabledBundlePiSettingsSnapshot({

211+

cwd: workspaceDir,

212+

cfg: {

213+

plugins: {

214+

entries: {

215+

"claude-bundle": { enabled: true },

216+

},

217+

},

218+

},

219+

pluginMetadataSnapshot: {

220+

manifestRegistry: {

221+

diagnostics: [],

222+

plugins: [

223+

{

224+

id: "claude-bundle",

225+

origin: "workspace",

226+

format: "bundle",

227+

bundleFormat: "claude",

228+

settingsFiles: ["settings.json"],

229+

rootDir: resolvedPluginRoot,

230+

},

231+

],

232+

},

233+

normalizePluginId: (id: string) => id.trim(),

234+

} as unknown as Parameters<

235+

typeof loadEnabledBundlePiSettingsSnapshot

236+

>[0]["pluginMetadataSnapshot"],

237+

});

238+239+

expect(snapshot.hideThinkingBlock).toBe(true);

240+

expect(pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible).toHaveBeenCalledOnce();

241+

expect(pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot).not.toHaveBeenCalled();

242+

});

243+244+

it("falls back to a fresh plugin metadata load for an incompatible snapshot", async () => {

245+

const workspaceDir = await tempDirs.make("openclaw-workspace-");

246+

const pluginRoot = await createWorkspaceBundle({ workspaceDir });

247+

await fs.writeFile(

248+

path.join(pluginRoot, "settings.json"),

249+

JSON.stringify({ hideThinkingBlock: true }),

250+

"utf-8",

251+

);

252+253+

pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible.mockReturnValueOnce(false);

254+

pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot.mockClear();

255+256+

const snapshot = loadEnabledBundlePiSettingsSnapshot({

257+

cwd: workspaceDir,

258+

cfg: {

259+

plugins: {

260+

entries: {

261+

"claude-bundle": { enabled: true },

262+

},

263+

},

264+

},

265+

pluginMetadataSnapshot: {

266+

manifestRegistry: { diagnostics: [], plugins: [] },

267+

normalizePluginId: (id: string) => id.trim(),

268+

} as unknown as Parameters<

269+

typeof loadEnabledBundlePiSettingsSnapshot

270+

>[0]["pluginMetadataSnapshot"],

271+

});

272+273+

expect(snapshot.hideThinkingBlock).toBe(true);

274+

expect(pluginMetadataSnapshotMocks.isPluginMetadataSnapshotCompatible).toHaveBeenCalledOnce();

275+

expect(pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot).toHaveBeenCalledOnce();

276+

});

277+184278

it("loads sanitized settings and MCP defaults from enabled bundle plugins", async () => {

185279

const workspaceDir = await tempDirs.make("openclaw-workspace-");

186280

const pluginRoot = await createWorkspaceBundle({ workspaceDir });