Skip to content

feat(deploy): keep factory node satellites on the deployed build - #33

Merged
tomorrowflow merged 2 commits into
mainfrom
feat/deploy-satellites
Oct 10, 2026
Merged

tomorrowflow merged 2 commits into
mainfrom
feat/deploy-satellites

Conversation

@tomorrowflow

@tomorrowflow tomorrowflow commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Problem

Factory node satellites (the Linux build nodes and the Mac) don't follow a Gateway deploy. The node on the Gateway host keeps running the old CLI until someone restarts it. The 3090 node runs a packed copy of the CLI and needs a manual copy, unpack and restart after every deploy. A node that lags behind its Gateway works only as long as the node protocol happens to stay compatible.

Solution

New scripts/deploy-satellites.sh with two phases, run from sync-and-deploy.sh:

  • prepare starts in the background right after deploy:globally, so it overlaps the preflights, cutover and smoke. It stages the new build next to each running node. For linux-tarball satellites it packs the global install once, copies it over SSH, and unpacks it into ~/.local/lib/openclaw.next.
  • activate runs only after the post-cutover smoke passes. It swaps each node to the staged build and restarts it. A node passes when its service is active, its CLI reports the deployed sha, and the Gateway still sees agent.cli.claude.run.v1. A node that fails the check is rolled back to the previous build.
  • Satellites run in parallel within each phase, with a log per satellite in ~/logs/satellites/.
  • A failure affects only that satellite and never fails the Gateway deploy. The deploy log names it, one Signal warning goes out, and activate still runs for the others.
  • A failed deploy stops the background prepare (EXIT trap) and activates nothing.
  • prepare-source starts before the host's own build, because source satellites only need the commit. A macos-source satellite (its native addons differ from Linux) shallow-fetches the deployed commit into ~/factory/openclaw-src, runs pnpm install and pnpm build, and installs with npm i -g . --install-links --prefix ~/.local/openclaw.next. On activate, ~/.local/openclaw is swapped in and the node process is killed; launchd KeepAlive restarts it on the new build, because the wrapper puts ~/.local/bin first on PATH. No admin rights are needed on the Mac.
  • The satellite list lives in ~/.config/openclaw-deploy/satellites.conf (<node name> <kind> <target>), so adding a node needs no commit. Kinds: local-systemd (a node on the Gateway host, restarted after the deploy), linux-tarball and macos-source.
  • local-systemd has no rollback: that node shares the Gateway's global install, which the deploy already moved forward. A failure there surfaces as a satellite warning.
  • Shell gotcha, noted in the script: remote scripts avoid exit. A login shell's exit builtin runs ~/.bash_logout, whose clear_console fails without a terminal and turned exit 0 into a failure.

Impact

Fork-only deploy tooling; no product code. Without a satellites file, the deploy behaves as before. With one, it takes about 20 s more after the smoke test (activate), because prepare already ran during the host deploy.

Evidence

Run on the Gateway host against linux-factory-minisforum790 (local-systemd) and linux-factory-minisforum3090 (linux-tarball):

  • prepare ran in about 21 s and activate in about 11 s, both nodes in parallel. Both came back on 47c7502, and the Gateway sees agent.cli.claude.run.v1 and file.fetch.
  • A repeat activate with nothing staged restarts the node and passes. This run first failed, which exposed the .bash_logout issue; it's fixed.
  • An unreachable satellite (192.0.2.1) failed only its own prepare. The other satellite succeeded and the script exited 1.
  • A deliberately broken staged build on the 3090 was detected and rolled back, and the node was active on the old build again.
  • Autoreview (Codex, P1) found one issue: a failed restart skipped the rollback. Fixed in cec72ae13e0 and covered by the broken-build test.
  • Mac (mac-factory-florians-macbook-pro): prepare-source took 7 min 50 s, including pnpm build (3 min 54 s) and the shallow fetch plus install. Activate moved the node from the admin-owned /opt/homebrew build 82876a2 to ~factory/.local/openclaw at 47c7502 in about 10 s. The Gateway sees agent.cli.claude.run.v1, file.fetch and system.run.
  • The first Mac run used a full clone, which passed 6.7 GB after 20 min. It's now a --depth 1 fetch of the one commit (c3f0489419e).
  • In the same activate run, the 3090 was offline (SSH timeout). Only that satellite failed; the other two switched.
  • Second autoreview (P1) flagged the missing local-systemd rollback. That's by design (above) and now documented in the script.
  • Not run: a full sync-and-deploy.sh with the hook. It runs on the next deploy.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant