openclaw - ✅(Solved) Fix [Bug] exec host=node: resolveWorkdir validates gateway filesystem instead of node [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#44508Fetched 2026-04-08 00:45:57
View on GitHub
Comments
2
Participants
3
Timeline
10
Reactions
0
Timeline (top)
referenced ×3commented ×2cross-referenced ×2closed ×1

Root Cause

After 2026.3.11, exec host=node from macOS gateway to Windows node fails with SYSTEM_RUN_DENIED: approval requires an existing canonical cwd. The root cause is that resolveWorkdir() validates the workdir against the gateway filesystem instead of the target node filesystem.

Fix Action

Fixed

PR fix notes

PR #46395: fix(exec): skip resolveWorkdir for host=node to avoid gateway-side validation

Description (problem / solution / changelog)

Summary

When exec host=node is used from a macOS gateway to a Windows node, resolveWorkdir() validates the workdir against the gateway filesystem. Since the remote path (e.g. C:\Temp) does not exist on the gateway, it falls back to a Mac path which the Windows node cannot canonicalize, causing SYSTEM_RUN_DENIED.

This PR adds a host === "node" guard that skips resolveWorkdir and forwards the raw workdir as-is to the remote node for validation.

Change Type

Bug fix — exec tool regression

Scope

src/agents/bash-tools.exec.ts — workdir resolution branch

Linked Issue

Fixes #44508

Security Impact

None. This is a validation-location fix, not a security bypass. The workdir is still validated on the node side.

Evidence

  • Existing exec path tests pass (8 tests)
  • bash-tools.shared.test.ts passes (3 tests)
  • Full build succeeds

Human Verification

Cross-platform gateway→node exec with a Windows-style workdir path should no longer fail on the gateway side.

Compatibility

Backward compatible — only changes behavior for host=node; gateway and sandbox paths are unaffected.

Failure Recovery

If the workdir is invalid on the node, the node-side validation will report the error (existing behavior).

Risks

Low. The change is a 3-line conditional addition.


🤖 This PR was authored with AI assistance.

Changed files

  • docs/.generated/config-baseline.json (added, +51475/-0)
  • src/agents/bash-tools.exec.ts (modified, +2/-0)
  • src/context-engine/registry.ts (modified, +67/-9)

PR #46406: fix(bootstrap-cache): invalidate on mtime + fix(exec): skip resolveWorkdir for host=node (#46396, #46395)

Description (problem / solution / changelog)

Combines fixes from upstream PRs:

  • #46396: fix(bootstrap-cache): invalidate cache when file mtime changes (Closes #28594)
  • #46395: fix(exec): skip resolveWorkdir for host=node to avoid gateway-side validation (Fixes #44508)

Merged from openclaw/openclaw PRs.

Changed files

  • src/agents/bash-tools.exec.ts (modified, +3/-0)
  • src/agents/bootstrap-cache.test.ts (modified, +53/-1)
  • src/agents/bootstrap-cache.ts (modified, +35/-4)

Code Example

// Current (buggy) code:
} else workdir = resolveWorkdir(rawWorkdir, warnings);

---

// Before:
} else workdir = resolveWorkdir(rawWorkdir, warnings);

// After:
} else if (host !== "node") workdir = resolveWorkdir(rawWorkdir, warnings);
// For host=node, forward workdir as-is; validate on node side

---

function resolveExecParams(params: ExecParams) {
  const { host, workdir } = params;
  
  if (host === "node") {
    // For node exec, validate workdir on node, not gateway
    return { ...params, workdir: params.workdir }; // Pass through
  }
  
  // For gateway exec, validate locally
  return { ...params, workdir: resolveWorkdir(params.workdir) };
}
RAW_BUFFERClick to expand / collapse

Bug Summary

Type: Regression | Priority: High | Component: exec tool, node invocation

After 2026.3.11, exec host=node from macOS gateway to Windows node fails with SYSTEM_RUN_DENIED: approval requires an existing canonical cwd. The root cause is that resolveWorkdir() validates the workdir against the gateway filesystem instead of the target node filesystem.


