Skip to content

gateway restart silently fails to re-register LaunchAgent on macOS #42775

Description

@withlqs

Environment

  • OS: macOS 26.3 (arm64)
  • OpenClaw: 2026.3.8
  • Node: v25.7.0
  • Service: LaunchAgent with KeepAlive=true, ThrottleInterval=1

Steps to Reproduce

  1. Gateway running as LaunchAgent (installed via openclaw doctor)
  2. Run openclaw gateway restart

Expected Behavior

Gateway stops and restarts within seconds, LaunchAgent plist remains registered.

Actual Behavior

  • Stop phase succeeds: SIGTERM sent, process exits, LaunchAgent plist is unloaded (launchctl bootout)
  • Start phase silently fails: plist is not re-registered with launchd
  • Gateway stays dead indefinitely — no process, no Telegram, no API
  • Only recoverable via manual openclaw doctor → "Install gateway service? Yes"

Log Evidence

11:56:58 [gateway] signal SIGTERM received
11:56:58 [gateway] received SIGTERM; shutting down
         ← 4 minute gap, no gateway process →
12:00:51 ← manual `openclaw doctor` required to re-install service →
12:01:00 [gateway] listening on ws://127.0.0.1:18789 (PID 88881)

Contrast: launchctl kill SIGTERM works correctly

Using launchctl kill SIGTERM gui/$(id -u)/ai.openclaw.gateway instead:

  • Only kills the process, does not unload the plist
  • KeepAlive=true triggers launchd auto-restart in ~3 seconds
  • No downtime, no manual intervention

Suggestion

gateway restart should either:

  1. Use launchctl kill instead of bootout/bootstrap cycle, or
  2. Ensure the start phase reliably re-registers the plist before returning, with proper error reporting if it fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions