Repository navigation
fix #475: separate Windows cmd and PowerShell actions - #477
Merged
Merged
Conversation
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a Windows-only
run_powershellaction that accepts raw PowerShell source throughscript. Windowsrun_shellnow 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_shellrequests 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_powershellwhen 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.run_powershell; the corrected list executes$n=2; Write-Output $nwith stdout2, and cmd execution still works. Windows-only action lookup remains enforced on Linux and macOS.ruff format --check .andruff 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_powershelluses 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 macOSrun_shellschemas are unchanged.