Skip to content

Commit 77ae06b

Browse files
committed
fix: skip compile cache permission warnings (#76362) (thanks @neeravmakwana)
1 parent 5d03fb2 commit 77ae06b

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ Docs: https://docs.openclaw.ai
328328
- Config/recovery: chmod restored `openclaw.json` back to owner-only (`0600`) after suspicious-read backup recovery on POSIX hosts, so a previously world-readable config mode cannot persist into a freshly restored credential-bearing config. (#77488) Thanks @drobison00.
329329
- Memory/dreaming: persist last dreaming-ingestion calendar day per daily note in `daily-ingestion.json` so unchanged notes are still re-ingested once per dreaming day for promotion signals toward deep thresholds. Fixes #76225. (#76359) Thanks @neeravmakwana.
330330
- Agents/embed: keep message_end safety delivery armed when a silent text_end chunk produces no block reply, fixing dropped Telegram/forum replies. Fixes #77833. (#77840) Thanks @neeravmakwana.
331+
- Install/postinstall: skip noisy compile-cache prune warnings when `EACCES`/`EPERM` prevent removing shared `/tmp/node-compile-cache` entries owned by another user. Fixes #76353. (#76362) Thanks @RayWoo and @neeravmakwana.
331332

332333
## 2026.5.3-1
333334

scripts/postinstall-bundled-plugins.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ function shouldRunBundledPluginPostinstall(params) {
814814
return true;
815815
}
816816

817+
function isCompileCachePrunePermissionDenied(error) {
818+
return error?.code === "EACCES" || error?.code === "EPERM";
819+
}
820+
817821
export function pruneOpenClawCompileCache(params = {}) {
818822
const env = params.env ?? process.env;
819823
const pathExists = params.existsSync ?? existsSync;
@@ -842,10 +846,16 @@ export function pruneOpenClawCompileCache(params = {}) {
842846
retryDelay: 100,
843847
});
844848
} catch (error) {
849+
if (isCompileCachePrunePermissionDenied(error)) {
850+
continue;
851+
}
845852
log.warn?.(`[postinstall] could not prune OpenClaw compile cache: ${String(error)}`);
846853
}
847854
}
848855
} catch (error) {
856+
if (isCompileCachePrunePermissionDenied(error)) {
857+
continue;
858+
}
849859
log.warn?.(`[postinstall] could not prune OpenClaw compile cache: ${String(error)}`);
850860
}
851861
}

test/scripts/postinstall-bundled-plugins.test.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,57 @@ describe("bundled plugin postinstall", () => {
147147
);
148148
});
149149

150+
it("does not warn when compile-cache pruning hits EACCES or EPERM (shared caches)", () => {
151+
const base = path.join("/tmp", "openclaw-shared-compile-cache");
152+
const dirA = path.join(base, "v22.13.1-x64-efe9a9df-1001");
153+
const dirB = path.join(base, "v22.13.1-x64-efe9a9df-1002");
154+
const warn = vi.fn();
155+
const rmSync = vi.fn((value: string) => {
156+
if (value === dirA) {
157+
throw Object.assign(new Error(`permission denied pruning ${value}`), { code: "EACCES" });
158+
}
159+
if (value === dirB) {
160+
throw Object.assign(new Error(`operation not permitted pruning ${value}`), {
161+
code: "EPERM",
162+
});
163+
}
164+
});
165+
166+
pruneOpenClawCompileCache({
167+
env: { NODE_COMPILE_CACHE: base },
168+
existsSync: vi.fn((value: string) => value === base),
169+
readdirSync: vi.fn(() => [
170+
{ name: path.basename(dirA), isDirectory: () => true },
171+
{ name: path.basename(dirB), isDirectory: () => true },
172+
]),
173+
rmSync,
174+
log: { warn },
175+
});
176+
177+
expect(rmSync).toHaveBeenCalledTimes(2);
178+
expect(warn).not.toHaveBeenCalled();
179+
});
180+
181+
it("does not warn when the compile-cache base directory cannot be listed (EACCES)", () => {
182+
const base = path.join("/tmp", "openclaw-compile-cache-no-list");
183+
const warn = vi.fn();
184+
const rmSync = vi.fn();
185+
const err = Object.assign(new Error(`EACCES: ${base}`), { code: "EACCES" });
186+
187+
pruneOpenClawCompileCache({
188+
env: { NODE_COMPILE_CACHE: base },
189+
existsSync: vi.fn(() => true),
190+
readdirSync: vi.fn(() => {
191+
throw err;
192+
}),
193+
rmSync,
194+
log: { warn },
195+
});
196+
197+
expect(rmSync).not.toHaveBeenCalled();
198+
expect(warn).not.toHaveBeenCalled();
199+
});
200+
150201
it("does not classify published packages with source files as source checkouts", () => {
151202
const packageRoot = "/pkg";
152203
const existingPaths = new Set([

0 commit comments

Comments
 (0)