Skip to content

Gateway SIGUSR1 restart destabilizes launchd service on macOS #14161

Description

@agplusman

Bug

After a SIGUSR1-based gateway restart (triggered by config.patch, gateway restart, or openclaw update), the launchd service frequently becomes unloaded. Subsequent openclaw gateway restart or openclaw gateway stop && openclaw gateway start commands fail with "service not loaded."

Root Cause (suspected)

The gateway restart sends SIGUSR1, causing the process to exit and re-launch. When multiple restarts happen in quick succession (e.g. several config.patch calls), launchd interprets the rapid exits as a crash loop and silently unloads the service via its built-in throttling. Once unloaded, no restart commands work because launchd no longer knows about the service.

Reproduction

  1. Run several config.patch calls in a row (or multiple openclaw gateway restart)
  2. After 2-3 restarts, run openclaw gateway restart → fails with "service not loaded"
  3. launchctl list | grep openclaw shows no entry

Workaround

openclaw gateway install && openclaw gateway restart

gateway install rewrites the plist and re-registers it with launchctl load/launchctl bootstrap, which always fixes it.

Expected Behavior

  • SIGUSR1 restarts should not cause launchd to unload the service
  • openclaw update should automatically re-register the launchd service (run gateway install internally)
  • Ideally, the restart mechanism should handle launchd's crash-loop throttling (e.g. add a small delay, or use a different restart approach)

Environment

  • OS: macOS 15 (Sequoia), Apple Silicon
  • OpenClaw: 2026.2.9
  • Node: v25.5.0
  • Plist: ~/Library/LaunchAgents/ai.openclaw.gateway.plist with KeepAlive: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions