vcperf chain command fix - #67
Open
es110 wants to merge 1 commit into
Open
Conversation
es110
marked this pull request as ready for review
August 6, 2026 21:58
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Updates the build-perf-cpp vcperf usage guidance to route invocation through cmd.exe and to prevent /stop from running when /start fails, improving correctness of exit-code handling for CLI agents.
Changes:
- Switches documented
vcperfinvocation from direct PowerShell (& $vcperf) tocmd.exe-mediated execution for more reliable exit codes. - Adds explicit gating so build +
/stoponly execute if/startsucceeds, while still allowing/stopafter build failure when/startsucceeded. - Updates the permission grant + permission probe scripts to follow the new invocation/gating rules.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| $buildExit = & { | ||
| & $vcperf /start /noadmin /level3 MySession | Out-Host | ||
| $startOutput = (& $env:ComSpec /d /c "`"$vcperf`" /start /noadmin /level3 MySession" 2>&1 | Out-String).Trim() |
| msbuild Project.sln /m /t:Rebuild /p:Configuration=Release | Out-Host | ||
| $exitCode = $LASTEXITCODE | ||
| & $vcperf /stop /templates MySession out.etl /jsonAnalysis out.json | Out-Host | ||
| & $env:ComSpec /d /c "`"$vcperf`" /stop /templates MySession `"out.etl`" /jsonAnalysis `"out.json`"" | Out-Host |
| ```powershell | ||
| $buildExit = & { | ||
| & $vcperf /start /noadmin /level3 MySession | Out-Host | ||
| $startOutput = (& $env:ComSpec /d /c "`"$vcperf`" /start /noadmin /level3 MySession" 2>&1 | Out-String).Trim() |
| cmake --build build --parallel | Out-Host | ||
| $exitCode = $LASTEXITCODE | ||
| } | ||
| & $env:ComSpec /d /c "`"$vcperf`" /stop /templates MySession `"out.etl`" /jsonAnalysis `"out.json`"" | Out-Host |
Comment on lines
+252
to
+254
| & $env:ComSpec /d /c "`"$vcperf`" /stop /templates MySession `"out.etl`" /jsonAnalysis `"out.json`"" | Out-Host | ||
| $stopExit = $LASTEXITCODE | ||
| if ($stopExit -ne 0) { throw "vcperf /stop failed with exit code $stopExit." } |
Comment on lines
+145
to
+150
| $stopCmd = "`"$vcperf`" /stopnoanalyze $probe `"$probeEtl`"" | ||
|
|
||
| $stopOutput = (& $env:ComSpec /d /s /c "`"$stopCmd`"" 2>&1 | Out-String).Trim() | ||
|
|
||
| } | ||
| $started = ($startExit -eq 0) -and (Test-Path $probeEtl) |
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.
Modified vcperf invocation guidance in the build-perf-cpp skill so CLI agents can't chain commands in a way that runs
/stopwhen/startfailed.Changes to
SKILL.mdcmd.exe(& $env:ComSpec /d /c ...) instead of& $vcperfdirectly, so$LASTEXITCODEis reliable (direct PowerShell invocation can surface an internal COMHRESULTinstead of vcperf's true exit code)./start— the build,/stop, and/stopnoanalyzenever run unless/startreturned exit code0. After a successful start,/stopstill runs on build failure to preserve the partial trace.cmd.exewith real exit code), Step 4 (gated permission probe), and the MSBuild/CMake/cmd.exe workflow blocks accordingly.Mirrors the equivalent change in the agency plugin.