Repository navigation
fix #475: guide Windows shell execution and report quoting hazards - #477
Open
ahmad-ajmal wants to merge 2 commits into
Open
ahmad-ajmal wants to merge 2 commits into
ahmad-ajmal wants to merge 2 commits into
Conversation
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
Windows shell commands can fail or silently produce incorrect output when an agent wraps PowerShell source in another interpreter. Keep concise raw-script instructions in the Windows-only run_shell schema, and report the selected shell, resolved executable and advisory guidance for common nested PowerShell wrappers.
Closes #475. Replaces #476 after renaming the source branch to ahmad/fix-windows-shell-guidance.
Why
A nested
$n=2; Write-Output $nloses its variables before the inner PowerShell executes. A single-quoted-Commandwrapper can return exit code 0 while printing the script as a string. The Windows tool schema gives a direct disk-query example, and nested-call results advise verifying stdout even on success.Shared system context and AGENT.md stay unchanged. Preserve native stderr and exit codes instead of guessing error types from stderr keywords. Explicit cmd, default/auto routing and intentional nested execution retain their behavior; submitted commands are never rewritten or retried automatically.
How to test
python -m unittest discover -s tests/windows_shell -v— 17 tests pass locally on Windows. Includes seven direct-script cases each on Windows PowerShell and pwsh, the disk query, both silent-output reproductions, native parser errors, application-defined stderr, successful stderr, cmd compatibility, nonzero exits, timeout registration/cleanup and background completion.ruff format --check .andruff check .with Ruff 0.16.1 — repository-wide checks pass.git diff --check— passes.A focused Windows CI workflow runs the tests using only the Python standard library. They execute the production function source with real OS processes, while stubbing Node PATH preparation and cancellation registration. Full user-triggered cancellation and an end-to-end LLM retry-count comparison are not covered.
Scope
Guidance recognizes common nested powershell/pwsh -Command wrappers. It is advisory and does not establish whether arbitrary successful output is correct. The existing direct -Command transport passed the reproductions, so this change does not introduce EncodedCommand or temporary scripts.