fix: reuse built control UI for live Mac updates (#104482)

* fix: reuse built control UI for live Mac updates

* fix: pin live updater Mac build inputs
This commit is contained in:
Peter Steinberger
2026-07-11 06:36:42 -07:00
committed by GitHub
parent fa77fe10d5
commit 325679a335
3 changed files with 16 additions and 5 deletions
@@ -38,7 +38,7 @@ Keep `/Users/steipete/openclaw` a read-only-to-the-agent deployment mirror: clea
Re-run the canonical freshness check immediately before every `pnpm openclaw` restart or probe so the source runner cannot hide stale output with an implicit auto-build. Every pass, including a no-update/current-build pass, must run deep RPC status and verbose health. If that first probe fails while the build is already exact-current, perform one managed Gateway restart and repeat both probes once. Do not rebuild a current exact-SHA artifact merely to self-heal the managed process; fail and diagnose if the one restart does not recover it.
3. If changed paths can affect macOS, the helper runs `scripts/restart-mac.sh --sign --wait --target-only` only after the exact-SHA JS/UI build completes. Target-only mode may stop the canonical `/Applications/OpenClaw.app` process and this checkout's exact `dist` process before launching the rebuilt `dist` app. It defers when another worktree, temporary bundle, test, or agent-owned OpenClaw process is active; it never kills that process. The script's immediate `OK` is not proof. The helper waits and requires the exact executable `/Users/steipete/openclaw/dist/OpenClaw.app/Contents/MacOS/OpenClaw`, then repeats Gateway RPC and health proof.
3. If changed paths can affect macOS, the helper runs `scripts/restart-mac.sh --sign --wait --target-only` with `SKIP_TSC=1` and `SKIP_UI_BUILD=1` only after the exact-SHA JS/UI build completes. Reusing those artifacts keeps the live app bundle out of any later JavaScript build cleanup. Target-only mode may stop the canonical `/Applications/OpenClaw.app` process and this checkout's exact `dist` process before launching the rebuilt `dist` app. It defers when another worktree, temporary bundle, test, or agent-owned OpenClaw process is active; it never kills that process. The script's immediate `OK` is not proof. The helper waits and requires the exact executable `/Users/steipete/openclaw/dist/OpenClaw.app/Contents/MacOS/OpenClaw`, then repeats Gateway RPC and health proof.
Never kill another worktree, temporary bundle, test, or agent-owned OpenClaw process. If a foreign app prevents the exact target from staying alive, record the pending Mac attempt, report it, and retry on the next heartbeat. Escalate only after the conflict persists across repeated heartbeats; never claim Mac proof from another bundle or the short launch check. If `actions.macUiVerification` is true, exercise the changed behavior with the existing macOS/UI automation workflow after delayed exact-bundle proof.
@@ -855,9 +855,20 @@ export function maintainMain(options, dependencies = {}) {
};
writeMaintenanceState(statePath, pendingState);
try {
// The exact-SHA JS build above already produced dist/control-ui. Letting
// Mac packaging rebuild it can empty dist while the live app bundle is
// there, defeating the staged-swap guarantee.
runCommand(
"bash",
["scripts/restart-mac.sh", "--sign", "--wait", "--target-only"],
"env",
[
"SKIP_TSC=1",
"SKIP_UI_BUILD=1",
"bash",
"scripts/restart-mac.sh",
"--sign",
"--wait",
"--target-only",
],
update.checkout,
);
const macTarget = verifyMacTarget(update.checkout);
+2 -2
View File
@@ -407,7 +407,7 @@ describe("openclaw live updater", () => {
"pnpm openclaw gateway restart",
"pnpm openclaw gateway status --deep --require-rpc --json",
"pnpm openclaw health --verbose --json",
"bash scripts/restart-mac.sh --sign --wait --target-only",
"env SKIP_TSC=1 SKIP_UI_BUILD=1 bash scripts/restart-mac.sh --sign --wait --target-only",
"pnpm openclaw gateway status --deep --require-rpc --json",
"pnpm openclaw health --verbose --json",
]);
@@ -708,7 +708,7 @@ describe("openclaw live updater", () => {
expect(retryCommands.calls.slice(0, 3)).toEqual([
"pnpm openclaw gateway status --deep --require-rpc --json",
"pnpm openclaw health --verbose --json",
"bash scripts/restart-mac.sh --sign --wait --target-only",
"env SKIP_TSC=1 SKIP_UI_BUILD=1 bash scripts/restart-mac.sh --sign --wait --target-only",
]);
expect(existsSync(statePath)).toBe(false);
});