diff --git a/coordination/sessions/M21-C001/CLAUDE_PEER_REVIEW_RUNNER_TASKKILL_V01.md b/coordination/sessions/M21-C001/CLAUDE_PEER_REVIEW_RUNNER_TASKKILL_V01.md new file mode 100644 index 00000000..0dbae466 --- /dev/null +++ b/coordination/sessions/M21-C001/CLAUDE_PEER_REVIEW_RUNNER_TASKKILL_V01.md @@ -0,0 +1,21 @@ +# CLAUDE_PEER_REVIEW — runner taskkill native stderr (PR #110) +Reviewer: independent Claude reviewer subagent (not the implementer) +Base: main e9b5d4a1 Head: fix/runner-taskkill-native-stderr 3f81b3ef +Scope: tools/dev/run_packlab_tests.ps1 Stop-PytestTree (+5/-2) +Verdict: PASS (CLAUDE_PEER_AUDITED_PASS) + +Evidence (local, Windows PowerShell 5.1; pwsh absent): +- main: tests/ci/test_packlab_test_runner_behavior.py 4 failed / 2 passed; + base/fixture/staging/measurement cases exit 1 vs 42/43/44/45 with + NativeCommandError from `taskkill.exe /T 2>&1` at run_packlab_tests.ps1:230. + Main run left 4 orphan time.sleep(60) python pairs (expired after 60 s). +- branch: 6 passed (13.58 s). Manual staging-over run: exit 44, empty stderr, + graceful taskkill errors written as text, pytest_tree_graceful_stop_timeout=true, + forced /T /F terminated all tree PIDs. +- No python processes created by the branch run survived; %TEMP%\PackLab\runner-contract empty. +Scope: function-local EAP=Continue; callees (taskkill, ForEach-Object, Write-Output, +Start-Sleep) do not rely on Stop; $proc.Kill/WaitForExit are .NET (always terminating) and +already try/catch-wrapped. No other native `&` invocation in the runner (hygiene is .ps1; uv +and contract python via Process.Start). +Limits: hazard only reproducible on PS 5.1; GitHub windows-latest uses pwsh 7.x so CI does +not exercise this path. Silent /F failure is backstopped by $proc.Kill() (line 239). diff --git a/tools/dev/run_packlab_tests.ps1 b/tools/dev/run_packlab_tests.ps1 index 8b465106..9633c942 100644 --- a/tools/dev/run_packlab_tests.ps1 +++ b/tools/dev/run_packlab_tests.ps1 @@ -227,12 +227,15 @@ function Get-DiskSnapshot { function Stop-PytestTree { if (-not $proc -or $proc.HasExited) { return } - & taskkill.exe /PID $proc.Id /T 2>&1 | ForEach-Object { Write-Output $_ } + # taskkill reports a child it cannot close gracefully on stderr; under Windows PowerShell 5.1 + # with "Stop", `2>&1` turns that into a terminating NativeCommandError before the forced kill. + $ErrorActionPreference = "Continue" + & taskkill.exe /PID $proc.Id /T 2>&1 | ForEach-Object { Write-Output "$_" } $deadline = [DateTime]::UtcNow.AddSeconds($gracefulStopSeconds) while (-not $proc.HasExited -and [DateTime]::UtcNow -lt $deadline) { Start-Sleep -Milliseconds 250 } if (-not $proc.HasExited) { Write-Output "pytest_tree_graceful_stop_timeout=true" - & taskkill.exe /PID $proc.Id /T /F 2>&1 | ForEach-Object { Write-Output $_ } + & taskkill.exe /PID $proc.Id /T /F 2>&1 | ForEach-Object { Write-Output "$_" } try { if (-not $proc.HasExited) { $proc.Kill() } } catch { } } try { $proc.WaitForExit($finalStopWaitMilliseconds) | Out-Null } catch { }