fix: re-resolve pkgRoot after update to prevent stale systemd ExecStart path#28231
fix: re-resolve pkgRoot after update to prevent stale systemd ExecStart path#282312233admin wants to merge 2 commits intoopenclaw:mainfrom
Conversation
…rt path After a global pnpm/npm update, the package root directory changes (e.g. [email protected]/... → [email protected]/...). The previous code resolved pkgRoot before the update and never refreshed it, causing: 1. refreshGatewayServiceEnv() to use the old entry.js path 2. systemd ExecStart to keep pointing at the old (possibly deleted) version 3. Gateway fails with 'device signature invalid' because old binary can't validate new device signatures Fix: call resolveGlobalPackageRoot() again after the update step completes, so result.root always points to the newly installed version. Fixes openclaw#28209
Greptile SummaryRe-resolves the global package root after update to prevent stale systemd service paths. With pnpm, package directories include version numbers (e.g.,
Confidence Score: 5/5
Last reviewed commit: b87966f |
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale due to inactivity. |
Summary
Fixes #28209 —
device signature invalidafter updating from 2026.2.24 to 2026.2.26.Root Cause
In
runPackageInstallUpdate(),pkgRootis resolved before the update runs. With pnpm, the package root includes the version in the path (e.g.[email protected]/.../node_modules/openclaw). After update, this path no longer exists — it's now[email protected]/....The stale
pkgRootis returned asresult.root, whichrefreshGatewayServiceEnv()uses to findentry.js. Since the old path is gone, the systemd service file never gets updated, and the Gateway keeps running the old binary that can't validate the new device signature.Fix
Call
resolveGlobalPackageRoot()again after the update step completes, soresult.rootalways points to the newly installed version.Changes
src/cli/update-cli/update-command.ts: Re-resolvepkgRootafter update, useeffectivePkgRoot(new root with fallback to old) for version reading, doctor step, and return value.Testing
Reproduced and verified on:
device signature invalidbefore fixImpact
Minimal — adds one extra
resolveGlobalPackageRoot()call (fast, no network) after the update step. No behavioral change when the path hasn't changed (npm on some systems).