Skip to content

fix #475: separate Windows cmd and PowerShell actions - #477

Merged
zfoong merged 5 commits into
V1.4.4from
ahmad/fix-windows-shell-guidance
Oct 14, 2026
Merged

zfoong merged 5 commits into
V1.4.4from
ahmad/fix-windows-shell-guidance

Conversation

@ahmad-ajmal

@ahmad-ajmal ahmad-ajmal commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

Add a Windows-only run_powershell action that accepts raw PowerShell source through script. Windows run_shell now explicitly runs cmd.exe command lines and directs PowerShell callers to the dedicated action. Both tools are included in the Windows core action set.

Reject legacy Windows run_shell requests selecting PowerShell, pwsh, or another unsupported interpreter before launching a process. Existing cmd, default, and auto selections continue to run with cmd.exe.

Allow the validation agent to call run_powershell when enabled. Its definition remains disabled by default. Track the new action in agent-app construction activity, prevent action lookup from resolving implementations for another OS, and distinguish a registered process stopped by the user from a command failure.

Closes #475. Replaces #476 after renaming the source branch to ahmad/fix-windows-shell-guidance.

Why

Wrapping PowerShell source in another interpreter can expand variables or literal percent expressions before execution, or return exit code 0 while printing the intended script as a string. A separate tool makes the interpreter explicit before the agent writes the script and supplies a direct disk-query example.

Native stdout, stderr, and exit codes pass through. Commands are not rewritten or retried automatically, and stderr keywords are not used to infer failure.

How to test

  • python -m unittest discover -s tests/windows_shell -v — 21 tests pass locally on Windows. Exercises raw-script quoting, variables, pipelines, multiline input, calculated properties, disk and largest-file queries, literal percent expressions, native errors, stderr and exit codes, cmd compatibility, rejected shell selections, background completion, timeouts, and simulated user stops.
  • A focused dispatch check loads the production validator definition and runner dispatch method: the old action list blocks run_powershell; the corrected list executes $n=2; Write-Output $n with stdout 2, and cmd execution still works. Windows-only action lookup remains enforced on Linux and macOS.
  • ruff format --check . and ruff check . with Ruff 0.16.1 — pass repository-wide.
  • python -m compileall -q app agent_core agents decorators skills — passes.
  • git diff --check — passes.

The Windows CI workflow runs the standard-library regression suite with real OS processes, stubbing Node PATH preparation and cancellation registration. Additional pytest registration/cancellation tests are in tests/test_shell_actions.py; the local follow-up environment did not have pytest installed. Full UI-triggered cancellation and end-to-end LLM retry counts are not covered.

Scope

run_powershell uses Windows PowerShell (powershell.exe), with raw source passed directly through -Command. It does not introduce EncodedCommand, temporary scripts, pwsh selection, or advisory result fields. Explicitly launching an interpreter from a cmd command line remains possible and retains that interpreter's normal quoting semantics. Linux and macOS run_shell schemas are unchanged.

Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
@ahmad-ajmal ahmad-ajmal self-assigned this Oct 7, 2026
@ahmad-ajmal
ahmad-ajmal requested a review from zfoong October 7, 2026 12:25
@ahmad-ajmal
ahmad-ajmal marked this pull request as ready for review October 7, 2026 12:25
@ahmad-ajmal
ahmad-ajmal changed the base branch from dev to V1.4.4 October 7, 2026 12:55
ahmad-ajmal and others added 4 commits October 8, 2026 10:58
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
@ahmad-ajmal ahmad-ajmal changed the title fix #475: guide Windows shell execution and report quoting hazards fix #475: separate Windows cmd and PowerShell actions Oct 14, 2026
@zfoong
zfoong merged commit 043c868 into V1.4.4 Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows run_shell: prevent nested-shell quoting failures and silent wrong output

2 participants