-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Restart race condition with LaunchAgent KeepAlive causes shutdown instead of restart #88309
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: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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Version
v2026.5.27 (27ae826), running on macOS (arm64) with LaunchAgent (
~/Library/LaunchAgents/ai.openclaw.gateway.plist,KeepAlive=true)Summary
When the gateway tool triggers a restart (e.g. after a config change that requires restart), the restart logic fails because of a port conflict with the LaunchAgent process, causing the gateway to shut down completely instead of restarting.
Reproduction
KeepAlive=true(standard installer behavior)gatewaytoolconfig.patchthat needs restart, orgateway restart)Log Evidence
From
/tmp/openclaw/openclaw-2026-05-29.log:The gateway stayed down until launchd re-bootstrapped ~5 hours later:
Root Cause Analysis
gateway restartsends SIGTERM and tries to stop the LaunchAgentKeepAlive=truein the plist causes launchd to immediately respawn the processExpected Behavior
restartrequestWorkaround
Manually
launchctl bootoutthe LaunchAgent before restart:launchctl bootout gui/$UID/ai.openclaw.gateway openclaw gateway startRelated
See also #88046 regarding upgrade-related LaunchAgent issues.