openclaw - ✅(Solved) Fix [Bug]: `openclaw update` runs full npm install even when already on latest version [1 pull requests]

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…

openclaw update does not check whether the installed version matches the registry version before invoking the package manager. This causes unnecessary work, wastes time, and can be dangerous on resource-constrained systems.

Root Cause

openclaw update does not check whether the installed version matches the registry version before invoking the package manager. This causes unnecessary work, wastes time, and can be dangerous on resource-constrained systems.

Fix Action

Workaround

We use a wrapper script that checks the version before running update:

#!/bin/bash
cur=$(openclaw --version | grep -oP '\d+\.\d+\.\d+')
latest=$(npm view openclaw version)
if [ "$cur" = "$latest" ]; then
  echo "Already on $cur, skipping update"
else
  echo "Updating $cur -> $latest"
  openclaw update
fi

PR fix notes

PR #69421: update: skip package install when already on target version (#69412)

Description (problem / solution / changelog)

Summary

Fixes #69412. When openclaw update runs on a package install and the running version already matches the resolved channel target, the command short-circuits before invoking the global package manager. Without this guard, npm i -g openclaw@latest (or the pnpm/bun equivalent) is executed even when the install would be a no-op, which takes 20-60 seconds, triggers network traffic, and occasionally rewrites node_modules with no user-visible change.

Behavior

  • Package-mode runs where currentVersion === targetVersion, no --tag, no install-kind switch, and the tag is registry-resolvable → log Already on <version> (<channel>). Nothing to update. and exit 0.
  • --json output emits { status: "skipped", reason: "already-on-target", mode: "package", currentVersion, targetVersion, channel, tag, installKind, root }.
  • --tag <version> always reinstalls (same behavior as before, so operators who want to force a reinstall still can).
  • Git installs, mode switches (switchToGit/switchToPackage), and non-registry specs fall through to the existing flow unchanged.

Implementation

  • src/cli/update-cli/update-command.ts: early-exit block inserted after the package runtime preflight, before the "Updating OpenClaw…" header. Gated on updateInstallKind === "package" && !switchToPackage && !switchToGit && !explicitTag && canResolveRegistryVersionForPackageTarget(tag) with a compareSemverStrings equality check.
  • src/cli/update-cli.test.ts: three regression cases — text mode short-circuit, JSON mode payload shape, explicit --tag still reinstalls.
  • CHANGELOG.md: entry under Unreleased → Fixes.

Verification

  • pnpm test src/cli/update-cli.test.ts → 49 passing (3 new).
  • pnpm check:changed → green for this diff; pre-existing failures on extensions/browser/src/browser/chrome.internal.test.ts (Chrome not installed in sandbox) and test/ui.presenter-next-run.test.ts (French locale) are unrelated.

Test plan

  • Unit: pnpm test src/cli/update-cli.test.ts
  • Typecheck + lint via pnpm check:changed on touched files
  • Manual: openclaw update while already on @latest → expect Already on <v>... and exit 0 without calling npm
  • Manual: openclaw update --json same scenario → expect structured status:"skipped" payload
  • Manual: openclaw update --tag <current-version> → still reinstalls

Disclosure: this patch was drafted with AI assistance; manual review applied.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/cli/update-cli.test.ts (modified, +77/-0)
  • src/cli/update-cli/update-command.ts (modified, +40/-0)

Code Example

$ openclaw update
Already on 2026.4.15 (latest). Nothing to update.

---

$ openclaw update
Updating OpenClaw...
 
◇  ✓ Updating via package manager (144.24s)
◇  ✓ Running doctor checks (42.31s)
 
Update Result: OK
  Root: /home/admin/.npm-global/lib/node_modules/openclaw
  Before: 2026.4.15
  After: 2026.4.15
 
Total time: 193.46s
 
Updating plugins...
No plugin updates needed.
 
Restarting service...
Daemon restart completed.
 
Update complete. The bugs feared me, so they left.

---



---

#!/bin/bash
cur=$(openclaw --version | grep -oP '\d+\.\d+\.\d+')
latest=$(npm view openclaw version)
if [ "$cur" = "$latest" ]; then
  echo "Already on $cur, skipping update"
