Skip to content

Gateway self-restart via SIGTERM loses launchd service registration (macOS) #43035

@h0zikas

Description

@h0zikas

Summary

When a config change requires a gateway restart (e.g., adding plugins like lobster or llm-task), the gateway sends itself SIGTERM to trigger a launchd respawn. However, launchd loses the service unit registration and the gateway stays down.

Steps to reproduce

  1. Gateway running via launchd (ai.openclaw.gateway, KeepAlive: true)
  2. Have other OpenClaw-related LaunchAgents registered (e.g., com.openclaw.browsers, com.openclaw.dashboard)
  3. Make a config change that requires restart (e.g., add plugin entries for lobster and llm-task)
  4. Gateway detects change, defers restart until operations complete, then receives SIGTERM
  5. Gateway shuts down cleanly
  6. launchd does NOT respawn it

Observed behavior

After SIGTERM shutdown, running openclaw gateway status shows:

RPC probe: failed
Service unit not found.
Service not installed. Run: openclaw gateway install
Other gateway-like services detected (best effort):
  - com.openclaw.browsers
  - com.openclaw.dashboard

Manual openclaw gateway install is required to recover.

Expected behavior

launchd should respawn the gateway automatically after SIGTERM (plist has KeepAlive: true).

Log timeline (from today, Mar 11 2026)

11:14:58 [reload] config change detected (plugins.entries.lobster, plugins.entries.llm-task)
11:14:58 [reload] config change requires gateway restart — deferring until operations complete
11:15:04 [gateway] signal SIGTERM received; shutting down
11:22:13 RPC probe: failed / Service unit not found / Other gateway-like services detected
11:23:45 [gateway] listening on ws://127.0.0.1:18789 (after manual openclaw gateway install)

Environment

  • macOS 26.3.1 (arm64, Mac mini)
  • OpenClaw 3.8
  • Node v25.4.0
  • LaunchAgent: ai.openclaw.gateway with KeepAlive: true, ThrottleInterval: 1

Workaround

Created a watchdog LaunchAgent that checks every 30s and runs openclaw gateway install --force if gateway is down.

Notes

This is a recurring issue — same thing happened on Mar 9 and Mar 10 during openclaw gateway restart calls. The com.openclaw.browsers and com.openclaw.dashboard LaunchAgents seem to confuse the gateway's startup checks ("other gateway-like services detected"), which may prevent launchd's respawn from succeeding.

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