From 3f81b3ef794c3985f485f7fcee496a76d5d84b8b Mon Sep 17 00:00:00 2001 From: Sekiph82 Date: Fri, 4 Dec 2026 01:27:21 +0300 Subject: [PATCH 1/2] fix(ci): runner keeps stopping the pytest tree when taskkill writes to stderr Under Windows PowerShell 5.1 with $ErrorActionPreference = 'Stop', `2>&1` on a native command turns its stderr into a terminating NativeCommandError. A graceful `taskkill /T` that cannot close a windowless console child reports it on stderr, so the wrapper aborted with exit 1 before the forced kill and before reporting the budget code (tests/ci/test_packlab_test_runner_behavior.py: 4 failures on main). Stop-PytestTree now uses a local 'Continue' preference; the forced kill path runs. Co-Authored-By: Claude Opus 5.5 --- tools/dev/run_packlab_tests.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 { } From dfbef6fd838e2ebce53c853426d244496c9e901c Mon Sep 17 00:00:00 2001 From: Sekiph82 Date: Fri, 4 Dec 2026 01:30:50 +0300 Subject: [PATCH 2/2] docs(coordination): PR #110 runner taskkill review record (PASS) Co-Authored-By: Claude Opus 5.5 --- .../CLAUDE_PEER_REVIEW_RUNNER_TASKKILL_V01.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 coordination/sessions/M21-C001/CLAUDE_PEER_REVIEW_RUNNER_TASKKILL_V01.md 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).