-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Gateway launchd agent gets unloaded during self-update and never re-bootstrapped (macOS) #85133
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.Decent issue quality, but reproduction details are still incomplete.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.Decent issue quality, but reproduction details are still incomplete.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Summary
After an openclaw self-update on macOS,
~/Library/LaunchAgents/ai.openclaw.gateway.plistgets rewritten with a newComment(version bump) but the launchd service ends up not registered in the user domain — so once the in-flight gateway process exits,KeepAlive=truehas nothing to respawn and the gateway stays down indefinitely. No alert, no auto-recovery; users only notice when their integrations (Telegram, automation tools) silently stop responding.Environment
2026.5.20(installed via/opt/homebrew/lib/node_modules/openclaw)ai.openclaw.gateway~/Library/LaunchAgents/ai.openclaw.gateway.plistThe plist correctly contains:
…so launchd would respawn on its own if the service were still bootstrapped.
Symptom
~/Library/LaunchAgents/ai.openclaw.gateway.plistexists and is valid — itsmtimematches the moment the self-update ran. So the file is there, the service is just not loaded.Timeline from one real incident
Plist
mtime(= updater write time): 2026-05-21 17:01:05 PDT (Comment field now readsOpenClaw Gateway (v2026.5.20)).From
~/.openclaw/logs/gateway.err.logaround that window:So the in-process
[reload]manager tried to apply config changes (plugins.installs.codex, commands.ownerAllowFrom), kept getting deferred because ansquad-monitorcron task was always running, and at some point the process exited (or was killed) — and then nothing brought it back, because launchd no longer had the registration.The 7-minute gap (
17:02:50 → 17:09:34) is the user-visible outage; the 17:09:34 line is from my manual recovery (next section).Manual recovery (workaround)
immediately brings the service back. PID populates, health endpoint returns
{"ok":true,"status":"live"}. (launchctl kickstart -k gui/$UID/ai.openclaw.gatewaywon't work in this state because the service isn't bootstrapped — kickstart requires a registered service.)Hypothesis on root cause
The self-updater path appears to:
plistto disk (✅ — we see updated mtime + Comment).launchctl bootoutso the new ProgramArguments / env take effect on next start).[reload]deferral races with the updater's bootout, the gateway exits before bootstrap is reissued, and launchd is left empty.Two contributing factors visible in the logs:
squad-monitoris on a recurring 10-minute cadence, so the quiet window for hot-reload is often never reached. The updater may give up on graceful and force a bootout.launchctl print gui/$UID/ai.openclaw.gatewaycheck after the rewrite, so a missing registration goes unnoticed.Expected behavior
After any successful self-update, the gateway must be both bootstrapped in the current launchd domain and running. The updater should:
launchctl bootoutthe old registration (if present).launchctl bootstrap gui/$UID <plist>the new one.launchctl print gui/$UID/ai.openclaw.gateway(or at leastlaunchctl list <label>) that the PID is populated; retry/log loudly if not.http://127.0.0.1:<port>/healthfor a final readiness check before declaring the update done.If the hot-reload pathway is preferred to avoid disturbing background tasks, it should have a timeout — if deferral has been pending for, say, > 60s, fall through to the bootout/bootstrap path rather than indefinitely waiting for
squad-monitorto be idle.Suggested mitigations (regardless of fix choice)
gateway exitlog line with reason whenever the process is about to terminate, including whether it was an internal reload, bootout, or unexpected crash. The current gap ingateway.err.log(silence from 17:02:50 → manual recovery) makes incidents hard to debug — there should always be a final line./healthis unreachable for more than N seconds. Today the outage is silent until the user notices their automation has gone quiet.Repro outline
Hard to reproduce on demand because it depends on the timing race between self-update and the in-process reload deferral, but you can probably trigger it by:
[reload]manager defers on (anything that's perpetually "in flight";squad-monitoron a tight cadence works).requires gateway restart(e.g.commands.ownerAllowFrom,plugins.installs.codex).launchctl list ai.openclaw.gatewayafter ~1–2 minutes — registration gone.Happy to attach more log around any specific reload event if useful.