openclaw - ✅(Solved) Fix [Bug]: doctor warns minimal PATH recommended, but openclaw writes a plist with a maximalist version-manager-friendly PATH [2 pull requests, 2 comments, 3 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#71944Fetched 2026-04-27 05:37:03
View on GitHub
Comments
2
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
commented ×2cross-referenced ×2mentioned ×2subscribed ×2

On Mac, this command that shows the plist for the openclaw launch agent: plutil -p ~/Library/LaunchAgents/ai.openclaw.gateway.plist | grep '"PATH"'

...shows a PATH with many package managers - .asdf, bun, fnm, pnpm among others.

Upon inspecting the openclaw/dist/, all of these package manager paths are hard-coded.

A defensive PATH template that includes every Node version manager makes sense as a fallback for users who installed via curl-piped scripts and don't have brew in PATH.

But on a system where doctor specifically warns "minimal PATH recommended" and "version managers are risky for daemon paths," then writes a plist with a maximalist version-manager-friendly PATH... that's an internal contradiction.

Not impacting, but a contradiction. Feel worth filing. Hope this helps!

Root Cause

On Mac, this command that shows the plist for the openclaw launch agent: plutil -p ~/Library/LaunchAgents/ai.openclaw.gateway.plist | grep '"PATH"'

...shows a PATH with many package managers - .asdf, bun, fnm, pnpm among others.

Upon inspecting the openclaw/dist/, all of these package manager paths are hard-coded.

A defensive PATH template that includes every Node version manager makes sense as a fallback for users who installed via curl-piped scripts and don't have brew in PATH.

But on a system where doctor specifically warns "minimal PATH recommended" and "version managers are risky for daemon paths," then writes a plist with a maximalist version-manager-friendly PATH... that's an internal contradiction.

Not impacting, but a contradiction. Feel worth filing. Hope this helps!

Fix Action

Fixed

PR fix notes

PR #71964: fix(daemon): only emit existing version-manager dirs into service PATH (#71944)

Description (problem / solution / changelog)

Fixes #71944.

Problem

service-env.ts:resolveDarwinUserBinDirs and resolveLinuxUserBinDirs unconditionally pushed every version-manager fallback (~/.volta/bin, ~/.asdf/shims, ~/.bun/bin, both fnm path variants, both pnpm path variants) into the gateway and node service PATH — regardless of whether those tools were actually installed.

service-audit.ts:301-329 then matched those exact substrings (/.volta/, /.asdf/, /.fnm/, /.local/share/pnpm/, etc.) and emitted gateway.path.non-minimal:

"Gateway service PATH includes version managers or package managers; recommend a minimal PATH."

So the daemon wrote a kitchen-sink PATH and then the doctor scolded it for the contents it had just written. Pure self-contradiction.

Fix

Filter the hard-coded version-manager fallbacks through fs.existsSync so the plist only contains paths that actually resolve on the host. The predicate is injectable via MinimalServicePathOptions.existsSync so tests stay hermetic.

Three classes of dir, three rules:

ClassExamplesRule
Env-configured roots (explicit user signal)PNPM_HOME, BUN_INSTALL, VOLTA_HOME, ASDF_DATA_DIR, NVM_DIR, FNM_DIR, NPM_CONFIG_PREFIX/binUnconditional — user typed these, we trust them.
Stable user-bin conventions~/.local/bin, ~/.npm-global/bin, ~/binUnconditional — audit excludes them.
Hard-coded VM fallbacks~/.volta/bin, ~/.asdf/shims, ~/.bun/bin, ~/Library/Application Support/fnm/aliases/default/bin, ~/.fnm/aliases/default/bin, ~/Library/pnpm, ~/.local/share/pnpm, ~/.nvm/current/bin, ~/.fnm/current/binOnly emit when the directory exists on disk. Otherwise the audit (correctly) flags them.

Combined effect: the gateway plist and the doctor now agree about what counts as a minimal PATH.

Tests

  • 71/71 in service-env.test.ts (16 in service-audit.test.ts, 15 in daemon-install-helpers.test.ts).
  • Existing assertions preserved by injecting existsSync: () => true so they still describe "what gets emitted when every dir exists".
  • Three new tests covering the new behavior:
    • Linux: hard-coded VM fallbacks omitted when none exist; user-bin conventions remain.
    • macOS: same, with the macOS-specific paths.
    • Env-configured roots stay unconditional even when the directory does not exist (explicit user signal).
    • Realistic mixed case: only the existing fallbacks emitted (e.g., volta installed, bun not).

Out of scope (worth a follow-up)

  • The audit could surface a gateway.path.stale recommendation when on-disk version managers don't match the plist (e.g., user installed Volta after the plist was written). The current fix addresses the contradiction at write time but doesn't auto-detect drift; happy to send a follow-up if @steipete wants it.

Changed files

  • CHANGELOG.md (modified, +2/-0)
  • src/daemon/service-env.test.ts (modified, +103/-0)
  • src/daemon/service-env.ts (modified, +54/-21)

PR #72109: fix: only include existing service path fallbacks

Description (problem / solution / changelog)

Summary

  • keep explicit env-configured PATH roots unchanged
  • stop adding hard-coded Node/package-manager fallback dirs unless they exist on disk
  • add deterministic tests for missing vs existing fallback dirs on Linux and macOS

Fixes #71944

Verification

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.daemon.config.ts
  • corepack pnpm format:check -- src/daemon/service-env.ts src/daemon/service-env.test.ts
  • corepack pnpm tsgo:core

Changed files

  • src/daemon/service-env.test.ts (modified, +73/-26)
  • src/daemon/service-env.ts (modified, +47/-15)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

On Mac, this command that shows the plist for the openclaw launch agent: plutil -p ~/Library/LaunchAgents/ai.openclaw.gateway.plist | grep '"PATH"'

...shows a PATH with many package managers - .asdf, bun, fnm, pnpm among others.

Upon inspecting the openclaw/dist/, all of these package manager paths are hard-coded.

A defensive PATH template that includes every Node version manager makes sense as a fallback for users who installed via curl-piped scripts and don't have brew in PATH.

But on a system where doctor specifically warns "minimal PATH recommended" and "version managers are risky for daemon paths," then writes a plist with a maximalist version-manager-friendly PATH... that's an internal contradiction.

Not impacting, but a contradiction. Feel worth filing. Hope this helps!

Steps to reproduce

  1. plutil -p ~/Library/LaunchAgents/ai.openclaw.gateway.plist | grep '"PATH"'
  2. grep -rE "volta|fnm|pnpm|asdf" /opt/homebrew/lib/node_modules/openclaw/dist/ 2>/dev/null | head -20

1 shows all the package managers in PATH. 2 shows there're in the distribution.

But openclaw doctor warns against this.

Expected behavior

Only the package managers in use are reflected in the plist.

Actual behavior

❯ plutil -p ~/Library/LaunchAgents/ai.openclaw.gateway.plist | grep '"PATH"' "PATH" => "/opt/homebrew/bin:/Users/username/.nvm:/Users/username/.local/bin:/Users/username/.npm-global/bin:/Users/username/bin:/Users/username/.volta/bin:/Users/username/.asdf/shims:/Users/username/.bun/bin:/Users/username/Library/Application Support/fnm/aliases/default/bin:/Users/username/.fnm/aliases/default/bin:/Users/username/Library/pnpm:/Users/username/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin"

OpenClaw version

v2026.04.20

Operating system

macOS Tahoe 26.3.1 (a)

Install method

npm global

Model

anthropic/sonnet-4-6

Provider / routing chain

openclaw local (Mac Studio)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can be addressed by modifying the openclaw installation to use a more restrictive PATH environment variable that only includes the package managers in use.

Guidance

  • Review the openclaw/dist/ directory to identify the hard-coded package manager paths and consider removing or commenting out the unused ones.
  • Modify the openclaw installation script to respect the "minimal PATH recommended" warning and only include the necessary package managers in the PATH environment variable.
  • Use the plutil command to update the ai.openclaw.gateway.plist file with the revised PATH environment variable.
  • Verify that the updated PATH environment variable only includes the package managers in use by running the command plutil -p ~/Library/LaunchAgents/ai.openclaw.gateway.plist | grep '"PATH"'.

Example

No code snippet is provided as the issue does not require a specific code change, but rather a modification to the installation script or configuration.

Notes

The issue is not critical, but it's worth addressing to maintain consistency with the "minimal PATH recommended" warning. The solution may require modifications to the openclaw installation script or configuration, which may not be straightforward.

Recommendation

Apply a workaround by modifying the openclaw installation script to use a more restrictive PATH environment variable, as this will address the internal contradiction and maintain consistency with the warning.

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

Only the package managers in use are reflected in the plist.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING