Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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).
7 changes: 5 additions & 2 deletions tools/dev/run_packlab_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down