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

推荐订阅源

T
Tailwind CSS Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
L
LangChain Blog
博客园_首页
Recent Announcements
Recent Announcements
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
博客园 - 叶小钗
博客园 - 【当耐特】
The Cloudflare Blog
J
Java Code Geeks
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans

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): preserve include writes with plugin validati...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -11,17 +11,24 @@ import {

1111

import { registerRuntimeConfigWriteListener, resetConfigRuntimeState } from "./runtime-snapshot.js";

1212

import type { ConfigFileSnapshot, OpenClawConfig } from "./types.js";

131314+

type MockValidationIssue = { path: string; message: string };

15+

type MockValidationResult =

16+

| { ok: true; config: OpenClawConfig; warnings: MockValidationIssue[] }

17+

| { ok: false; issues: MockValidationIssue[]; warnings: MockValidationIssue[] };

18+1419

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

1520

readConfigFileSnapshotForWrite: vi.fn(),

1621

resolveConfigSnapshotHash: vi.fn(),

1722

writeConfigFile: vi.fn(),

1823

}));

1924

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

20-

validateConfigObjectWithPlugins: vi.fn((config: OpenClawConfig) => ({

21-

ok: true,

22-

config,

23-

warnings: [],

24-

})),

25+

validateConfigObjectWithPlugins: vi.fn(

26+

(config: OpenClawConfig): MockValidationResult => ({

27+

ok: true,

28+

config,

29+

warnings: [],

30+

}),

31+

),

2532

}));

26332734

vi.mock("./io.js", () => ioMocks);

@@ -533,6 +540,132 @@ describe("config mutate helpers", () => {

533540

expect(persistedPlugins.installs).toBeUndefined();

534541

});

535542543+

it("keeps single-file top-level plugins include writes when plugin validation is skipped", async () => {

544+

const home = await suiteRootTracker.make("include-skip-plugin-validation");

545+

const configPath = path.join(home, ".openclaw", "openclaw.json");

546+

const pluginsPath = path.join(home, ".openclaw", "config", "plugins.json5");

547+

await fs.mkdir(path.dirname(pluginsPath), { recursive: true });

548+

await fs.writeFile(

549+

configPath,

550+

`${JSON.stringify({ plugins: { $include: "./config/plugins.json5" } }, null, 2)}\n`,

551+

"utf-8",

552+

);

553+

await fs.writeFile(pluginsPath, `${JSON.stringify({ entries: {} }, null, 2)}\n`, "utf-8");

554+

const snapshot = createSnapshot({

555+

hash: "hash-include-skip",

556+

path: configPath,

557+

parsed: { plugins: { $include: "./config/plugins.json5" } },

558+

sourceConfig: { plugins: { entries: {} } },

559+

});

560+

const refreshedSnapshot = createSnapshot({

561+

hash: "hash-include-skip-refreshed",

562+

path: configPath,

563+

parsed: { plugins: { $include: "./config/plugins.json5" } },

564+

sourceConfig: {

565+

plugins: {

566+

entries: {

567+

"strict-plugin": { enabled: true },

568+

},

569+

},

570+

},

571+

});

572+

ioMocks.readConfigFileSnapshotForWrite.mockResolvedValue({

573+

snapshot: refreshedSnapshot,

574+

writeOptions: { expectedConfigPath: configPath },

575+

});

576+

const nextConfig: OpenClawConfig = {

577+

plugins: {

578+

entries: {

579+

"strict-plugin": { enabled: true },

580+

},

581+

},

582+

};

583+584+

await replaceConfigFile({

585+

baseHash: snapshot.hash,

586+

snapshot,

587+

writeOptions: {

588+

expectedConfigPath: snapshot.path,

589+

skipPluginValidation: true,

590+

},

591+

nextConfig,

592+

});

593+594+

expect(ioMocks.writeConfigFile).not.toHaveBeenCalled();

595+

expect(validationMocks.validateConfigObjectWithPlugins).toHaveBeenCalledWith(nextConfig, {

596+

pluginValidation: "skip",

597+

});

598+

expect(ioMocks.readConfigFileSnapshotForWrite).toHaveBeenCalledWith({

599+

skipPluginValidation: true,

600+

});

601+

await expect(fs.readFile(configPath, "utf-8")).resolves.toContain(

602+

'"$include": "./config/plugins.json5"',

603+

);

604+

const persistedPlugins = JSON.parse(await fs.readFile(pluginsPath, "utf-8")) as {

605+

entries?: Record<string, unknown>;

606+

};

607+

expect(persistedPlugins.entries?.["strict-plugin"]).toEqual({ enabled: true });

608+

});

609+610+

it("rejects invalid base config before skipped-plugin include writes", async () => {

611+

const home = await suiteRootTracker.make("include-skip-invalid-base");

612+

const configPath = path.join(home, ".openclaw", "openclaw.json");

613+

const pluginsPath = path.join(home, ".openclaw", "config", "plugins.json5");

614+

await fs.mkdir(path.dirname(pluginsPath), { recursive: true });

615+

await fs.writeFile(

616+

configPath,

617+

`${JSON.stringify({ plugins: { $include: "./config/plugins.json5" } }, null, 2)}\n`,

618+

"utf-8",

619+

);

620+

await fs.writeFile(

621+

pluginsPath,

622+

`${JSON.stringify({ entries: { old: { enabled: true } } }, null, 2)}\n`,

623+

"utf-8",

624+

);

625+

const snapshot = createSnapshot({

626+

hash: "hash-include-invalid-base",

627+

path: configPath,

628+

parsed: { plugins: { $include: "./config/plugins.json5" } },

629+

sourceConfig: { plugins: { entries: { old: { enabled: true } } } },

630+

});

631+

const nextConfig = {

632+

plugins: {

633+

entries: {

634+

"strict-plugin": { enabled: "yes" },

635+

},

636+

},

637+

} as unknown as OpenClawConfig;

638+

validationMocks.validateConfigObjectWithPlugins.mockReturnValue({

639+

ok: false,

640+

issues: [

641+

{

642+

path: "plugins.entries.strict-plugin.enabled",

643+

message: "Expected boolean",

644+

},

645+

],

646+

warnings: [],

647+

});

648+649+

await expect(

650+

replaceConfigFile({

651+

baseHash: snapshot.hash,

652+

snapshot,

653+

writeOptions: {

654+

expectedConfigPath: snapshot.path,

655+

skipPluginValidation: true,

656+

},

657+

nextConfig,

658+

}),

659+

).rejects.toThrow("plugins.entries.strict-plugin.enabled: Expected boolean");

660+661+

expect(ioMocks.writeConfigFile).not.toHaveBeenCalled();

662+

expect(ioMocks.readConfigFileSnapshotForWrite).not.toHaveBeenCalled();

663+

const persistedPlugins = JSON.parse(await fs.readFile(pluginsPath, "utf-8")) as {

664+

entries?: Record<string, unknown>;

665+

};

666+

expect(persistedPlugins.entries).toEqual({ old: { enabled: true } });

667+

});

668+536669

it("falls back to the root writer when a plugins include write is not isolated", async () => {

537670

const snapshot = createSnapshot({

538671

hash: "hash-multi",