Install
openclaw skills install @skillmelody/upgrade-openclaw-safelyUse when upgrading OpenClaw or recovering from partial updates, gateway failures, migrations, service drift, channel failures, or version mismatch.
openclaw skills install @skillmelody/upgrade-openclaw-safelyTreat each upgrade as one evidence-backed transaction. Completion requires the selected package version, running gateway, configuration, critical routes, and a stability window.
Use the bundled transaction guard before a core package mutation. The guard never executes commands. Supply facts already verified from the current CLI and help output:
node {baseDir}/scripts/upgrade-transaction.mjs plan \
--target <exact-version> \
--cli-path <absolute-path> \
--cli-version <current-version> \
--capabilities tag,no-restart,yes,json
Read references/transaction-contract.md and references/recovery-contract.md before apply, recovery, or rollback.
The guard implements plan, status, begin-core, record-core, classify, resume, begin-service, record-service, observe, and finish. It writes structured state and authorization records but never invokes OpenClaw, a service manager, or another program.
Record CLI path/version, install source, package root, config/state paths, service manager and command, gateway process/path/version, plugins/channels, active work, update settings, restart-log cursor, and critical user routes.
Read current help for update, backup, doctor, gateway lifecycle/status, and channel status. Record supported flags and success semantics. Do not infer capabilities.
Resolve vague stable/latest requests to an exact version. Review release, runtime, configuration, migration, gateway, plugin, channel, model/auth, and rollback impact. Risk is LOW, MEDIUM, HIGH, or BLOCKER.
Define the pre-upgrade baseline and critical paths. If degraded, repair first or obtain explicit approval to continue against a named degraded baseline.
Run plan with the exact target and verified CLI snapshot. Keep the run id. Review the stored fingerprint, backup plan, downtime, and recovery limits.
Create and verify a narrow backup using commands proven by current help. Verify exit status, archive existence, non-zero size, manifest, and read-back. Record inclusions and exclusions.
Present current version, target, risk, downtime, verified backup, rollback authority, critical checks, and run id. Wait for explicit apply approval.
Immediately before the core command, resample CLI path/version and help capabilities, then pass the same fields to begin-core:
node {baseDir}/scripts/upgrade-transaction.mjs begin-core \
--run <run-id> --confirm <run-id> \
--cli-path <absolute-path> \
--cli-version <current-version> \
--capabilities tag,no-restart,yes,json
If refused, stop. Never bypass the guard or create a replacement run just to retry.
Execute exactly the returned command array without shell concatenation.
After execution, resample the installed package version even on non-zero exit:
node {baseDir}/scripts/upgrade-transaction.mjs record-core \
--run <run-id> --exit-code <code> --observed-version <version>
Target present plus later failure means post-update recovery, not a second update.
Record a fresh failure classification before recovery:
node {baseDir}/scripts/upgrade-transaction.mjs classify \
--run <run-id> --kind <classification> --evidence <bounded-reference>
After interruption or gateway restart, call resume. It returns a decision but never executes it:
node {baseDir}/scripts/upgrade-transaction.mjs resume --run <run-id>
Inspect the service definition and process. Choose one action only: restart when correct and loaded; install when missing; force-install with separate approval for definition drift; or observe if already starting.
Arm the one approved action before executing it with current, verified CLI semantics:
node {baseDir}/scripts/upgrade-transaction.mjs begin-service \
--run <run-id> --confirm <run-id> --action <install|restart|force-install|bootout>
Record its result immediately:
node {baseDir}/scripts/upgrade-transaction.mjs record-service \
--run <run-id> --result <pass|fail>
The guard permits one service action total. Never chain lifecycle actions.
Record at least three real observations spanning 120 seconds. Use stable process identity and all readiness layers:
node {baseDir}/scripts/upgrade-transaction.mjs observe \
--run <run-id> --at <ISO-8601> --gateway-pid <pid> \
--binary-path <absolute-path> --binary-inode <inode> \
--service pass --port pass --rpc pass --app pass --channels pass \
--fatal no --sigterm no --source-update-count <count>
The guard computes stability from the samples. It requires unchanged PID/path/inode, every readiness layer passing, no fatal or external SIGTERM, and no increase in source=update evidence.
Record completion only with all gates:
node {baseDir}/scripts/upgrade-transaction.mjs finish \
--run <run-id> --cli pass --gateway pass --rpc pass \
--config pass --channels pass
Classify before mutation:
Recovery, rollback, configuration restoration, migration-source rename, plugin disable/update, force install, and credential repair each require separate approval.
For duplicate legacy migration sources, use only a path explicitly named by logs, verify realpath is inside an allowed root, back up the single target, and propose a timestamped rename. Never delete databases or use broad globs.
Default orphan transcript cleanup to No unless proven to block the transaction and separately authorized.
Report result, from/to versions, run id, target rationale, backup, CLI and gateway paths/versions, service manager, configuration/doctor results, critical paths, stability, commands, attempt counts, classifications, rollback state, remaining risks, and required user action.
If a check was not run, say not checked.