Skip to content

[Bug]: macOS LaunchAgent restart can leave ai.openclaw.gateway unloaded after bootout #39211

@xaeon2026

Description

@xaeon2026

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

  1. Install and run the gateway as a LaunchAgent on macOS.
  2. Confirm the gateway is healthy and loaded.
  3. Run openclaw gateway restart.
  4. In the failing case, check openclaw gateway status and 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 received
    • received SIGTERM; shutting down
  • later openclaw gateway status reported:
    • Could not find service "ai.openclaw.gateway" in domain for user gui: 501
    • Service 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 stopped
Runtime: unknown (Bad request.
Could not find service "ai.openclaw.gateway" in domain for user gui: 501)

Service not installed. Run: openclaw gateway install

Probable cause from code inspection:

  • installLaunchAgent() clears persisted disabled state with launchctl enable ... before bootstrap
  • restartLaunchAgent() and repairLaunchAgentBootstrap() 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions