Skip to content

[Bug]: Gateway restart can fail during concurrent launchd bootstrap even when service starts #84721

Description

@googlerest

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

On macOS, openclaw gateway restart can report a launchctl bootstrap failure when another OpenClaw process concurrently bootstraps the same LaunchAgent; unified logs show the service spawned successfully.

Steps to reproduce

  1. On macOS with the OpenClaw Gateway LaunchAgent installed, trigger a Gateway restart while the OpenClaw app/helper is also starting or repairing ai.openclaw.gateway.
  2. Observe the CLI restart result.
  3. Check macOS unified logs for overlapping bootstrap activity on gui/501/ai.openclaw.gateway.

Expected behavior

openclaw gateway restart treats this race as success when launchctl print gui/<uid>/ai.openclaw.gateway shows the LaunchAgent is loaded or running after the concurrent bootstrap.

Actual behavior

The CLI reports Gateway restart failed: launchctl bootstrap failed: Bootstrap failed: 5: Input/output error, while the unified log shows one bootstrap succeeded, a competing bootstrap failed with 37: Operation already in progress, and launchd spawned ai.openclaw.gateway successfully.

OpenClaw version

NOT_ENOUGH_INFO

Operating system

macOS

Install method

npm global / mac app helper

Model

claude-cli/claude-sonnet-4-6

Provider / routing chain

OpenClaw Gateway LaunchAgent on macOS launchd

Additional provider/model setup details

LaunchAgent label: ai.openclaw.gateway
Observed service target: gui/501/ai.openclaw.gateway
Gateway port: 18789
Observed around 2026-05-21 06:31 local time.

Logs, screenshots, and evidence

Impact and severity

Impact: restart is reported as failed even though the service recovers, which makes Gateway health triage misleading and can trigger unnecessary retry/restart handling. Frequency: observed during concurrent CLI and app/helper restart activity.

Additional information

Mac unified log evidence showed one launchctl bootstrap succeeded, a second overlapping bootstrap failed with Operation already in progress, then launchd spawned the Gateway process successfully. This looks like a restart race, not a Gateway process crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions