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

Merged
bobcatchris merged 1 commit from upstream-pr/2678 into main 2026-11-30 10:12:47 +00:00
bobcatchris commented 2026-11-30 01:46:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-30T01:46:54Z.


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5557516553 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2678). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-30T01:46:54Z. --- 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)
lixonik commented 2026-11-30 02:27:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T02:27:33Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7267023885 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2678#issuecomment-7267023885). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-30T02:27:33Z. --- 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.
fiestorra commented 2026-11-30 04:34:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T04:34:27Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7268894741 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2678#issuecomment-7268894741). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T04:34:27Z. --- 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.
MoonEyes commented 2026-11-30 10:12:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T10:12:44Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275281210 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2678#issuecomment-7275281210). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T10:12:44Z. --- 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).
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!2678
No description provided.