boot.ps1: take a Python that starts and is 3.12+, not the Microsoft Store alias (BOOT-PS1-PYTHON-ALIAS) #2902
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2902
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/boot-ps1-python-alias"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: BOOT-PS1-PYTHON-ALIAS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7200607660)
What and why
scripts/windows-boot/boot.ps1picks the Python fortools/boot_trace.pywithResolve-Python, which takespythonas soon asGet-Commandfinds it. On WindowsGet-Commandalso finds the Microsoft Store's app execution alias,%LOCALAPPDATA%\Microsoft\WindowsApps\python.exe, which only prints how to install Python and exits 9009. On a machine where Python is installed throughpy(the Python install manager without thepythonalias), the boot runs, but<name>.summary.txtholds onlyand
py -3is never tried. The same happens with apythonolder than 3.12, which cannot runboot_trace.py.Change:
Test-Python: starts the candidate with-I -c "import sys; sys.exit(sys.version_info < (3, 12))"and accepts it on exit 0. It waits at most 15 s; a candidate that has not exited by then is ended with its child processes (taskkill /T /F) and passed over, so a Python that hangs cannot hold the script after the game has stopped.Resolve-Pythontriespython, thenpy -3, and takes the first that is found and passesTest-Python.-Pythonis still used as given.no usable Python 3.12+ found for tools/boot_trace.py (checked 'python' and 'py -3'; specify -Python to use another interpreter)..PARAMETER Pythonsays so.Nothing changes for a
pythonthat works (a python.org install, or Python from the Microsoft Store itself): it passes the check and is taken as before. The check costs one short Python start, after the game has stopped.New test,
tests/test_boot_ps1_python.py(standard library, Windows only): it takesTest-PythonandResolve-Pythonout ofboot.ps1and runs them in Windows PowerShell with stand-inpython.cmd/py.cmdon a barePATH:py -3;python(the interpreter running the test) is taken;pythonolder than 3.12 is passed over;pythonthat hangs is given up on after 15 s forpy -3, with no process left behind;-Pythonis used as given.With
main'sResolve-Pythonin place, four of the six fail (the alias, the old Python, the hang and the none cases); with the change all pass.Tested
On
f107ae044, Windows 11 Home 26300.9974, Windows PowerShell 5.1, Python 3.14.10 from the install manager (py;pythonis only the Store alias, exit 9009):python -I tests/test_boot_ps1_python.py: all 6 tests passed in 3 consecutive runs. Againstmain'sResolve-Python, 4 of the 6 tests fail.boot.ps1 -DigestOnly -Name firston an earlier boot of mine. Withmainthe summary is the Store message above; with this branch it is theboot_trace.pyreport (16 lines).python -I tests/test_boot_trace.py,python -I tests/test_docs_cli_flags.py: pass.python -I scripts/check_no_game_data.pyon both files: passes.GPUs tested: not relevant to this change; the end-to-end test was run on an AMD Radeon RX 9060 XT.
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule)🤖 Generated with Claude Code
Verified on Windows 11, on a second machine with a different Python setup.
Head
48defb9c0merged withmaind2a564b66(clean merge).py -3.13 -I tests/test_boot_ps1_python.py -v: 6 tests, all OK, in 18.3 s. The hang case accounts for most of that, which fits the 15 s wait.On a real PATH, no stand-ins. This machine has several interpreters. The first
pythononPATHis a 3.11.9 install. The WindowsAppspython.exe/py.exehere are the Python install manager's aliases, and the classicpylauncher is also present. I tookResolve-Python(plusTest-Pythonon the branch) out of eachboot.ps1, the way the test does, and ran it with the realPATH. Then I started what it picked:boot.ps1frompy -3py -3mainpythonmainpythonSo the "older than 3.12" case in the description is not hypothetical:
mainhandsboot_trace.pya 3.11 here, and the branch passes over it topy -3. It behaves the same under PowerShell 7. That matters because the test only drivespowershell.exe, and the$p.Handle/Start-Processpath works there too.One small note:
boot_trace.py --helpitself still starts on 3.11 here. I did not check which part of a real report needs 3.12+. I went by the script's stated requirement.Not checked: a full boot with the game (no game files here).
GPUs tested: n/a (script-only check).
AI-assisted: yes (Claude Code).
Independent interpreter selection with installed Python versions at
48defb9c0+27613ab6b. I ran the extractedResolve-PythonandTest-Pythonfunctions under PowerShell 7.4.21 on Linux. A thin wrapper dropped the Windows-only-WindowStyleargument and delegated to the realStart-Process; interpreter paths in the fixture included spaces.PATHis selected on both trees. A direct path to that interpreter also works on both.pystand-in, main selects 3.11.17 and the PR selectspy -3, which launches 3.14.10. With only 3.11.17 available the PR returns an empty selection.py -3. The stand-in verifies the-3argument before forwarding to the installed interpreter.The fixture covers selection and process arguments. Windows Store alias and process-tree timeout behavior are covered by the native Windows tests above. MEASURED. AI-assisted (Codex).
Thanks for the reviews and the runs on other setups.
KelboLive's three points. The new commit changes the test only; the probe in
boot.ps1is the same:OLDstand-in is gone. A new one runs Test-Python's own check withsys.version_infoset to a given version.3.11.9must be passed over forpy -3, and a new test takes3.12.0aspython.Resolve-Pythonreturns, the test asserts that no process with that tag is left.Start-Processredirect to a temporary file, for a case nobody has seen.Mutations,
python -I tests/test_boot_ps1_python.py(Windows 11 26300, Python 3.14.10):boot.ps1(3, 12)->(3, 11)test_a_python_older_than_3_12_is_passed_over(3, 12)->(3, 13)test_python_3_12_is_takentaskkill /T /F->$p.Kill()(thecmdonly, not its child)test_a_python_that_hangs_is_given_up_on: the hanging stand-in's child outlived Test-PythonKal0s-design's note on
boot_trace.py --helpunder 3.11. Fair: I had not shown thatboot_trace.pyitself fails on 3.11. The comment inTest-Pythonnow gives the requirement it actually follows: the repository needs 3.12+ (README.md).check_no_game_data.pyis clean on both files.AI-assisted (Claude Code).
Independent Python floor and timeout check on the updated head
29831328onmain60f7dcd9, using the actual resolver functions with PowerShell 7.4.21 on Linux. A stand-in that executes the version expression withsys.version_info=(3,11,9)selectedpy -3, and one reporting 3.12.0 selectedpython. Lowering only the predicate to 3.11 changed the first result back topython. The failing alias stand-in selectedpy -3, alias-only returned an empty selection, and the explicit path with spaces was preserved.A hanging local parent and child triggered the resolver’s cleanup request with the parent PID. The resolver selected
py -3after 15.034 s, and both fixture processes were inactive on return. The Linux harness kept the realStart-Process, omitted Windows-only-WindowStyle, and used a scoped .NET process-tree shim for the cleanup request. The native Windows cleanup tool is covered by the separate native runs.MEASURED with synthetic candidates. AI-assisted (Codex).
Merging. Head
298313282merges cleanly withmainc4ca57615and does not force a rebase of #2566. Ran main (c4ca57615) plus the PR myself: test_boot_ps1_python 7 green and 7 red with boot.ps1 reverted; line endings and stdout encoding green; ci_registration failed once under load, then 18 green on rerun with the PR (and green on main alone). Third-party check by merzleckeier on this head; read-only code review found nothing blocking. Merged by MoonEyes.AI-assisted (Claude Code).