COMPUTE-WORKERS-WIN-VENV: launch Windows compute workers with sys._base_executable #2678

Manually merged
github merged 1 commit from github-bot/gh-2678 into gh-pr/2678/base 2026-11-30 10:13:31 +00:00 AGit
Owner

@⁠bobcatchris on GitHub · 2026-11-30 01:46 UTC · original
bobcatchris:fix/compute-workers-win-venv → main · +25 −1 · 2 files · 1 commits · merged 2026-11-30 10:12 UTC

Claimed in #2570 as COMPUTE-WORKERS-WIN-VENV.

What and why

In scripts/compute_workers_win.py, Windows worker processes were launched with sys.executable, which inside a Windows virtual environment (.venv) spawns the venv redirector launcher (venvlauncher.exe) instead of the real base Python interpreter, breaking worker creation / handle inheritance. Using getattr(sys, "_base_executable", sys.executable) or sys.executable launches the underlying Python binary directly while keeping identical behavior outside a venv.

Verification (Red -> Green)

Hardware / OS: native Windows 11 Pro (10.0.26200), Python 3.12.

  • Rebased cleanly onto main (40e7fe69d).
  • python -m unittest tests/test_translate_pipeline_compute.py -v — ALL PASS (including the new venv _base_executable regression test).
  • python -I scripts/check_no_game_data.py scripts/compute_workers_win.py tests/test_translate_pipeline_compute.py — PASS.

AI-assisted: Antigravity (Gemini 4 Neon)

**@⁠bobcatchris** on GitHub · 2026-11-30 01:46 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2678) `bobcatchris:fix/compute-workers-win-venv` → `main` · +25 −1 · 2 files · 1 commits · merged 2026-11-30 10:12 UTC Claimed in #2570 as `COMPUTE-WORKERS-WIN-VENV`. ### What and why In `scripts/compute_workers_win.py`, Windows worker processes were launched with `sys.executable`, which inside a Windows virtual environment (`.venv`) spawns the venv redirector launcher (`venvlauncher.exe`) instead of the real base Python interpreter, breaking worker creation / handle inheritance. Using `getattr(sys, "_base_executable", sys.executable) or sys.executable` launches the underlying Python binary directly while keeping identical behavior outside a venv. ### Verification (Red -> Green) Hardware / OS: native Windows 11 Pro (`10.0.26200`), Python 3.12. - Rebased cleanly onto `main` (`40e7fe69d`). - `python -m unittest tests/test_translate_pipeline_compute.py -v` — **ALL PASS** (including the new venv `_base_executable` regression test). - `python -I scripts/check_no_game_data.py scripts/compute_workers_win.py tests/test_translate_pipeline_compute.py` — **PASS**. AI-assisted: Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 01:49:12 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-30 02:27 UTC · original

Independent Windows A/B on fb163d9a9c6fee18c29d1796e6b5210d253faa3a merged locally into 182d0c17462f86d788c2203da6dd524442a76a8d. Native Windows 10 22H2 (build 19045), Ryzen 9 5950X, CPython 3.10.9 and 3.12.1, SPIRV-Tools v2026.4.

  • Main worker + PR test: a fresh Windows venv and --jobs 2 reproduced Windows compute job limits not in force in both workers on both Python versions. The run exited 1.
  • PR worker + same test: both Python versions exited 0 and produced both synthetic shader records.
  • The complete tests/test_translate_pipeline_compute.py file passed all four Windows cases on both Python versions, including the single-worker/parallel parity, cache reuse, and lock/interruption checks. The Linux-only test was skipped.

The two arms differed only in scripts/compute_workers_win.py. I ran the existing checked-in synthetic inputs and the repository's no-game-data check on both changed files.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-30 02:27 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2678#issuecomment-7267023885) Independent Windows A/B on `fb163d9a9c6fee18c29d1796e6b5210d253faa3a` merged locally into `182d0c17462f86d788c2203da6dd524442a76a8d`. Native Windows 10 22H2 (build 19045), Ryzen 9 5950X, CPython 3.10.9 and 3.12.1, SPIRV-Tools v2026.4. - **Main worker + PR test:** a fresh Windows venv and `--jobs 2` reproduced `Windows compute job limits not in force` in both workers on both Python versions. The run exited 1. - **PR worker + same test:** both Python versions exited 0 and produced both synthetic shader records. - The complete `tests/test_translate_pipeline_compute.py` file passed all four Windows cases on both Python versions, including the single-worker/parallel parity, cache reuse, and lock/interruption checks. The Linux-only test was skipped. The two arms differed only in `scripts/compute_workers_win.py`. I ran the existing checked-in synthetic inputs and the repository's no-game-data check on both changed files. AI-assisted.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-30 04:34 UTC · original

