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

推荐订阅源

雷峰网
雷峰网
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
L
LangChain Blog
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
量子位
The GitHub Blog
The GitHub 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(cli): disable source checkout compile cache · opencla...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -0,0 +1,109 @@

1+

import fs from "node:fs/promises";

2+

import path from "node:path";

3+

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

4+

import { cleanupTempDirs, makeTempDir } from "../test/helpers/temp-dir.js";

5+

import {

6+

buildOpenClawCompileCacheRespawnPlan,

7+

isSourceCheckoutInstallRoot,

8+

resolveEntryInstallRoot,

9+

shouldEnableOpenClawCompileCache,

10+

} from "./entry.compile-cache.js";

11+12+

describe("entry compile cache", () => {

13+

const tempDirs: string[] = [];

14+15+

afterEach(() => {

16+

cleanupTempDirs(tempDirs);

17+

});

18+19+

it("resolves install roots from source and dist entry paths", () => {

20+

expect(resolveEntryInstallRoot("/repo/openclaw/src/entry.ts")).toBe("/repo/openclaw");

21+

expect(resolveEntryInstallRoot("/repo/openclaw/dist/entry.js")).toBe("/repo/openclaw");

22+

expect(resolveEntryInstallRoot("/pkg/openclaw/entry.js")).toBe("/pkg/openclaw");

23+

});

24+25+

it("treats git and source entry markers as source checkouts", async () => {

26+

const root = makeTempDir(tempDirs, "openclaw-compile-cache-source-");

27+

await fs.writeFile(path.join(root, ".git"), "gitdir: .git/worktrees/openclaw\n", "utf8");

28+29+

expect(isSourceCheckoutInstallRoot(root)).toBe(true);

30+

});

31+32+

it("disables compile cache for source-checkout installs", async () => {

33+

const root = makeTempDir(tempDirs, "openclaw-compile-cache-src-entry-");

34+

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

35+

await fs.writeFile(path.join(root, "src", "entry.ts"), "export {};\n", "utf8");

36+37+

expect(

38+

shouldEnableOpenClawCompileCache({

39+

env: {},

40+

installRoot: root,

41+

}),

42+

).toBe(false);

43+

});

44+45+

it("keeps compile cache enabled for packaged installs unless disabled by env", () => {

46+

const root = makeTempDir(tempDirs, "openclaw-compile-cache-package-");

47+48+

expect(shouldEnableOpenClawCompileCache({ env: {}, installRoot: root })).toBe(true);

49+

expect(

50+

shouldEnableOpenClawCompileCache({

51+

env: { NODE_DISABLE_COMPILE_CACHE: "1" },

52+

installRoot: root,

53+

}),

54+

).toBe(false);

55+

});

56+57+

it("builds a one-shot no-cache respawn plan when source checkout inherits NODE_COMPILE_CACHE", async () => {

58+

const root = makeTempDir(tempDirs, "openclaw-compile-cache-respawn-");

59+

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

60+

await fs.writeFile(path.join(root, "src", "entry.ts"), "export {};\n", "utf8");

61+62+

const plan = buildOpenClawCompileCacheRespawnPlan({

63+

currentFile: path.join(root, "dist", "entry.js"),

64+

env: { NODE_COMPILE_CACHE: "/tmp/openclaw-cache" },

65+

execArgv: ["--no-warnings"],

66+

execPath: "/usr/bin/node",

67+

installRoot: root,

68+

argv: ["/usr/bin/node", path.join(root, "dist", "entry.js"), "status", "--json"],

69+

});

70+71+

expect(plan).toEqual({

72+

command: "/usr/bin/node",

73+

args: ["--no-warnings", path.join(root, "dist", "entry.js"), "status", "--json"],

74+

env: {

75+

NODE_DISABLE_COMPILE_CACHE: "1",

76+

OPENCLAW_SOURCE_COMPILE_CACHE_RESPAWNED: "1",

77+

},

78+

});

79+

});

80+81+

it("does not respawn packaged installs when NODE_COMPILE_CACHE is configured", () => {

82+

const root = makeTempDir(tempDirs, "openclaw-compile-cache-package-respawn-");

83+84+

expect(

85+

buildOpenClawCompileCacheRespawnPlan({

86+

currentFile: path.join(root, "dist", "entry.js"),

87+

env: { NODE_COMPILE_CACHE: "/tmp/openclaw-cache" },

88+

installRoot: root,

89+

}),

90+

).toBeUndefined();

91+

});

92+93+

it("does not respawn source checkouts twice", async () => {

94+

const root = makeTempDir(tempDirs, "openclaw-compile-cache-respawn-once-");

95+

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

96+

await fs.writeFile(path.join(root, "src", "entry.ts"), "export {};\n", "utf8");

97+98+

expect(

99+

buildOpenClawCompileCacheRespawnPlan({

100+

currentFile: path.join(root, "dist", "entry.js"),

101+

env: {

102+

NODE_COMPILE_CACHE: "/tmp/openclaw-cache",

103+

OPENCLAW_SOURCE_COMPILE_CACHE_RESPAWNED: "1",

104+

},

105+

installRoot: root,

106+

}),

107+

).toBeUndefined();

108+

});

109+

});