Skip to content

fix(nodes): remove redundant rawCommand from system.run.prepare#38660

Merged
obviyus merged 3 commits intoopenclaw:mainfrom
madsmash:fix/nodes-run-rawcommand-mismatch
Mar 7, 2026
Merged

fix(nodes): remove redundant rawCommand from system.run.prepare#38660
obviyus merged 3 commits intoopenclaw:mainfrom
madsmash:fix/nodes-run-rawcommand-mismatch

Conversation

@madsmash
Copy link
Copy Markdown

@madsmash madsmash commented Mar 7, 2026

Problem

nodes run is completely broken since 2026.3.2 for any command using a shell wrapper (powershell, bash, etc.). Every command fails with:

INVALID_REQUEST: rawCommand does not match command

Root Cause

In nodes-tool.ts, the system.run.prepare call passes:

rawCommand: formatExecCommand(command)

This produces the full formatted argv string, e.g. powershell -Command "echo hello".

However, validateSystemRunCommandConsistency() recognizes shell wrappers (powershell, bash, etc.) and extracts the inner command as the "inferred" value (echo hello). The raw vs inferred comparison then fails.

Fix

Remove the explicit rawCommand parameter from the system.run.prepare call. When rawCommand is null/undefined, the validation skips the comparison and correctly infers the command text from the argv array.

Testing

Verified on a live setup (gateway 2026.3.3, Windows node 2026.3.3):

  • Before fix: every nodes run command fails with rawCommand mismatch
  • After fix: nodes run works correctly for all shell wrapper commands

Fixes #33080

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Mar 7, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR fixes a regression introduced in 2026.3.2 where every nodes run command using a shell wrapper (e.g., powershell, bash) would fail with INVALID_REQUEST: rawCommand does not match command. The fix is a targeted two-line removal: the rawCommand: formatExecCommand(command) parameter from the system.run.prepare call and its associated (now-unused) import.

Key changes:

  • Removes rawCommand: formatExecCommand(command) from the system.run.prepare params in nodes-tool.ts.
  • Removes the now-unused formatExecCommand import from system-run-command.js.

Why this works: validateSystemRunCommandConsistency (in system-run-command.ts) skips the raw-vs-inferred comparison when rawCommand is null/undefined (if (raw && raw !== inferred)). The server then infers the correct cmdText from the argv array. The subsequent system.run call still receives a valid rawCommand via prepared.plan.rawCommand ?? prepared.cmdText, so downstream approval and display logic is unaffected.

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, targeted removal of a parameter that was causing a hard failure for all shell-wrapper commands.
  • The change is a two-line removal with a clearly diagnosed root cause. The validation logic in validateSystemRunCommandConsistency explicitly short-circuits when rawCommand is absent, and the downstream system.run call still receives rawCommand from the server-resolved prepared.plan.rawCommand ?? prepared.cmdText. No logic is altered beyond removing the mismatched input.
  • No files require special attention.

Last reviewed commit: d6069a3

@madsmash madsmash force-pushed the fix/nodes-run-rawcommand-mismatch branch from d6069a3 to 954235f Compare March 7, 2026 09:01
@madsmash
Copy link
Copy Markdown
Author

madsmash commented Mar 7, 2026

Rebased on latest main. Ready for review! 🙏

The nodes tool was passing rawCommand: formatExecCommand(command) to
system.run.prepare, which produced the full formatted argv string
(e.g. 'powershell -Command "echo hello"'). However,
validateSystemRunCommandConsistency() recognizes shell wrappers like
powershell/bash and extracts the inner command as the 'inferred' value
(e.g. 'echo hello'). This caused a rawCommand vs inferred mismatch,
breaking all nodes run commands with shell wrappers.

The fix removes the explicit rawCommand parameter, letting the
validation correctly infer the command text from the argv array.

Fixes openclaw#33080
@madsmash madsmash force-pushed the fix/nodes-run-rawcommand-mismatch branch from 954235f to 5a572aa Compare March 7, 2026 10:55
@obviyus obviyus self-assigned this Mar 7, 2026
@obviyus obviyus merged commit ac63f30 into openclaw:main Mar 7, 2026
25 of 28 checks passed
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Mar 7, 2026

Landed via temp rebase onto main.

  • Gate: pnpm format:check; pnpm test -- --run src/agents/tools/nodes-tool.test.ts src/infra/system-run-command.test.ts src/infra/system-run-command.contract.test.ts
  • Note: pnpm tsgo is currently red on unchanged extensions/feishu/src/monitor.test-mocks.ts
  • Land commit: e959b74
  • Merge commit: ac63f30

Thanks @madsmash!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: nodes.run broken since 2026.3.2 — internal rawCommand/command[] fails GHSA-h3f9-mjwj-w476 consistency check

2 participants