Independent verification on this machine (Windows 11, Python 3.13.14, RTX 4090), including the negative control:

1. It applies. git merge-tree --write-tree origin/main refs/pull/2678/head is clean, and the single commit fb163d9a9 cherry-picks onto main 1d22590b9 without a conflict.

2. Its tests pass.

python3 -m pytest tests/test_translate_pipeline_compute.py tests/test_compute_workers_win.py -q
  -> 8 passed, 1 skipped, 24 subtests

3. The new test catches the old behaviour - this is the part I check before believing a fix.

With the PR applied but scripts/compute_workers_win.py reverted to main's version:

  -> 1 failed, 7 passed, 1 skipped, 24 subtests
     FAILED tests/test_translate_pipeline_compute.py::WorkerParity::test_windows_venv_worker

So test_windows_venv_worker fails on the old script and passes on the new one. That is a real red->green on Windows, not just a test that agrees with itself.

What I did not test: the venv path on Linux/macOS, and the actual worker launch with a real sys._base_executable in an activated virtual environment - test_windows_venv_worker exercises it with the fixture the PR provides, not with a hand-built venv. Someone on a machine with a venv in use should confirm the end-to-end case; what is proven here is that the code path the test names is the one that changed and that the test catches its absence.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-30 04:34 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2678#issuecomment-7268894741) Independent verification on this machine (Windows 11, Python 3.13.14, RTX 4090), including **the negative control**: **1. It applies.** `git merge-tree --write-tree origin/main refs/pull/2678/head` is clean, and the single commit `fb163d9a9` cherry-picks onto `main` `1d22590b9` without a conflict. **2. Its tests pass.** ``` python3 -m pytest tests/test_translate_pipeline_compute.py tests/test_compute_workers_win.py -q -> 8 passed, 1 skipped, 24 subtests ``` **3. The new test catches the old behaviour - this is the part I check before believing a fix.** With the PR applied but `scripts/compute_workers_win.py` reverted to `main`'s version: ``` -> 1 failed, 7 passed, 1 skipped, 24 subtests FAILED tests/test_translate_pipeline_compute.py::WorkerParity::test_windows_venv_worker ``` So `test_windows_venv_worker` fails on the old script and passes on the new one. That is a **real** red->green on Windows, not just a test that agrees with itself. **What I did not test:** the venv path on Linux/macOS, and the actual worker launch with a real `sys._base_executable` in an activated virtual environment - `test_windows_venv_worker` exercises it with the fixture the PR provides, not with a hand-built venv. Someone on a machine with a venv in use should confirm the end-to-end case; what is proven here is that the code path the test names is the one that changed and that the test catches its absence. Written with an AI assistant.
github-bot changed target branch from main to gh-pr/2678/base 2026-11-30 10:13:25 +00:00
github manually merged commit fb163d9a9c into gh-pr/2678/base 2026-11-30 10:13:26 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-30 10:12 UTC · original

Merging. Head fb163d9a9 merges cleanly with main 1b0f657f3 and does not force a rebase of #2566. Red/green from lixonik (two Python versions) and fiestorra (above), redone on Windows 11, Python 3.14: without the change the venv test fails, with it tests/test_translate_pipeline_compute.py and tests/test_compute_workers_win.py pass (its first run took 151 s, the two after it 8 s; not explained). The job limits are still checked before the worker gets its work. The script is used by scripts/translate_pipeline_compute.py only, not by make_game.py or the runtime; its digest is part of that script's cache recipe, so that script's caches are made again. Approved by the owner. Merged by MoonEyes.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-11-30 10:12 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2678#issuecomment-7275281210) Merging. Head `fb163d9a9` merges cleanly with `main` `1b0f657f3` and does not force a rebase of #2566. Red/green from lixonik (two Python versions) and fiestorra (above), redone on Windows 11, Python 3.14: without the change the venv test fails, with it tests/test_translate_pipeline_compute.py and tests/test_compute_workers_win.py pass (its first run took 151 s, the two after it 8 s; not explained). The job limits are still checked before the worker gets its work. The script is used by scripts/translate_pipeline_compute.py only, not by make_game.py or the runtime; its digest is part of that script's cache recipe, so that script's caches are made again. Approved by the owner. Merged by MoonEyes. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2678
No description provided.