run_semantic_tests: stop active subprocesses and cancel queued modules on interrupt (SEMANTIC-RUNNER-INTERRUPT) #1936
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1936"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T16:12:53Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T16:55:57Z.
Updated in commit \
30a2a1862\ (cc @Zalthor re verification feedback):AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T19:21:43Z.
Merged, thanks! The new tests pass here (26/26), and on
mainthe test file stops on an uncaughtKeyboardInterrupt. The Windows paths are guarded (taskkillunderos.name == "nt", thekillpgtest skipped off POSIX).main205bda4a4+30a2a1862: the semantic suite passes (491 files, 6,312 tests, 0 files failed);test_run_semantic_testspass; the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.Popenwould close the small window where a worker that already took a job still starts it after Ctrl+C.scripts/run_semantic_tests.py, so they now needmainmerged in.AI-assisted (Claude Code, Claude Opus 5.5).