Repository navigation
scripts: give the CLI tests' PowerShell launches a shared 120 s limit, and report what a timed-out launch printed - #1043
Merged
Pedro Henrique Penna (ppenna) merged 2 commits intoOct 30, 2026
Conversation
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/issue-1030-debug-test-fix-commit
branch
from
October 30, 2026 06:34
49ec8f1 to
1be1622
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Repeated timeouts can exhaust the Windows CLI job’s 15-minute limit and lose deferred failure reports because they are not flushed to stderr before raising.
1 open issue
What changed in this PR
Reduces Windows CLI test flakes caused by slow PowerShell launches and improves diagnostics when a launch times out, addressing #1030.
Changes:
- Centralizes PowerShell launches under a 120 s default timeout, preserving the storage events test’s 300 s limit.
- Reports captured stdout and stderr on timeout, decoding byte output when needed.
- Adds helper and launch-policy tests to both CLI validation steps and documents the behavior.
| File | Description |
|---|---|
scripts/test_tool_versions.py |
Uses the shared PowerShell launcher. |
scripts/test_setup_azure.py |
Migrates Azure setup tests to the shared launcher. |
scripts/test_powershell_testing.py |
Tests launch options, timeout diagnostics, and shared-helper use. |
scripts/test_nvx_tools.py |
Migrates CLI tests while retaining the storage events timeout. |
scripts/powershell_testing.py |
Defines the default timeout and captured-output reporting. |
doc/project-structure.md |
Describes the new testing helper. |
doc/ci.md |
Documents PowerShell test limits and timeout reporting. |
.github/actions/validate-nvx/action.yml |
Runs the new tests on Linux and Windows. |
Review effort: Max
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/issue-1030-debug-test-fix-commit
branch
from
October 30, 2026 06:48
1be1622 to
49fc19e
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Repeated 120-second waits can exhaust the CLI job's 15-minute timeout before captured-output diagnostics reach the log, so reports must be emitted and flushed before raising.
1 open issue
1 resolved since last review
Review effort: Max
The tooling's unit tests ran their PowerShell scripts with limits chosen at each call site: 30 s for most, 90 s for the Windows installer test, 120 s for the tool manifest tests, and 300 s for the storage events test. A launch takes well under a second on a workstation and a few seconds on a GitHub-hosted runner, but such a runner twice held up the first PowerShell launch of the Windows unittest process for more than 30 s, so test_windows_acceptance_forwards_benchmark_scratch timed out in the dev push run 40946801274 and in the first run of #797, though the step that it runs had no defect. On 2026-10-23, the next two PowerShell tests ran slowly too, so raising only that test's limit could have moved the failure to them. The new scripts/powershell_testing.py holds POWERSHELL_TIMEOUT, 120 s, the limit that the tool manifest tests already used, and run_powershell(), which runs a command line under that limit, or under one that its test passes, and captures its output as text. Every PowerShell launch of test_nvx_tools.py, test_setup_azure.py, and test_tool_versions.py now goes through it, with its arguments, working directory, and environment unchanged. A script that hangs still fails its test, but a runner stall shorter than the limit no longer does. Only the storage events test passes a limit of its own, its 300 s, because its save step runs the real `performance storage-events`, which queries the host's event logs for up to 120 s each. The tests neither warm PowerShell up nor retry a launch: a warm-up does not help when the slowness outlasts the first launch, and a retry would hide a script that sometimes hangs. The new test_powershell_testing.py checks what run_powershell() passes to subprocess.run(), and that no scripts/test_*.py module starts PowerShell through subprocess itself, which would give that launch a limit of its own; at dev, it finds the 12 launches that this commit moves. Both CLI validation steps run it. doc/ci.md describes the limit and its exception, and doc/project-structure.md the module. Part of #1030 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rinted When a launch outlasted its limit, subprocess.run() killed PowerShell and raised TimeoutExpired, whose message names only the command line. So neither failed run of test_windows_acceptance_forwards_benchmark_scratch showed how far PowerShell had got when the runner held it up, and a stall that outlasts even the shared limit would show no more. run_powershell() now turns the TimeoutExpired into an AssertionError, which unittest reports as a failure of the test. Its message names the program and the limit, then gives what PowerShell wrote to stdout and to stderr until the kill, or "nothing" for a stream that stayed empty. The TimeoutExpired remains its cause, so the traceback still shows the command line. run() collects that output as text on Windows, but leaves bytes, or None, elsewhere, where the tool manifest tests run PowerShell 7, so the report decodes bytes as UTF-8, replacing what does not decode. unittest reports failures only once the whole run ends, but NVX CLI / Windows has a 15-minute limit, and a PowerShell that hung at every launch would keep the 14 launches of the CLI validation test alone running for 28 minutes. A job that its limit cancels would lose every report, so run_powershell() also writes each report to stderr as soon as it kills the launch. A test raises a TimeoutExpired of each kind under run_powershell() and checks the report, its cause, and what reached stderr. doc/ci.md and doc/project-structure.md describe the report. Part of #1030 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
force-pushed
the
agents/issue-1030-debug-test-fix-commit
branch
from
October 30, 2026 07:12
49fc19e to
70306c0
Compare
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-1030-debug-test-fix-commit
branch
October 30, 2026 13:09
This was referenced Oct 30, 2026
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.


