-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
[Bug]: macOS LaunchAgent restart can leave ai.openclaw.gateway unloaded after bootout #39211
Description
Bug type
Crash (process/app exits or hangs)
Summary
On macOS, openclaw gateway restart can stop the running gateway but fail to re-register/restart the ai.openclaw.gateway LaunchAgent, leaving the gateway unloaded until a manual reinstall/bootstrap.
Steps to reproduce
- Install and run the gateway as a LaunchAgent on macOS.
- Confirm the gateway is healthy and loaded.
- Run
openclaw gateway restart. - In the failing case, check
openclaw gateway statusand the gateway logs.
Expected behavior
openclaw gateway restart should stop and then reliably restore the LaunchAgent to a loaded/running state.
Actual behavior
The gateway receives SIGTERM and shuts down, but the LaunchAgent may remain unloaded afterward.
Observed evidence:
- gateway log shows:
signal SIGTERM receivedreceived SIGTERM; shutting down
- later
openclaw gateway statusreported:Could not find service "ai.openclaw.gateway" in domain for user gui: 501Service not installed. Run: openclaw gateway install
OpenClaw version
2026.3.3
Operating system
macOS (user session / launchd; reproduced on a local machine)
Install method
npm global / LaunchAgent
Logs, screenshots, and evidence
2026-03-07T12:19:45.182-05:00 [gateway] signal SIGTERM received
2026-03-07T12:19:45.187-05:00 [gateway] received SIGTERM; shutting down
2026-03-07T12:19:45.273-05:00 [gmail-watcher] gmail watcher stoppedRuntime: unknown (Bad request.
Could not find service "ai.openclaw.gateway" in domain for user gui: 501)
Service not installed. Run: openclaw gateway installProbable cause from code inspection:
installLaunchAgent()clears persisted disabled state withlaunchctl enable ...beforebootstraprestartLaunchAgent()andrepairLaunchAgentBootstrap()did not do the same- this can leave restart/recovery paths less robust than install
Impact and severity
Affected: macOS users running OpenClaw through LaunchAgent
Severity: Medium-High (breaks the local gateway until manual recovery)
Frequency: Intermittent, but workflow-breaking when triggered
Consequence: local dashboard / health checks / channel integrations go offline until openclaw gateway install or manual launchctl bootstrap
Additional information
A local fix was tested by adding launchctl enable gui/$UID/<label> before bootstrap in the restart and repair paths, aligning them with the existing install path. This restored normal behavior on the affected machine and passed targeted launchd tests.