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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
云风的 BLOG
云风的 BLOG
小众软件
小众软件
V
V2EX
博客园 - Franky
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
量子位
博客园 - 【当耐特】
雷峰网
雷峰网
WordPress大学
WordPress大学
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
Visual Studio Blog
Microsoft Security Blog
Microsoft Security Blog

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: prune legacy plugin runtime deps on install · opencl...
shakkernerd · 2026-05-03 · via Recent Commits to openclaw:main

@@ -4,10 +4,12 @@ import { tmpdir } from "node:os";

44

import path from "node:path";

55

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

66

import {

7+

collectLegacyPluginRuntimeDepsStateRoots,

78

isSourceCheckoutRoot,

89

isDirectPostinstallInvocation,

910

pruneOpenClawCompileCache,

1011

pruneInstalledPackageDist,

12+

pruneLegacyPluginRuntimeDepsState,

1113

pruneBundledPluginSourceNodeModules,

1214

runBundledPluginPostinstall,

1315

runPluginRegistryPostinstallMigration,

@@ -208,6 +210,25 @@ describe("bundled plugin postinstall", () => {

208210

);

209211

});

210212213+

it("does not prune user-state legacy runtime deps during source-checkout postinstall", async () => {

214+

const packageRoot = await createTempDirAsync("openclaw-source-checkout-state-skip-");

215+

const home = await createTempDirAsync("openclaw-source-checkout-home-");

216+

const legacyRuntimeRoot = path.join(home, ".openclaw", "plugin-runtime-deps");

217+

await fs.mkdir(path.join(packageRoot, ".git"), { recursive: true });

218+

await fs.mkdir(path.join(packageRoot, "src"), { recursive: true });

219+

await fs.mkdir(path.join(packageRoot, "extensions"), { recursive: true });

220+

await fs.mkdir(legacyRuntimeRoot, { recursive: true });

221+

await fs.writeFile(path.join(legacyRuntimeRoot, "package.json"), "{}\n");

222+223+

runBundledPluginPostinstall({

224+

env: { HOME: home },

225+

packageRoot,

226+

log: { log: vi.fn(), warn: vi.fn() },

227+

});

228+229+

await expect(fs.stat(legacyRuntimeRoot)).resolves.toBeTruthy();

230+

});

231+211232

it("honors disable env before source-checkout pruning", async () => {

212233

const packageRoot = await createTempDirAsync("openclaw-source-checkout-disabled-");

213234

const extensionsDir = path.join(packageRoot, "extensions");

@@ -373,6 +394,103 @@ describe("bundled plugin postinstall", () => {

373394

await expect(fs.stat(staleFile)).rejects.toMatchObject({ code: "ENOENT" });

374395

});

375396397+

it("prunes legacy plugin runtime deps state during packaged postinstall", async () => {

398+

const packageRoot = await createTempDirAsync("openclaw-packaged-state-cleanup-");

399+

const home = await createTempDirAsync("openclaw-packaged-home-");

400+

const stateOverride = path.join(home, "custom-state");

401+

const systemState = path.join(home, "system-state");

402+

const defaultLegacyRoot = path.join(home, ".openclaw", "plugin-runtime-deps");

403+

const oldBrandLegacyRoot = path.join(home, ".clawdbot", "plugin-runtime-deps");

404+

const overrideLegacyRoot = path.join(stateOverride, "plugin-runtime-deps");

405+

const systemLegacyRoot = path.join(systemState, "plugin-runtime-deps");

406+

const thirdPartyNodeModules = path.join(

407+

home,

408+

".openclaw",

409+

"extensions",

410+

"lossless-claw",

411+

"node_modules",

412+

);

413+

const currentFile = path.join(packageRoot, "dist", "entry.js");

414+415+

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

416+

await fs.writeFile(currentFile, "export {};\n");

417+

await writePackageDistInventory(packageRoot);

418+

for (const root of [

419+

defaultLegacyRoot,

420+

oldBrandLegacyRoot,

421+

overrideLegacyRoot,

422+

systemLegacyRoot,

423+

thirdPartyNodeModules,

424+

]) {

425+

await fs.mkdir(root, { recursive: true });

426+

await fs.writeFile(path.join(root, "package.json"), "{}\n");

427+

}

428+429+

const log = { log: vi.fn(), warn: vi.fn() };

430+

runBundledPluginPostinstall({

431+

env: {

432+

HOME: home,

433+

OPENCLAW_STATE_DIR: stateOverride,

434+

STATE_DIRECTORY: systemState,

435+

},

436+

packageRoot,

437+

log,

438+

});

439+440+

await expect(fs.stat(defaultLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });

441+

await expect(fs.stat(oldBrandLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });

442+

await expect(fs.stat(overrideLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });

443+

await expect(fs.stat(systemLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });

444+

await expect(fs.stat(thirdPartyNodeModules)).resolves.toBeTruthy();

445+

expect(log.warn).not.toHaveBeenCalled();

446+

expect(log.log).toHaveBeenCalledWith(

447+

expect.stringContaining("[postinstall] pruned legacy plugin runtime deps:"),

448+

);

449+

});

450+451+

it("keeps legacy plugin runtime deps cleanup non-fatal", () => {

452+

const warn = vi.fn();

453+454+

expect(() =>

455+

pruneLegacyPluginRuntimeDepsState({

456+

env: { HOME: "/home/alice" },

457+

existsSync: vi.fn(() => true),

458+

rmSync: vi.fn(() => {

459+

throw new Error("locked");

460+

}),

461+

log: { log: vi.fn(), warn },

462+

homedir: () => "/home/alice",

463+

}),

464+

).not.toThrow();

465+466+

expect(warn).toHaveBeenCalledWith(

467+

expect.stringContaining(

468+

"[postinstall] could not prune legacy plugin runtime deps /home/alice/.openclaw/plugin-runtime-deps: Error: locked",

469+

),

470+

);

471+

});

472+473+

it("resolves legacy plugin runtime deps roots from OpenClaw state env", () => {

474+

expect(

475+

collectLegacyPluginRuntimeDepsStateRoots({

476+

env: {

477+

HOME: "/users/alice",

478+

OPENCLAW_HOME: "/srv/openclaw-home",

479+

OPENCLAW_CONFIG_PATH: "~/profile/openclaw.json",

480+

OPENCLAW_STATE_DIR: "~/state",

481+

STATE_DIRECTORY: "/var/lib/openclaw",

482+

},

483+

homedir: () => "/users/alice",

484+

}),

485+

).toEqual([

486+

"/srv/openclaw-home/.clawdbot/plugin-runtime-deps",

487+

"/srv/openclaw-home/.openclaw/plugin-runtime-deps",

488+

"/srv/openclaw-home/profile/plugin-runtime-deps",

489+

"/srv/openclaw-home/state/plugin-runtime-deps",

490+

"/var/lib/openclaw/plugin-runtime-deps",

491+

]);

492+

});

493+376494

it("keeps imported dist chunks even when inventory is stale", async () => {

377495

const packageRoot = await createTempDirAsync("openclaw-packaged-install-import-");

378496

const entryFile = path.join(packageRoot, "dist", "cli", "run-main.js");