Repository navigation
fix(ci): stop the Tier 1 runner missing a Ctrl-C, and deflake timing-dependent tests - #568
Merged
Merged
Conversation
…dependent tests The Tier 1 runner waited for scan results with no time limit. On Linux a Ctrl-C that arrives while a scan is starting can be handled on the scan thread, which does not wake that wait, so the run went on until a scan ended. The main loop now polls every 0.1 seconds. A new test sends the interrupt to a scan thread and checks the run is aborted. The rest is test-only. Each change removes a race or a wall-clock bound that a busy runner could miss, without dropping an assertion: - test_run_tier1: the timeout test moves its fake clock only after the scan has read it. - test_harbor_local_mode: PID files are published with a rename, exit probes poll for up to 5 seconds, and one cleanup bound runs on a manual clock. - test_nvidia_build_bridge: the 1 second bridge start wait is now a 30 second hang guard that fails at once if the server thread died. - test_harbor_secure_docker_environment, test_model_catalog: time bounds that coverage tracing or a stalled runner pushed past their limit. - test_judge_failure_artifacts: the RAGAS cleanup test runs on a virtual clock and the deadline alarm is raised from the loop's idle wait. - Two sidecar tests no longer depend on sensitive-named variables in the shell that runs pytest. Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
1 task done
chrisknvidia
marked this pull request as ready for review
November 15, 2026 05:43
chrisknvidia
requested review from
mosheabr,
rmalani-nv and
rng1995
as code owners
November 15, 2026 05:43
This was referenced Nov 16, 2026
Merged
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.
Summary
Last week 37 failed CI test jobs were flakes: a sibling job passed on the same commit, or the failure was on
main. This PR fixes the tests behind 21 of them. Of the other 16, about half were already fixed onmain(#349, #393, #439, #466). The rest are one Windows product timeout, listed below, and four tests that each failed on a single branch and were not investigated.One fix is in product code. The rest are test-only, and no assertion was removed.
Product fix: the Tier 1 runner could miss a Ctrl-C
test_ctrl_c_ends_running_scans_and_their_toolsfailed on 4 jobs, one onmain. The test was right.run()inci/run_tier1.pywaited for scan events withevents.get()and no time limit. On Linux,subprocess.Popenblocks signals in the calling thread while it starts the child. A Ctrl-C that arrives in that window is handled on the scan thread, which does not wake the main thread's wait, so the run carried on until a scan ended.The main loop now waits with
events.get(timeout=POLL_SECONDS)(0.1 s), the same interval the scan threads already poll at. A new test,test_ctrl_c_handled_on_a_scan_thread_still_ends_the_run, sends the interrupt to a scan thread and checks that the run is aborted.In a Linux container with the xdist workers pinned to one CPU, the Ctrl-C test failed 10 of 512 runs without the fix, with the same message as CI, and 0 of 576 with it.
Test-only fixes
tests/ci/test_run_tier1.pytest_scan_timeout_also_ends_the_scanner_tools,is_alive()tests/test_harbor_local_mode.pyinvalid literal for int(): ''on Linuxtests/test_harbor_local_mode.pyDID NOT RAISE ProcessLookupErroron macOS, 3 teststests/test_harbor_local_mode.pymaintests/test_nvidia_build_bridge.pytests/test_harbor_secure_docker_environment.pytests/test_model_catalog.pytests/tier3/test_judge_failure_artifacts.pymainon 13 NovTwo more changes are preventive, with no CI failure on record:
test_ragas_goal_judge_obeys_the_required_judge_time_budget[deadline_alarm]armed a 10 ms real timer that could fire before the scorer was suspended. The alarm is now raised from the loop's idle wait.tests/test_harbor_secure_docker_environment.pyfailed on any machine whose shell exports a sensitive-named variable with a short value, such asSOME_SESSION=1. They now clear those variables first. CI never hit this; developer machines do.Please look at
run(). It is the only product change.Not in this PR
test_bounded_harbor_process_drops_partial_secret_at_output_limitfailed once becausetaskkill /T /Ftook longer than the product's 5 s wait. That is a product budget, it needs a Windows machine, and it is not changed here.MY_AUTH=1exported, a task whose own Compose file interpolates a value containing1is refused. The tests are isolated from it here; the product behaviour is unchanged.test_exec_timeout_terminates_background_descendants.Verification
make lint(ruff checkandruff format --checkon the changed files)make testmake buildThe six changed test files passed together on macOS, Python 3.12, under
-n 4, before the rebase onto currentmain: 1137 passed.A re-run after the rebase, on the same machine under much heavier load, gave 1135 passed and 2 timeouts. Both are in tests this PR does not change:
test_local_callback_streams_safe_partial_line_before_process_exitandtest_streaming_and_buffered_redaction_union_is_deterministic_for_offset_overlaps. The first fails the same way on plainmainat that load (2 of 3 runs), and the second passed when run alone.Each fix was written by one pass and checked by a second, independent one. For every changed test the reviewer broke the behaviour it guards and confirmed the test still fails. Where a CI failure could be reproduced by injecting the stall or the slow exit, the old test failed with the CI message and the new one passed.
Not verified:
Release Impact
CHANGELOG.mdOne entry under Fixed for the Ctrl-C change. The test changes need none.