else
  echo "Updating $cur -> $latest"
  openclaw update
fi
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

openclaw update does not check whether the installed version matches the registry version before invoking the package manager. This causes unnecessary work, wastes time, and can be dangerous on resource-constrained systems.

Steps to reproduce

  1. Install OpenClaw (npm global): version 2026.4.15
  2. Verify: npm view openclaw version2026.4.15 (same as installed)
  3. Run: openclaw update
  4. Observe: full npm install runs for ~144 seconds, doctor checks for ~42 seconds
  5. Result: Before: 2026.4.15 → After: 2026.4.15 — no change

Expected behavior

openclaw update should compare the installed version against the registry target before invoking the package manager. If versions match, it should skip the update and exit early:

$ openclaw update
Already on 2026.4.15 (latest). Nothing to update.

Or at minimum, offer --check / --dry-run that exits with code 0/1 based on whether an update is available, without running the package manager.

Actual behavior

$ openclaw update
Updating OpenClaw...
 
◇  ✓ Updating via package manager (144.24s)
◇  ✓ Running doctor checks (42.31s)
 
Update Result: OK
  Root: /home/admin/.npm-global/lib/node_modules/openclaw
  Before: 2026.4.15
  After: 2026.4.15
 
Total time: 193.46s
 
Updating plugins...
No plugin updates needed.
 
Restarting service...
Daemon restart completed.
 
Update complete. The bugs feared me, so they left.

The full package manager update runs, recompiles native modules (sqlite-vec, sharp, better-sqlite3), and restarts the gateway — all for a no-op version change.

OpenClaw version

2026.04.15

Operating system

Debian 13

Install method

npm global

Model

openrouter/nvidia/nemotron-3-super-120b-a12b:free

Provider / routing chain

openclaw - openrouter - nemotron-3-super-120b-a12b:free

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

On resource-constrained systems (e.g., 4GB RAM VPS without swap), the unnecessary npm install can cause OOM conditions. In our case, running openclaw update while other services were active triggered kswapd0 thrashing and required a hard reboot via the hosting provider's web console.

Additional information

Workaround

We use a wrapper script that checks the version before running update:

#!/bin/bash
cur=$(openclaw --version | grep -oP '\d+\.\d+\.\d+')
latest=$(npm view openclaw version)
if [ "$cur" = "$latest" ]; then
  echo "Already on $cur, skipping update"
else
  echo "Updating $cur -> $latest"
  openclaw update
fi

extent analysis

TL;DR

Modify the openclaw update command to check the installed version against the registry version before invoking the package manager.

Guidance

  • Check the version of OpenClaw installed using openclaw --version and compare it with the version in the registry using npm view openclaw version.
  • If the versions match, skip the update and exit early to avoid unnecessary work and potential OOM conditions.
  • Consider adding a --check or --dry-run flag to openclaw update to allow for a version check without running the package manager.
  • Use a wrapper script like the provided workaround to automate the version check and update process.

Example

The provided workaround script can be used as an example:

#!/bin/bash
cur=$(openclaw --version | grep -oP '\d+\.\d+\.\d+')
latest=$(npm view openclaw version)
if [ "$cur" = "$latest" ]; then
  echo "Already on $cur, skipping update"
else
  echo "Updating $cur -> $latest"
  openclaw update
fi

Notes

This solution assumes that the openclaw command and npm are properly installed and configured on the system.

Recommendation

Apply the workaround using the provided script, as it provides a safe and effective way to check the version before running the update. This will help prevent unnecessary work and potential OOM conditions on resource-constrained systems.

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…

FAQ

Expected behavior

openclaw update should compare the installed version against the registry target before invoking the package manager. If versions match, it should skip the update and exit early:

$ openclaw update
Already on 2026.4.15 (latest). Nothing to update.

Or at minimum, offer --check / --dry-run that exits with code 0/1 based on whether an update is available, without running the package manager.

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 [Bug]: `openclaw update` runs full npm install even when already on latest version [1 pull requests]