Reap semantic test children that race cancellation (SEMANTIC-RUNNER-REGISTER-CANCEL) #2073

Closed
alexandersato0830 wants to merge 1 commit from upstream-pr/2073 into main
alexandersato0830 commented 2026-11-25 19:35:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by alexandersato0830 on 2026-11-25T19:35:43Z.


Claimed in the coordination issue as: SEMANTIC-RUNNER-REGISTER-CANCEL

What and why

The parallel runner can report cancellation while a worker is between launching its subprocess and registering it. The cancellation snapshot then misses the child. Share a cancellation event with workers and check it before launch and under the registration lock. A late child is terminated and reaped by its worker. The regression holds a real subprocess launch at that boundary with thread events.

Tested

  • Windows 11, Python 3.14.9. Main e18b59a printed interrupted and returned 130, then the held child reported normal completion. The regression passed with the fix.
  • py -3.14 -I tests/test_run_semantic_tests.py ran 27 cases successfully with the POSIX signal case skipped.
  • Parallel semantic CLI smoke with test_library_compute_forms.py passed (12 tests).
  • git merge-tree confirmed this patch applies alongside #2071.
  • Verified git diff --check and the source-only check.

GPUs tested: n/a.

AI-assisted: yes.

  • Based on current main.
  • One topic.
  • Uses source and synthetic fixtures.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5497874164 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2073). Originally posted by [alexandersato0830](https://github.com/alexandersato0830) on 2026-11-25T19:35:43Z. --- Claimed in the coordination issue as: [SEMANTIC-RUNNER-REGISTER-CANCEL](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172445639) ### What and why The parallel runner can report cancellation while a worker is between launching its subprocess and registering it. The cancellation snapshot then misses the child. Share a cancellation event with workers and check it before launch and under the registration lock. A late child is terminated and reaped by its worker. The regression holds a real subprocess launch at that boundary with thread events. ### Tested - Windows 11, Python 3.14.9. Main `e18b59a` printed `interrupted` and returned 130, then the held child reported normal completion. The regression passed with the fix. - `py -3.14 -I tests/test_run_semantic_tests.py` ran 27 cases successfully with the POSIX signal case skipped. - Parallel semantic CLI smoke with `test_library_compute_forms.py` passed (12 tests). - `git merge-tree` confirmed this patch applies alongside #2071. - Verified `git diff --check` and the source-only check. GPUs tested: n/a. AI-assisted: yes. - [x] Based on current `main`. - [x] One topic. - [x] Uses source and synthetic fixtures.
DeadlyChirp commented 2026-11-26 10:01:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T10:01:14Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_run_semantic_tests.py: 26 passed, 1 skipped (the POSIX process-group SIGINT test), 33 subtests passed. On main the same file has 25 tests, all passing.

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7188798766 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2073#issuecomment-7188798766). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-26T10:01:14Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_run_semantic_tests.py`: 26 passed, 1 skipped (the POSIX process-group SIGINT test), 33 subtests passed. On main the same file has 25 tests, all passing. (AI-assisted test run; output checked by hand.)
DadaCap commented 2026-11-28 08:06:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T08:06:55Z.


Thanks for this fix! It passed our maintainer testing (local release candidate, Windows 11: translator and Python suites with no new failure, game runs with no regression), but it now conflicts with main: #1437, merged a few minutes ago, rewrote the same lines of run_semantic_tests.py's run_module().

To get this merged, a rebase on main is all it needs. The resolution we used and tested locally:

  • keep #1437's result_path, env = result_environment(scratch) line,
  • add your cancel check right after it (if cancelled is not None and cancelled.is_set(): return 130, 0, ""),
  • drop the old count_path lines, which nothing reads any more.

Once it's rebased we'll re-run the tests and merge.

AI-assisted (Claude Code), posted for DadaCap (maintainer).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236372275 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2073#issuecomment-7236372275). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T08:06:55Z. --- Thanks for this fix! It passed our maintainer testing (local release candidate, Windows 11: translator and Python suites with no new failure, game runs with no regression), but it now conflicts with `main`: #1437, merged a few minutes ago, rewrote the same lines of `run_semantic_tests.py`'s `run_module()`. To get this merged, a rebase on `main` is all it needs. The resolution we used and tested locally: - keep #1437's `result_path, env = result_environment(scratch)` line, - add your cancel check right after it (`if cancelled is not None and cancelled.is_set(): return 130, 0, ""`), - drop the old `count_path` lines, which nothing reads any more. Once it's rebased we'll re-run the tests and merge. _AI-assisted (Claude Code), posted for DadaCap (maintainer)._
TheGeogeo commented 2026-11-28 22:16:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T22:16:47Z.


Duplicate check (diff reading only, no build): not a duplicate of #2201. This PR closes the race between Ctrl+C cancellation and a worker still inside Popen. #2201 kills a timed worker's whole process group on POSIX. They conflict textually in scripts/run_semantic_tests.py (git merge-tree).

Suggest keeping both: this one first once rebased (needs rebase; run_module on main now uses result_environment), then #2201 on top of it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246623505 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2073#issuecomment-7246623505). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T22:16:47Z. --- Duplicate check (diff reading only, no build): not a duplicate of #2201. This PR closes the race between Ctrl+C cancellation and a worker still inside `Popen`. #2201 kills a timed worker's whole process group on POSIX. They conflict textually in `scripts/run_semantic_tests.py` (`git merge-tree`). Suggest keeping both: this one first once rebased (`needs rebase`; `run_module` on `main` now uses `result_environment`), then #2201 on top of it. AI-assisted (Claude Code).
aslan2142 commented 2026-12-01 11:56:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:56:15Z.

Review: CHANGES_REQUESTED


Reviewed against current main: closing the cancellation/registration race for semantic test children in scripts/run_semantic_tests.py looks solid (and distinct from #2201), but this branch conflicts with main and has no green CI run. Please rebase onto current main so CI runs cleanly.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130770694 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2073#pullrequestreview-6130770694). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:56:15Z. **Review:** CHANGES_REQUESTED --- Reviewed against current `main`: closing the cancellation/registration race for semantic test children in `scripts/run_semantic_tests.py` looks solid (and distinct from `#2201`), but this branch conflicts with `main` and has no green CI run. Please rebase onto current `main` so CI runs cleanly. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:24:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:24:58Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319262829 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2073#issuecomment-7319262829). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:24:58Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2073
No description provided.