Fixes #1030
NVX CLI / Windowsfailed twice in a month, in thedevpush run 40946801274 and in the first run of #797, because a GitHub-hosted runner held up the unittest process's firstpowershell.exelaunch for longer than the 30 s thattest_windows_acceptance_forwards_benchmark_scratchgave it. Neither failure showed what PowerShell had done. As the issue suggests, the PowerShell launches of the CLI tests now get one generous limit from a shared constant by default, and a launch that reaches its limit reports what it printed. The tests neither warm PowerShell up nor retry a launch.Changes
scripts: give the CLI tests' PowerShell launches a shared 120 s limitscripts/powershell_testing.pyholdsPOWERSHELL_TIMEOUT, 120 s, the limit thattest_tool_versions.py's launches already had, andrun_powershell(), which runs a command line under it, or under a limit that its test passes, and captures its output as text.test_nvx_tools.pyand 3 intest_setup_azure.py, which had 30 s, or 90 s for the installer test, and_run_powershell()intest_tool_versions.py.performance storage-events, which queries the host's event logs for up to 120 s each.scripts/test_powershell_testing.py, which both CLI validation steps run, checks whatrun_powershell()passes tosubprocess.run(), and that noscripts/test_*.pymodule starts PowerShell throughsubprocessitself. Atdev, that check finds exactly the 12 launches above.doc/ci.mddescribes the limit and its exception, anddoc/project-structure.mdthe module.scripts: report what a timed-out PowerShell launch of the CLI tests printedrun_powershell()turns aTimeoutExpiredinto anAssertionErrorthat names the program and the limit, then gives what PowerShell wrote to stdout and to stderr until the kill, ornothing. TheTimeoutExpired, which names the command line, stays its cause.subprocess.run()collects a killed child's output as text on Windows, but leaves bytes, orNone, elsewhere, where the tool manifest tests run PowerShell 7, so the report decodes bytes.NVX CLI / Windowshas a 15-minute limit, which a PowerShell that hung at every launch would exceed. Sorun_powershell()also writes each report to stderr as soon as it kills the launch, and a job that its limit cancels keeps it.A launch that a stall holds past the limit now fails like this, on
prometheus28below. The report reaches the log when the launch is killed, before the subtest'sFAIL, and again in the failure's details:Validation
prometheus28(Windows Server 2025 Datacenter, bare metal, Python 3.14.7, Windows PowerShell 5.1.26100), in a separate worktree, with PyYAML in a separate virtual environment:dev, the 76 PowerShell launches took 0.29–1.77 s, the first 0.52 s.powershell.exeprocesses that they started, withNtSuspendProcess, for a set time. Atdeve42b17959, holding the forwards test's first launch for 40 s reproduced the incident: itsscratch=''subtest raisedTimeoutExpiredafter 30.03 s, with no output, and its second subtest passed in 0.41 s.49ec8f1f8, the head before the rebase ontodev4434b1af0, which changed none of these files, and before the review fixes, a 130 s stall failed after 120.03 s with the report. A stall that began 1 s into a script, after it printed a line to each stream, reported both lines.devand 1,494 at49ec8f1f8, with the same 55 failures and errors:test_setup_azure's Linux and MSHV shell tests, which runbashscripts that fail on this host atdevtoo.70306c00e, the 130 s stall produced the output above.nvx-kvm-test(Azure Linux 3, Python 3.12.16), in a separate worktree at49ec8f1f8:run_powershell()ranshunder a 3 s limit to check the report on POSIX, whererun()leaves bytes orNone: it reported the decoded lines, andnothingwhen nothing arrived.Local, Windows 11 (Python 3.14.7, Windows PowerShell 5.1):
ruff checkandruff format --check, pyright for Linux and for Windows,compileall, the Markdown link check,test_powershell_testing.py, and thetest_windows_*tests oftest_nvx_tools.py; at the head, also the Windows tests oftest_setup_azure.py, and aunittest -vrun of a realpowershell.exethat hangs, which printed the report beforeFAIL.49ec8f1f8: 1,494 tests. Its 27 failures and errors are in 8 tests that run shell scripts,test_microvm_tests' host loopback and private network ingress tests andtest_setup_azure's Linux and MSHV setup tests, and are the same as those 8 tests' atdevon this workstation.Left to CI: the hosted
windows-latestimage, on which the stall happened, and PowerShell 7 on the hosted Ubuntu runner. The stall's cause stays unknown, as in the issue: this change makes a stall shorter than 120 s harmless and a longer one visible.