openclaw - ✅(Solved) Fix Source-checkout CLI can use stale compile cache after rebuild [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73037Fetched 2026-04-28 06:28:20
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
closed ×1commented ×1cross-referenced ×1referenced ×1

In a live source-checkout install, the openclaw CLI can execute stale code after a local rebuild because the bootstrap enables Node compile cache unconditionally.

That makes openclaw gateway status --json report misleading probe failures even though the rebuilt source implementation and the running gateway are healthy.

Error Message

  • openclaw gateway status --json -> rpc.ok: false, error: "timeout"

Root Cause

The wrapper / entry bootstrap enables Node compile cache for source-checkout installs too. In a live checkout, dist is rebuilt in place, so cached compiled modules can become stale relative to the newly built output.

Packaged installs benefit from compile cache, but source-checkout installs need different behavior.

Fix Action

Workaround

Set NODE_DISABLE_COMPILE_CACHE=1 before invoking the CLI.

PR fix notes

PR #73048: fix(cli): skip compile cache for source-checkout installs

Description (problem / solution / changelog)

Summary

  • Problem: bootstrap unconditionally calls module.enableCompileCache() when the env opt-out is unset. Source-checkout installs rebuild dist/ in place, so a stale cache hit can mask freshly built CLI changes.
  • Why it matters: openclaw gateway status --json reports rpc.ok: false / "timeout" after a pnpm build, even though the rebuilt source path succeeds. Workaround so far has been NODE_DISABLE_COMPILE_CACHE=1.
  • What changed: detect a .git entry sitting next to openclaw.mjs and skip enableCompileCache in that case.
  • What did NOT change: packaged installs (no .git sibling) keep compile-cache behavior; the existing NODE_DISABLE_COMPILE_CACHE env opt-out is unchanged.

Change Type

  • Bug fix

Scope

  • CI/CD / infra (CLI bootstrap)

Linked Issue

  • Closes #73037

Root Cause

  • Root cause: openclaw.mjs:42 enabled compile cache unconditionally; no source-checkout gate.
  • Missing detection / guardrail: bootstrap script has no test coverage in this repo.

Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No (single sync existsSync check on bootstrap path)
  • Data access scope changed? No

Compatibility / Migration

  • Backward compatible? Yes (packaged installs unaffected; existing env opt-out preserved).
  • Config/env changes? No
  • Migration needed? No

Changed files

  • openclaw.mjs (modified, +18/-2)
RAW_BUFFERClick to expand / collapse

Summary

In a live source-checkout install, the openclaw CLI can execute stale code after a local rebuild because the bootstrap enables Node compile cache unconditionally.

That makes openclaw gateway status --json report misleading probe failures even though the rebuilt source implementation and the running gateway are healthy.

Environment

  • OpenClaw: 2026.4.25-beta.8
  • OS: Windows 11
  • Node: 22.19.0
  • Install style: global npm install is a Junction/symlink to a live source checkout
  • Source repo rebuilt in place with pnpm build

Reproduction

  1. Install OpenClaw globally from a live source checkout or otherwise point the global install at the repo working tree.
  2. Run the CLI once so Node compile cache is populated.
  3. Rebuild the source checkout in place with pnpm build.
  4. Start the gateway and run:
    • openclaw gateway status --json

Actual

The installed CLI can keep running stale probe/status code after the rebuild.

In my repro, source-level calls succeeded, but the installed CLI still reported a bad RPC status until compile cache was disabled or auth was forced explicitly.

Examples:

  • openclaw gateway status --json -> rpc.ok: false, error: "timeout"
  • NODE_DISABLE_COMPILE_CACHE=1 openclaw gateway status --json -> rpc.ok: true
  • source gatherDaemonStatus() / probeGateway() -> success

Expected

When OpenClaw is running from a live source checkout, rebuilds should take effect immediately for subsequent CLI invocations.

The bootstrap should not let stale compile-cache artifacts mask freshly built CLI changes.

Root Cause

The wrapper / entry bootstrap enables Node compile cache for source-checkout installs too. In a live checkout, dist is rebuilt in place, so cached compiled modules can become stale relative to the newly built output.

Packaged installs benefit from compile cache, but source-checkout installs need different behavior.

Workaround

Set NODE_DISABLE_COMPILE_CACHE=1 before invoking the CLI.

Suggested Fix

Disable compile cache automatically when the install root is clearly a live source checkout (for example, .git exists next to openclaw.mjs), while leaving compile cache enabled for packaged installs.

extent analysis

TL;DR

Disable Node compile cache when running the OpenClaw CLI from a live source checkout to ensure rebuilt changes take effect immediately.

Guidance

  • Verify if the issue is resolved by setting NODE_DISABLE_COMPILE_CACHE=1 before invoking the CLI, as this disables the compile cache and forces the use of the newly built output.
  • Check if the install root is a live source checkout by looking for a .git directory next to openclaw.mjs, which can be used to determine whether to disable compile cache.
  • Consider modifying the bootstrap to automatically disable compile cache when running from a live source checkout, while keeping it enabled for packaged installs.
  • Test the CLI with openclaw gateway status --json after rebuilding the source checkout to ensure the changes take effect without stale compile-cache artifacts.

Example

No code snippet is provided as it is not clearly supported by the issue, but the suggested fix involves modifying the bootstrap to conditionally disable compile cache based on the install type.

Notes

The provided workaround and suggested fix are specific to the OpenClaw CLI and may not apply to other Node.js applications. The issue is specific to live source-checkout installs, and the solution should not affect packaged installs.

Recommendation

Apply the workaround by setting NODE_DISABLE_COMPILE_CACHE=1 before invoking the CLI, as this provides an immediate solution to the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Source-checkout CLI can use stale compile cache after rebuild [1 pull requests, 1 comments, 2 participants]