Repository navigation
Description
Summary
On macOS, openclaw update schedules its out-of-process update job using launchctl submit. launchctl submit creates the job with KeepAlive = true by default, so the update runner (run-openclaw-update.zsh) is relaunched immediately every time it exits. Each iteration runs openclaw update, whose first action is "Stopping managed gateway service before package update" — so the managed gateway is killed roughly once per minute and never stays up. The package update itself succeeds on the first pass; the loop continues forever afterward with availability.available = false.
Net user-visible symptom: after updating, the gateway won't stay up.
Environment
- OpenClaw
2026.5.28(commite932160); first observed after auto-update2026.5.26 → 2026.5.28 - Install: global package at
/opt/homebrew/lib/node_modules/openclaw(pnpm) - node
v25.6.1 - macOS
26.4(arm64)
Impact
- Managed gateway (
ai.openclaw.gateway) is force-stopped ~1×/minute indefinitely → all agents/channels (Discord, Telegram, cron) keep dropping. - Two jobs were submitted ~1s apart (
ai.openclaw.manual-update.<epoch>), so the gateway was being stopped by two concurrent loops. ~/.openclaw/work/update-logs/openclaw-update-*.loggrew to ~2 MB / 80+ repeated== START / == UPDATE / == DOCTORcycles in ~80 min.~/.openclaw/logs/gateway-restart.logfills withCould not find service "ai.openclaw.gateway" in domain for user gui: 501as the loop races with itself (kickstart attempted against a service that a concurrent iteration has just booted out).
Root cause
The submitted launchd jobs are KeepAlive. Confirmed via:
$ launchctl print gui/501/ai.openclaw.manual-update.<epoch>
path = (submitted by launchctl[...])
program = /Users/<user>/.openclaw/work/update-logs/run-openclaw-update.zsh
properties = keepalive | inferred program
path = (submitted by launchctl ...) + properties = keepalive = a launchctl submit job using the default unconditional KeepAlive. run-openclaw-update.zsh exits cleanly (DOCTOR_EXIT 0) each cycle, and launchd relaunches it in the same second:
== END Sun May 31 19:49:38 SAST 2026 ==
== START Sun May 31 19:49:38 SAST 2026 ==
Steps to reproduce
- On macOS, trigger an update that uses the launchctl-submit path (e.g. auto-update or
openclaw update). - Observe a transient
ai.openclaw.manual-update.<epoch>job appear:launchctl list | grep manual-update. launchctl print gui/$(id -u)/ai.openclaw.manual-update.<epoch>→properties = keepalive.- Watch the gateway get stopped each cycle (
gateway-restart.log/ update log) and never stay up.
Expected
The update job runs once and exits. The gateway is stopped only for the actual package swap, then restarted and left running.
Suggested fix
launchctl submit is deprecated and defaults to unconditional KeepAlive — it's the wrong primitive for a run-once task. Options:
- Preferred: write a temporary LaunchAgent plist with
KeepAlive = false(or omit it) andRunAtLoad = true,bootstrapit, andbootoutit on completion — instead oflaunchctl submit. - If staying with
launchctl submit, the runner must remove its own job on exit (e.g.launchctl remove ai.openclaw.manual-update.<epoch>as the last step) so it can't be relaunched. - Defensive: never submit a second update job while one is already registered (the two near-simultaneous submits doubled the damage).
- The "stop the gateway before update" step should be gated on an update actually being applied — when
availability.available == false, the job should no-op instead of stopping the gateway.
Workaround (for affected users)
# tear down the runaway loop
for l in $(launchctl list | awk '/ai\.openclaw\.manual-update/ {print $3}'); do launchctl bootout gui/$(id -u)/$l; done
pkill -f run-openclaw-update.zsh; pkill -f openclaw-doctor
# the gateway is left booted out — reload it
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway
The submitted jobs are not persisted to disk, so they don't survive logout/reboot — but the next update re-triggers the loop until this is fixed.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 31, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 31, 2026, 2:30 PM ET / 18:30 UTC.
Summary
Keep open: the reported macOS runaway updater loop is still plausible against current main because launchd updater cleanup only recognizes
ai.openclaw.update.*, while the report showsai.openclaw.manual-update.*; a repeated package update still stops the managed gateway before replacement.Reproducibility: yes. for the source-level failure boundary: current main only recognizes
ai.openclaw.update.*, so a reportedai.openclaw.manual-update.<epoch>launchd label is ignored by cleanup. I did not run a live macOS launchd repro in this read-only review.Next step
A focused repair can add compatibility handling and regression tests for the observed manual-update launchd labels, but the implementation should first verify no current producer remains hidden outside the searched source path.
Review details
Best possible solution:
Recognize and disarm observed one-shot updater launchd labels such as
ai.openclaw.manual-update.*before stopping the gateway, and surface them in doctor/status cleanup while preserving the existing package-refresh behavior unless maintainers choose a broader policy change.Do we have a high-confidence way to reproduce the issue?
Yes for the source-level failure boundary: current main only recognizes
ai.openclaw.update.*, so a reportedai.openclaw.manual-update.<epoch>launchd label is ignored by cleanup. I did not run a live macOS launchd repro in this read-only review.Is this the best way to solve the issue?
Yes directionally: the narrow maintainable fix is to disarm the one-shot updater job before the package-update stop step and cover the manual-update label in tests. Changing the already-tested package refresh behavior when no newer version is available should be treated as separate policy work.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
ai.openclaw.manual-update.*was not found in current source, so a fix should narrowly handle the observed updater labels without broadening cleanup to real gateway LaunchAgent labels.Codex review notes: model gpt-5.5, reasoning high; reviewed against 2fbddce88182.
Label changes
Label changes:
P1: The report describes a current update path that can repeatedly stop the managed gateway and break real channel/agent workflows after update.impact:crash-loop: The affected launchd updater loop repeatedly stops the gateway, making the managed runtime unable to stay available.impact:message-loss: When the gateway repeatedly drops, connected channels such as Discord, Telegram, and cron can miss or interrupt message handling.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.Label justifications:
P1: The report describes a current update path that can repeatedly stop the managed gateway and break real channel/agent workflows after update.impact:crash-loop: The affected launchd updater loop repeatedly stops the gateway, making the managed runtime unable to stay available.impact:message-loss: When the gateway repeatedly drops, connected channels such as Discord, Telegram, and cron can miss or interrupt message handling.Evidence reviewed
Acceptance criteria:
What I checked:
ai.openclaw.update., so the reportedai.openclaw.manual-update.<epoch>label would not be recognized. (src/daemon/launchd.ts:49, 2fbddce88182)src/daemon/launchd.ts:304, 2fbddce88182)maybeStopManagedServiceBeforePackageUpdatebefore running the package manager update; inside that helper a running managed gateway is stopped before the install step. (src/cli/update-cli/update-command.ts:3308, 2fbddce88182)ai.openclaw.update.innormalizeOpenClawUpdateLaunchdLabel. (src/daemon/launchd.ts:49, e93216080aa1)ai.openclaw.update.2026.5.12, but there is no analogous coverage for the reportedai.openclaw.manual-update.*label. (src/daemon/launchd.test.ts:434, 2fbddce88182)manual-update,run-openclaw-update,launchctl submit, orai.openclaw.manual-updatesource occurrence, so the remaining repair should focus on compatibility cleanup for observed launchd jobs unless a producer is found during implementation. (2fbddce88182)Likely related people:
src/daemon/launchd.ts,src/cli/update-cli/update-command.ts,src/gateway/server-methods/update-managed-service-handoff.ts)src/cli/update-cli/restart-helper.ts,src/cli/update-cli/restart-helper.test.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.