Bug Summary
When tools.exec.host is not configured (defaults to "sandbox") and agents.defaults.sandbox.mode is "off" (default), the exec tool enters a "phantom sandbox" state where:
- No Docker sandbox is used (mode=off)
- Login shell PATH resolution does NOT run (only triggers for
host === "gateway")
process.env.PATH is used directly, which on macOS LaunchAgent is incomplete (missing nvm/fnm/volta versioned bin dirs)
This causes node (and other version-manager-installed tools) to be command not found when agents execute shell commands.
Root Cause
Two separate issues contribute:
1. LaunchAgent plist PATH construction is incomplete for nvm
The gateway's LaunchAgent plist includes ~/.nvm in PATH but NOT ~/.nvm/versions/node/<version>/bin/. The ~/.nvm directory itself doesn't contain node binaries — nvm requires sourcing nvm.sh to set the versioned PATH entry.
2. exec tool doesn't resolve login shell PATH in "phantom sandbox" mode
In src/agents/bash-tools.exec.ts:384:
if (!sandbox && host === "gateway" && !params.env?.PATH) {
const shellPath = getShellPathFromLoginShell({...});
applyShellPath(env, shellPath);
}
The login shell PATH resolution only runs when host === "gateway". When host defaults to "sandbox" but no actual sandbox runtime exists (mode=off, Docker not running), the code falls through without resolving the login shell PATH.
Suggested fix for issue 2
// Change condition to also cover "phantom sandbox" case:
if (!sandbox && (host === "gateway" || host === "sandbox") && !params.env?.PATH) {
Reproduction
- Install Node.js via nvm on macOS
- Run OpenClaw gateway as LaunchAgent (default setup)
- Do NOT configure
tools.exec.host (leave default)
- Have an agent exec
node --version
- Result:
command not found: node
Workaround
Set tools.exec.host to "gateway" in ~/.openclaw/openclaw.json:
{
"tools": {
"exec": {
"host": "gateway"
}
}
}
Impact
Affects all users who:
- Install Node.js via nvm, fnm, or volta
- Run gateway as macOS LaunchAgent (default)
- Don't explicitly configure
tools.exec.host
Bug Summary
When
tools.exec.hostis not configured (defaults to"sandbox") andagents.defaults.sandbox.modeis"off"(default), the exec tool enters a "phantom sandbox" state where:host === "gateway")process.env.PATHis used directly, which on macOS LaunchAgent is incomplete (missing nvm/fnm/volta versioned bin dirs)This causes
node(and other version-manager-installed tools) to becommand not foundwhen agents execute shell commands.Root Cause
Two separate issues contribute:
1. LaunchAgent plist PATH construction is incomplete for nvm
The gateway's LaunchAgent plist includes
~/.nvmin PATH but NOT~/.nvm/versions/node/<version>/bin/. The~/.nvmdirectory itself doesn't contain node binaries — nvm requires sourcingnvm.shto set the versioned PATH entry.2. exec tool doesn't resolve login shell PATH in "phantom sandbox" mode
In
src/agents/bash-tools.exec.ts:384:The login shell PATH resolution only runs when
host === "gateway". When host defaults to"sandbox"but no actual sandbox runtime exists (mode=off, Docker not running), the code falls through without resolving the login shell PATH.Suggested fix for issue 2
Reproduction
tools.exec.host(leave default)node --versioncommand not found: nodeWorkaround
Set
tools.exec.hostto"gateway"in~/.openclaw/openclaw.json:{ "tools": { "exec": { "host": "gateway" } } }Impact
Affects all users who:
tools.exec.host