Repository navigation
run_semantic_tests: stop active subprocesses and cancel queued modules on interrupt (SEMANTIC-RUNNER-INTERRUPT) - #1936
Merged
aslan2142 merged 2 commits intoNov 25, 2026
Conversation
…s on interrupt (SEMANTIC-RUNNER-INTERRUPT) Catch KeyboardInterrupt in run_semantic_tests.py, cancelling queued test modules via pool.shutdown(wait=False, cancel_futures=True) and terminating active child subprocesses so that no orphaned zombie processes or queued modules run after Ctrl+C. In serial mode (-j 1), terminate the discover subprocess on interrupt. Return exit code 130 and output 'interrupted' to stderr without printing a false success summary. Adds regression and lifecycle tests in tests/test_run_semantic_tests.py. AI-assisted (Claude Code)
…d increase sleep margin (SEMANTIC-RUNNER-INTERRUPT) - On Windows, terminate child processes using taskkill /F /T /PID to ensure launcher processes (e.g. venv python.exe wrappers) terminate all child workers. - Increase synthetic sleep duration in tests from 5s to 10s and timeout margin to eliminate timing flakiness under high machine load. AI-assisted (Claude Code).
Contributor
Author
|
Updated in commit \30a2a1862\ (cc @Zalthor re verification feedback):
AI-assisted (Claude Code). |
Collaborator
|
Merged, thanks! The new tests pass here (26/26), and on
AI-assisted (Claude Code, Claude Opus 5.5). |
3 tasks done
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
In
scripts/run_semantic_tests.py, catchKeyboardInterruptduring both parallel module execution and serial test execution, cancelling queued test modules viapool.shutdown(wait=False, cancel_futures=True)and terminating active child subprocesses so that no orphaned zombie processes or queued modules run after Ctrl+C.Changes
_active_processeswith a thread-safe lock; register before execution and unregister upon completion.KeyboardInterrupt(orBaseException), invoke_terminate_active_processes()which terminates and kills registered child processes and cleans up immediately.ThreadPoolExecutorwithpool.shutdown(wait=False, cancel_futures=True)and cancel all uncompleted futures so no pending tests run.concurrent.futures.wait(pending, timeout=0.2, return_when=FIRST_COMPLETED)to ensure sub-second signal delivery across Windows and POSIX.-j 1mode, run discover subprocess with responsiveproc.wait(timeout=0.2)polling and clean interrupt termination.'interrupted'tosys.stderrwithout printing a false success summary.tests/test_run_semantic_tests.py.Item:
SEMANTIC-RUNNER-INTERRUPTAI-assisted (Claude Code)