openclaw - ✅(Solved) Fix [Bug]: Gateway LaunchAgent plist captures interactive-shell PATH including Node version managers (Volta/asdf/fnm/pnpm), causing non-deterministic Node resolution and update-flow timeouts [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75233Fetched 2026-05-01 05:36:33
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
2
Author
Timeline (top)
cross-referenced ×3labeled ×2commented ×1

On macOS, the LaunchAgent plist for ai.openclaw.gateway captures the interactive-shell PATH including Node version managers (Volta, asdf, fnm, pnpm). openclaw gateway status --deep flags this as a "Service config issue" and recommends openclaw doctor --repair, but the install path itself does not synthesize a minimal canonical PATH. Non-deterministic Node selection by the supervised gateway contributes to subprocess timeouts (spawnSync ETIMEDOUT) and gateway version-mismatch reports during updates.

Error Message

openclaw gateway status --deep flagging the issue:

Service config looks out of date or non-standard. Service config issue: Gateway service PATH includes version managers or package managers; recommend a minimal PATH. (/Users/Nick/.volta/bin, /Users/Nick/.asdf/shims, /Users/Nick/.fnm/aliases/default/bin, /Users/Nick/Library/pnpm, /Users/Nick/.local/share/pnpm) Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").

Plist PATH before doctor --repair (problem):

/Users/Nick/.volta/bin:/Users/Nick/.asdf/shims:/Users/Nick/.fnm/aliases/default/bin:/Users/Nick/Library/pnpm:/Users/Nick/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Plist PATH after doctor --repair (fix):

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Concurrent subprocess timeout suggesting wrong-Node selection during the same update:

Completion cache update failed: Error: spawnSync /usr/local/Cellar/node/25.8.1_1/bin/node ETIMEDOUT

Concurrent version-mismatch report during the same update:

Gateway did not become healthy after restart. Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable. Service runtime: status=running, state=xpcproxy, pid=2021 Gateway port 18789 status: free.

Root Cause

On macOS, the LaunchAgent plist for ai.openclaw.gateway captures the interactive-shell PATH including Node version managers (Volta, asdf, fnm, pnpm). openclaw gateway status --deep flags this as a "Service config issue" and recommends openclaw doctor --repair, but the install path itself does not synthesize a minimal canonical PATH. Non-deterministic Node selection by the supervised gateway contributes to subprocess timeouts (spawnSync ETIMEDOUT) and gateway version-mismatch reports during updates.

Fix Action

Fixed

PR fix notes

PR #75246: Fix macOS LaunchAgent PATH canonicalization

Description (problem / solution / changelog)

Summary

  • Problem: macOS gateway LaunchAgent installs could persist an interactive-shell PATH containing Volta, asdf, fnm, pnpm, and other user toolchain directories.
  • Why it matters: the supervised gateway and its children could resolve different Node binaries across install, doctor, and update flows.
  • What changed: macOS service PATH generation now defaults to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin, and macOS installs no longer merge old plist PATH entries back into the generated environment.
  • What did NOT change (scope boundary): Linux service PATH keeps its existing user-bin/version-manager compatibility behavior, and runtime Node selection/warnings are unchanged.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #75233
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the shared minimal service PATH helper treated macOS version-manager and package-manager directories as expected service PATH entries, and the gateway install plan merged preserved existing PATH values back into rewritten service environments.
  • Missing detection / guardrail: tests asserted the old macOS version-manager PATH policy rather than locking in a canonical launchd PATH.
  • Contributing context (if known): Linux and macOS service PATH policy shared the same user-bin-first behavior even though launchd does not load the user's shell init.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/daemon/service-env.test.ts, src/commands/daemon-install-helpers.test.ts
  • Scenario the test should lock in: macOS service env ignores HOME/env version-manager roots by default and macOS install plans do not preserve existing plist PATH entries.
  • Why this is the smallest reliable guardrail: the bug is in the service environment builder and install-plan merge seam, before launchd writes the plist.
  • Existing test that already covers this (if any): service audit coverage still flags non-minimal version-manager PATH entries.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

macOS openclaw gateway install, onboarding service install, and doctor service repair now write a canonical LaunchAgent PATH instead of preserving shell/version-manager PATH entries. Users who intentionally need custom tools from the gateway service should configure explicit absolute paths or service-managed environment instead of relying on the interactive shell PATH.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS dev host
  • Runtime/container: Node/pnpm repo test wrapper
  • Model/provider: N/A
  • Integration/channel (if any): macOS launchd Gateway service
  • Relevant config (redacted): N/A

Steps

  1. Build a macOS gateway service environment with HOME plus FNM_DIR, PNPM_HOME, VOLTA_HOME, and ASDF_DATA_DIR.
  2. Build a macOS gateway install plan with an existing PATH containing Volta, asdf, fnm, pnpm, a custom bin, and /usr/bin.
  3. Audit the changed lanes and run the focused service env/install/service audit tests.

Expected

  • The macOS generated service PATH is /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.
  • Existing macOS plist PATH entries are not preserved into the rewritten install environment.
  • Linux user-bin PATH compatibility tests continue to pass.

Actual

  • Matches expected after this patch.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Added regression assertions for the reported macOS PATH behavior and verified them with the focused test command below.

Human Verification (required)

  • Verified scenarios:
    • pnpm docs:list
    • pnpm test src/daemon/service-env.test.ts src/daemon/service-audit.test.ts src/commands/daemon-install-helpers.test.ts src/commands/doctor-gateway-services.test.ts
    • pnpm exec oxfmt --check --threads=1 src/daemon/service-env.ts src/daemon/service-env.test.ts src/commands/daemon-install-helpers.ts src/commands/daemon-install-helpers.test.ts docs/gateway/doctor.md CHANGELOG.md
    • git diff --check HEAD~1..HEAD
    • pnpm changed:lanes --base upstream/main --json
    • pnpm check:changed --base upstream/main --dry-run
  • Edge cases checked: macOS ignores env-configured version-manager roots by default; explicit opt-in helper behavior remains covered; Linux user-bin/version-manager PATH behavior remains covered; macOS old plist PATH preservation is skipped.
  • What you did not verify: no live launchd install/restart was performed. Blacksmith Testbox pnpm check:changed was attempted with tbx_01kqfzcnffe6x8py5awx71t1tw, but the box remained queued without a run URL and was stopped to avoid leaving resources active.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) Yes, macOS generated LaunchAgent PATH is intentionally more restrictive
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: a macOS gateway service that relied on shell PATH user directories for child tools may no longer find those tools by bare name.
    • Mitigation: this matches launchd's deterministic service model; use absolute tool paths or explicit service-managed environment for required custom tools. Linux PATH behavior is unchanged.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/gateway/doctor.md (modified, +1/-1)
  • src/commands/daemon-install-helpers.test.ts (modified, +34/-0)
  • src/commands/daemon-install-helpers.ts (modified, +7/-1)
  • src/daemon/service-env.test.ts (modified, +43/-46)
  • src/daemon/service-env.ts (modified, +7/-6)

