openclaw - 💡(How to fix) Fix Bug: exec() tool strips dollar-variable patterns via undocumented template substitution

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…

The exec() tool performs undocumented template substitution on command strings, silently stripping $variable patterns before they reach the shell.

Root Cause

The exec() tool performs undocumented template substitution on command strings, silently stripping $variable patterns before they reach the shell.

Fix Action

Fix / Workaround

Working workaround

Write commands to .ps1 files via write(), then execute via exec(). The %var% cmd-style env variables also pass through cleanly.

RAW_BUFFERClick to expand / collapse

Description

The exec() tool performs undocumented template substitution on command strings, silently stripping $variable patterns before they reach the shell.

Environment

  • OS: Windows 10 (x64) on Lenovo ThinkPad P51
  • OpenClaw version: 2026.5.20
  • Shell: PowerShell (cmd also affected)

Steps to Reproduce

  1. Call exec() with a command string containing $word patterns (e.g. $a, $start, $PSVersionTable)
  2. Observe the patterns are silently removed before reaching the shell
  3. Only $ at end of line passes through

Affected patterns (all fail)

  • $variable is removed entirely
  • Single quotes don't help: '$a' still gets stripped
  • Backtick-escape does not work
  • Double-dollar does not work
  • cmd /c wrapper does not help (exec processes before shell)

Working workaround

Write commands to .ps1 files via write(), then execute via exec(). The %var% cmd-style env variables also pass through cleanly.

Expected

Either:

  1. Pass command strings verbatim to the shell, or
  2. Document the template substitution behavior

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