Visitar URL original
Slai Agent Runtime: Preserve verbatim stop-parsing argument passing by huong8373tt-beep · Pull Request #28162 · PowerShell/PowerShell · GitHub
Skip to content

Slai Agent Runtime: Preserve verbatim stop-parsing argument passing - #28162

Open
Slai.life (huong8373tt-beep) wants to merge 2 commits into
PowerShell:masterfrom
huong8373tt-beep:slai/fix-stop-parsing-legacy-commandline
Open

Slai.life (huong8373tt-beep) wants to merge 2 commits into
PowerShell:masterfrom
huong8373tt-beep:slai/fix-stop-parsing-legacy-commandline

Conversation

@huong8373tt-beep

@huong8373tt-beep Slai.life (huong8373tt-beep) commented Oct 7, 2026 •

Copy link
Copy Markdown

Summary

  • Preserve legacy command-line construction for Windows native commands that use the --% stop-parsing marker.
  • Detect --% before parameter formatting so the effective Legacy style applies consistently to arguments both before and after the marker.
  • Add regression coverage for escaped quotes after --% and for a mode-sensitive array argument before it, under both Standard and Windows argument-passing modes.

Fixes #18664.

Validation

  • Reproduced on Windows with PowerShell 7.6.6: with Standard or Windows argument passing, --% /p:Category=\"CI,Nightly\" reached a native test executable with extra escaping.
  • Built the Windows win7-x64 Debug product locally.
  • Ran NativeCommandArguments.Tests.ps1 with Pester 4.10.1 against the built executable: 66 passed, 0 failed, 1 skipped.
  • git diff --check passed.

AI assistance disclosure

This issue was discovered while Slai Agent Runtime was operating in a Windows environment. The developer authorized this contribution after the issue was reproduced and the fix was validated. Slai Agent Runtime assisted with reproduction, implementation, and test execution; the account owner is responsible for this submission.

@huong8373tt-beep
Slai.life (huong8373tt-beep) requested a review from a team as a code owner October 7, 2026 19:25
Copilot AI balanced review requested due to automatic review settings October 7, 2026 19:25
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Pre-marker array arguments can still be constructed using non-legacy rules and passed incorrectly.

1 open finding
What changed in this PR

Updates Windows native-command invocation so --% selects legacy argument passing, addressing #18664.

Changes:

  • Tracks whether --% was encountered during binding.
  • Selects legacy process arguments on Windows.
  • Adds regression coverage for escaped quotes.
File Description
NativeCommandArguments.Tests.ps1 Tests escaped quotes after --%.
NativeCommandProcessor.cs Selects legacy argument dispatch.
NativeCommandParameterBinderController.cs Exposes marker detection.
NativeCommandParameterBinder.cs Records marker presence.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

/// <param name="filePath"></param>
private bool UseSpecialArgumentPassing(string filePath) =>
NativeParameterBinderController.ArgumentPassingStyle switch
(Platform.IsWindows && NativeParameterBinderController.HasVerbatimArgumentMarker)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — addressed in a8d7868. The binder now detects --% before any parameter formatting and applies the effective Legacy style across the full Windows native-command argument construction. Added regression coverage for the mode-sensitive array case before the marker (testexe -echoargs 1, 2 --% tail) under Standard and Windows modes.

@huong8373tt-beep Slai.life (huong8373tt-beep) changed the title Preserve verbatim stop-parsing argument passing Slai Agent Runtime: Preserve verbatim stop-parsing argument passing Oct 8, 2026
@huong8373tt-beep

Copy link
Copy Markdown
Author

Addressed in a8d7868. The binder now detects --% before any parameter formatting and applies the effective Legacy style across the full Windows native-command argument construction. Added regression coverage for a mode-sensitive array argument before the marker (testexe -echoargs 1, 2 --% tail) under both Standard and Windows modes.

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.

Stop-parsing token is broken

2 participants