Code Example

Service config issue: Gateway service PATH includes version managers or package managers; recommend a minimal PATH.
   (/Users/Nick/.volta/bin, /Users/Nick/.asdf/shims, /Users/Nick/.fnm/aliases/default/bin, /Users/Nick/Library/pnpm, /Users/Nick/.local/share/pnpm)
   Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").

---

/Users/Nick/.volta/bin:/Users/Nick/.asdf/shims:/Users/Nick/.fnm/aliases/default/bin:/Users/Nick/Library/pnpm:/Users/Nick/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

---

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

---

# openclaw gateway status --deep flagging the issue:

  Service config looks out of date or non-standard.
  Service config issue: Gateway service PATH includes version managers or package managers; recommend a minimal PATH. (/Users/Nick/.volta/bin, /Users/Nick/.asdf/shims, /Users/Nick/.fnm/aliases/default/bin, /Users/Nick/Library/pnpm, /Users/Nick/.local/share/pnpm)
  Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").

# Plist PATH before doctor --repair (problem):

/Users/Nick/.volta/bin:/Users/Nick/.asdf/shims:/Users/Nick/.fnm/aliases/default/bin:/Users/Nick/Library/pnpm:/Users/Nick/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# Plist PATH after doctor --repair (fix):

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# Concurrent subprocess timeout suggesting wrong-Node selection during the same update:

Completion cache update failed: Error: spawnSync /usr/local/Cellar/node/25.8.1_1/bin/node ETIMEDOUT

# Concurrent version-mismatch report during the same update:

Gateway did not become healthy after restart.
Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable.
Service runtime: status=running, state=xpcproxy, pid=2021
Gateway port 18789 status: free.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

On macOS, the LaunchAgent plist for ai.openclaw.gateway captures the interactive-shell PATH including Node version managers (Volta, asdf, fnm, pnpm). openclaw gateway status --deep flags this as a "Service config issue" and recommends openclaw doctor --repair, but the install path itself does not synthesize a minimal canonical PATH. Non-deterministic Node selection by the supervised gateway contributes to subprocess timeouts (spawnSync ETIMEDOUT) and gateway version-mismatch reports during updates.

Steps to reproduce

  1. On macOS, install Node via Volta, asdf, fnm, or pnpm (alone or alongside Homebrew Node).
  2. Install OpenClaw via npm install -g openclaw (or any current install path that ends up writing the LaunchAgent plist).
  3. Run openclaw doctor (which reinstalls the plist as a side effect of inspection).
  4. Inspect ~/Library/LaunchAgents/ai.openclaw.gateway.plist and observe the EnvironmentVariables.PATH entry includes the version-manager directories from your interactive shell.
  5. Run openclaw gateway status --deep. Observe the warning:
    Service config issue: Gateway service PATH includes version managers or package managers; recommend a minimal PATH.
    (/Users/Nick/.volta/bin, /Users/Nick/.asdf/shims, /Users/Nick/.fnm/aliases/default/bin, /Users/Nick/Library/pnpm, /Users/Nick/.local/share/pnpm)
    Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").
  6. Run openclaw doctor --repair. Observe the plist is reinstalled with a minimal PATH.

Expected behavior

The plist installer should write a minimal canonical PATH regardless of the installing user’s interactive shell (e.g. /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin plus any explicit NODE_PATH or service-specific bin directory OpenClaw needs). After openclaw doctor --repair runs, the plist DOES contain this minimal PATH (/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin), and openclaw gateway status --deep no longer flags the warning. The fix logic exists; it should be the default at install time rather than gated behind the --repair flag.

Actual behavior

The LaunchAgent plist EnvironmentVariables.PATH after a default install / openclaw doctor run (without --repair):

/Users/Nick/.volta/bin:/Users/Nick/.asdf/shims:/Users/Nick/.fnm/aliases/default/bin:/Users/Nick/Library/pnpm:/Users/Nick/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

openclaw gateway status --deep flags this as a service config issue. Concurrent symptoms strongly suggesting it caused real damage during the same incident:

  • Subprocess timeout against an explicit Cellar path: Completion cache update failed: Error: spawnSync /usr/local/Cellar/node/25.8.1_1/bin/node ETIMEDOUT — even an explicit fully-qualified Node path was timing out.
  • Gateway version-mismatch report during the post-install restart: Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable. This indicates the supervised gateway came up under Node selected by whichever version manager was first in PATH, which differs from the Node the npm-installed openclaw CLI was built against.

After openclaw doctor --repair, the plist PATH was rewritten to:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

and openclaw gateway status --deep no longer emitted the warning.

OpenClaw version

2026.4.27 (issue likely present in earlier 2026.4.x and prior; first observed during 2026.4.26 → 2026.4.27 update flow)

Operating system

macOS 15.7.5 (x64)

Install method

npm global at /usr/local/lib/node_modules/openclaw

Model

gpt-5.5 (default agent — not relevant; bug is in service-installer / PATH hygiene, not model routing)

Provider / routing chain

openclaw direct (not relevant — bug is in service-installer / PATH hygiene, not provider routing)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

# openclaw gateway status --deep flagging the issue:

  Service config looks out of date or non-standard.
  Service config issue: Gateway service PATH includes version managers or package managers; recommend a minimal PATH. (/Users/Nick/.volta/bin, /Users/Nick/.asdf/shims, /Users/Nick/.fnm/aliases/default/bin, /Users/Nick/Library/pnpm, /Users/Nick/.local/share/pnpm)
  Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").

# Plist PATH before doctor --repair (problem):

/Users/Nick/.volta/bin:/Users/Nick/.asdf/shims:/Users/Nick/.fnm/aliases/default/bin:/Users/Nick/Library/pnpm:/Users/Nick/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# Plist PATH after doctor --repair (fix):

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# Concurrent subprocess timeout suggesting wrong-Node selection during the same update:

Completion cache update failed: Error: spawnSync /usr/local/Cellar/node/25.8.1_1/bin/node ETIMEDOUT

# Concurrent version-mismatch report during the same update:

Gateway did not become healthy after restart.
Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable.
Service runtime: status=running, state=xpcproxy, pid=2021
Gateway port 18789 status: free.

Impact and severity

Affected: macOS users with multiple Node version managers in PATH (Volta, asdf, fnm, pnpm, etc.). Likely a significant subset of openclaw users on macOS dev machines. Severity: Medium. Self-detected by openclaw gateway status --deep but not auto-corrected at install time. Contributes to update-flow flakiness, subprocess timeouts, and gateway version-mismatch reports. Frequency: 1/1 observed installs; reproducible by re-running openclaw doctor (which re-pollutes the plist). Consequence: Non-deterministic Node selection by the supervised gateway across restarts; harder-to-debug update flows.

Additional information

Companion bug filed for plugin runtime-deps atomic staging — see Issue #75231. Both surfaced in the same 2026-04-30 incident; PATH pollution likely contributed to the staging subprocess timeouts and the gateway-version-mismatch report in #75231. Suggested fix direction: in the plist installer, write a minimal canonical PATH (e.g. /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin plus any explicit OpenClaw-specific bin directory) regardless of the installing user’s interactive shell. The fix logic already exists in openclaw doctor --repair — it should be the default install behavior rather than --repair-gated.

extent analysis

TL;DR

The LaunchAgent plist installer should write a minimal canonical PATH by default, rather than including version managers from the interactive shell.

Guidance

  • The issue is caused by the LaunchAgent plist capturing the interactive-shell PATH, including Node version managers, which leads to non-deterministic Node selection and subprocess timeouts.
  • To verify the issue, run openclaw gateway status --deep and check for the "Service config issue" warning.
  • To mitigate the issue, run openclaw doctor --repair to rewrite the plist with a minimal PATH.
  • The fix logic already exists in openclaw doctor --repair and should be made the default install behavior.

Example

No code snippet is provided as the issue is related to the installer behavior rather than code.

Notes

The issue is specific to macOS users with multiple Node version managers in PATH and has a medium severity impact on update flows and subprocess timeouts.

Recommendation

Apply the workaround by running openclaw doctor --repair to rewrite the plist with a minimal PATH, until the installer behavior is updated to write a minimal canonical PATH by default.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The plist installer should write a minimal canonical PATH regardless of the installing user’s interactive shell (e.g. /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin plus any explicit NODE_PATH or service-specific bin directory OpenClaw needs). After openclaw doctor --repair runs, the plist DOES contain this minimal PATH (/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin), and openclaw gateway status --deep no longer flags the warning. The fix logic exists; it should be the default at install time rather than gated behind the --repair flag.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Gateway LaunchAgent plist captures interactive-shell PATH including Node version managers (Volta/asdf/fnm/pnpm), causing non-deterministic Node resolution and update-flow timeouts [1 pull requests, 1 comments, 2 participants]