Environment

  • Gateway: macOS (arm64)
  • Node: Windows (headless)
  • OpenClaw: 2026.3.11
  • Previous working version: 2026.3.8

Steps to Reproduce

  1. Pair a Windows headless node to a macOS gateway
  2. Set tools.exec.host=node in gateway config
  3. Execute: exec(host="node", workdir="C:\Temp", command="echo ok")
  4. Expected: Command runs on Windows node
  5. Actual: Fails with SYSTEM_RUN_DENIED: approval requires an existing canonical cwd

Root Cause Analysis

The Bug Location

File: reply-BCcP6j4h.js ~line 13623

// Current (buggy) code:
} else workdir = resolveWorkdir(rawWorkdir, warnings);

The function resolveWorkdir() calls statSync(workdir) on the Mac gateway. Since C:\Temp doesn't exist on the Mac filesystem, it falls back to the agent's workspace path on Mac. This Mac path is then forwarded to the Windows node, which cannot canonicalize it.

Why This Happens

  • For host=gateway: validating cwd on gateway is correct
  • For host=node: the cwd should be forwarded raw and validated on the node, not the gateway

Proposed Fix

Fix in reply-BCcP6j4h.js line ~13623:

// Before:
} else workdir = resolveWorkdir(rawWorkdir, warnings);

// After:
} else if (host !== "node") workdir = resolveWorkdir(rawWorkdir, warnings);
// For host=node, forward workdir as-is; validate on node side

This ensures that for node exec, the workdir is passed through without gateway-side validation.


Code Evidence

File: packages/core/src/tools/exec.ts (inferred from bundle)

The exec tool handling should check the host type:

function resolveExecParams(params: ExecParams) {
  const { host, workdir } = params;
  
  if (host === "node") {
    // For node exec, validate workdir on node, not gateway
    return { ...params, workdir: params.workdir }; // Pass through
  }
  
  // For gateway exec, validate locally
  return { ...params, workdir: resolveWorkdir(params.workdir) };
}

Impact Assessment

  • Severity: High (blocks cross-platform node exec workflow)
  • Affected Users: Users with multi-OS gateway→node setups
  • Security Impact: None (this is a validation logic fix, not security bypass)

Additional Notes

This fix complements the other two regressions in Issue #44487:

  1. tools.exec.host exclusive policy (may be intentional security hardening)
  2. Gateway sending approved: false to node

For a complete fix, all three regressions should be addressed together.


Reported by: OpenSource Team (Unum AI) Analysis method: Deep source code analysis of bundle JS

extent analysis

Fix Plan

To resolve the issue, we need to modify the reply-BCcP6j4h.js file and the exec.ts file as follows:

  • In reply-BCcP6j4h.js, update the resolveWorkdir call to only validate the workdir when the host is not a node:
} else if (host !== "node") workdir = resolveWorkdir(rawWorkdir, warnings);
  • In exec.ts, update the resolveExecParams function to pass through the workdir for node exec and validate locally for gateway exec:
function resolveExecParams(params: ExecParams) {
  const { host, workdir } = params;
  
  if (host === "node") {
    // For node exec, validate workdir on node, not gateway
    return { ...params, workdir: params.workdir }; // Pass through
  }
  
  // For gateway exec, validate locally
  return { ...params, workdir: resolveWorkdir(params.workdir) };
}

Additionally, ensure that the tools.exec.host policy is correctly configured to allow node execution.

Verification

To verify the fix, follow these steps:

  1. Update the reply-BCcP6j4h.js and exec.ts files with the modified code.
  2. Restart the gateway and node services.
  3. Run the exec command with host="node" and a valid workdir on the Windows node.
  4. Verify that the command executes successfully on the Windows node without any SYSTEM_RUN_DENIED errors.

Extra Tips

  • Ensure that the tools.exec.host policy is correctly configured to allow node execution.
  • Test the fix with different workdir scenarios to ensure that the validation logic is correct.
  • Consider adding additional logging or debugging statements to verify that the fix is working as expected.

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…

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] exec host=node: resolveWorkdir validates gateway filesystem instead of node [2 pull requests, 2 comments, 3 participants]