Overview
defenseclaw upgrade downloads pre-built gateway tarballs and Python wheels from GitHub Releases, verifies artifacts with HEAD requests before stopping the sidecar, backs up config, replaces binaries under ~/.local/bin, runs Python migrations, restarts defenseclaw-gateway and openclaw gateway restart, then polls sidecar health on port 18970 (or the configured API port).
CLI surface
| Flag | Purpose |
|---|---|
--yes / -y | Skip confirmation prompts |
--version | Target release (e.g. 0.3.1); default is latest from GitHub API |
--health-timeout | Seconds to wait for gateway health after restart (default 60) |
Authenticated GITHUB_TOKEN or GH_TOKEN raises rate limits for the releases API.
Flow (ordered)
- Resolve target version; exit early if already current.
- Detect platform (
darwin/linux×amd64/arm64). - Pre-flight
HEADon gateway tarball and wheel URLs. - Download artifacts to a temp staging directory.
- Unless
--yes, show plan and confirm. - Create backup under
~/.defenseclaw/backups/upgrade-<timestamp>/(config.yaml,.env,guardrail_runtime.json,device.key,policies/,openclaw.json). defenseclaw-gateway stop.- Install gateway binary to
~/.local/bin/defenseclaw-gateway(codesign on Darwin);uv pip installwheel into~/.defenseclaw/.venv; refresh~/.local/bin/defenseclawsymlink. - Run
defenseclaw.migrations.run_migrationsbetween old and new version. defenseclaw-gateway start; best-effortopenclaw gateway restart.- Poll
/healthviaOrchestratorClientuntil gateway state isrunningor timeout.
Partial upgrades and failure modes
| Scenario | Behavior |
|---|---|
| Download or pre-flight fails | Exits before stopping the gateway; nothing is replaced |
| Install or migration errors | Staging dir is still removed in finally; restart is attempted—inspect gateway.log / gateway.jsonl |
Health never reaches running | Command prints timeout guidance; backup directory remains for inspection |
Rollback
There is no single “downgrade” subcommand. Restore from the backup folder created under ~/.defenseclaw/backups/ (copy config.yaml, .env, and other files back; restore openclaw.json if needed), reinstall the older gateway binary and wheel (or re-run the curl installer with Makefile=…), then defenseclaw-gateway restart.