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

推荐订阅源

博客园 - 叶小钗
爱范儿
爱范儿
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
博客园 - 聂微东
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
宝玉的分享
宝玉的分享
罗磊的独立博客
Jina AI
Jina 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(plugins): reject stale registry policy reads · opencl...
vincentkoc · 2026-04-26 · via Recent Commits to openclaw:main

@@ -3,7 +3,10 @@ import path from "node:path";

33

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

44

import type { PluginCandidate } from "./discovery.js";

55

import { writePersistedInstalledPluginIndex } from "./installed-plugin-index-store.js";

6-

import type { InstalledPluginIndex } from "./installed-plugin-index.js";

6+

import {

7+

resolveInstalledPluginIndexPolicyHash,

8+

type InstalledPluginIndex,

9+

} from "./installed-plugin-index.js";

710

import {

811

DISABLE_PERSISTED_PLUGIN_REGISTRY_ENV,

912

createPluginRegistryIdNormalizer,

@@ -91,7 +94,10 @@ function createCandidate(rootDir: string): PluginCandidate {

9194

};

9295

}

939694-

function createIndex(pluginId = "demo"): InstalledPluginIndex {

97+

function createIndex(

98+

pluginId = "demo",

99+

overrides: Partial<InstalledPluginIndex> = {},

100+

): InstalledPluginIndex {

95101

return {

96102

version: 1,

97103

hostContractVersion: "2026.4.25",

@@ -127,6 +133,7 @@ function createIndex(pluginId = "demo"): InstalledPluginIndex {

127133

},

128134

],

129135

diagnostics: [],

136+

...overrides,

130137

};

131138

}

132139

@@ -241,11 +248,18 @@ describe("plugin registry facade", () => {

241248

const stateDir = makeTempDir();

242249

const rootDir = makeTempDir();

243250

const candidate = createCandidate(rootDir);

244-

await writePersistedInstalledPluginIndex(createIndex("persisted"), { stateDir });

251+

const config = {} as const;

252+

await writePersistedInstalledPluginIndex(

253+

createIndex("persisted", {

254+

policyHash: resolveInstalledPluginIndexPolicyHash(config),

255+

}),

256+

{ stateDir },

257+

);

245258246259

const result = loadPluginRegistrySnapshotWithMetadata({

247260

stateDir,

248261

candidates: [candidate],

262+

config,

249263

env: hermeticEnv(),

250264

});

251265

@@ -256,6 +270,37 @@ describe("plugin registry facade", () => {

256270

]);

257271

});

258272273+

it("falls back to the derived registry when persisted policy is stale", async () => {

274+

const stateDir = makeTempDir();

275+

const rootDir = makeTempDir();

276+

const candidate = createCandidate(rootDir);

277+

await writePersistedInstalledPluginIndex(

278+

createIndex("persisted", {

279+

policyHash: resolveInstalledPluginIndexPolicyHash({

280+

plugins: { entries: { persisted: { enabled: true } } },

281+

}),

282+

}),

283+

{ stateDir },

284+

);

285+286+

const result = loadPluginRegistrySnapshotWithMetadata({

287+

stateDir,

288+

candidates: [candidate],

289+

config: {

290+

plugins: { entries: { demo: { enabled: true } } },

291+

},

292+

env: hermeticEnv(),

293+

});

294+295+

expect(result.source).toBe("derived");

296+

expect(result.diagnostics).toEqual([

297+

expect.objectContaining({ code: "persisted-registry-stale-policy" }),

298+

]);

299+

expect(listPluginRecords({ index: result.snapshot }).map((plugin) => plugin.pluginId)).toEqual([

300+

"demo",

301+

]);

302+

});

303+259304

it("falls back to the derived registry when the persisted registry is missing", () => {

260305

const stateDir = makeTempDir();

261306

const rootDir = makeTempDir();