





















@@ -364,6 +364,64 @@ describe("loadEnabledBundlePiSettingsSnapshot", () => {
364364expect(pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot).toHaveBeenCalledOnce();
365365});
366366367+it("does not reuse a load-path current snapshot for a config with default load paths", async () => {
368+const workspaceDir = await tempDirs.make("openclaw-workspace-");
369+const pluginRoot = await createWorkspaceBundle({ workspaceDir });
370+const resolvedPluginRoot = await fs.realpath(pluginRoot);
371+await fs.writeFile(
372+path.join(pluginRoot, "settings.json"),
373+JSON.stringify({ hideThinkingBlock: true }),
374+"utf-8",
375+);
376+const staleSnapshot = {
377+policyHash: "policy",
378+manifestRegistry: {
379+diagnostics: [],
380+plugins: [
381+{
382+id: "claude-bundle",
383+origin: "workspace",
384+format: "bundle",
385+bundleFormat: "claude",
386+settingsFiles: ["settings.json"],
387+rootDir: resolvedPluginRoot,
388+},
389+],
390+},
391+normalizePluginId: (id: string) => id.trim(),
392+};
393+pluginMetadataSnapshotMocks.getCurrentPluginMetadataSnapshot.mockImplementation(
394+(params: { config?: unknown; requireDefaultDiscoveryContext?: boolean }) => {
395+if (params.config || params.requireDefaultDiscoveryContext) {
396+return undefined;
397+}
398+return staleSnapshot;
399+},
400+);
401+pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot.mockClear();
402+403+const snapshot = loadEnabledBundlePiSettingsSnapshot({
404+cwd: workspaceDir,
405+cfg: {
406+plugins: {
407+entries: {
408+"claude-bundle": { enabled: true },
409+},
410+},
411+},
412+});
413+414+expect(snapshot.hideThinkingBlock).toBe(true);
415+expect(pluginMetadataSnapshotMocks.getCurrentPluginMetadataSnapshot).toHaveBeenCalledTimes(2);
416+expect(pluginMetadataSnapshotMocks.getCurrentPluginMetadataSnapshot).toHaveBeenLastCalledWith({
417+env: process.env,
418+ workspaceDir,
419+allowWorkspaceScopedSnapshot: true,
420+requireDefaultDiscoveryContext: true,
421+});
422+expect(pluginMetadataSnapshotMocks.loadPluginMetadataSnapshot).toHaveBeenCalledOnce();
423+});
424+367425it("loads sanitized settings and MCP defaults from enabled bundle plugins", async () => {
368426const workspaceDir = await tempDirs.make("openclaw-workspace-");
369427const pluginRoot = await createWorkspaceBundle({ workspaceDir });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。