game-gate.ps1: a run folder with a space starts its launch script (GAME-GATE-LAUNCH-PATH-SPACE) #3258
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3258"
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 LouisRiverstone on 2026-12-02T22:55:43Z.
Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7361272204 (GAME-GATE-LAUNCH-PATH-SPACE)
What and why
scripts/game-gate.ps1starts the run asStart-Process pwsh -ArgumentList @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $launch).Start-Processjoins an argument list with single spaces and quotes none of its elements. The pwsh 7 documentation says so: values with spaces need escaped double quotes. So a run folder with a space in its path handed-Fileonly part of the path, and the run never started. The default run root is<Data>\gate-runs, so a data folder underC:\Users\John Doe\is enough to hit it.What changed
scripts/game-gate.ps1: the path is quoted (""$launch""), in a$launchArgslist so the line stays within 120 columns.$launchisJoin-Path $RunDir 'launch.ps1': it always ends inlaunch.ps1, so no trailing backslash can escape the quote, and a Windows path holds no". The& pwsh ... -DryRunline before it uses the call operator, which quotes by itself, so it is unaffected.tests/test_game_gate_launch_path.pytakes the gate's own argument list, points it at a stublaunch.ps1in a folder with spaces (...\John Doe\gate-runs\one run\), starts it the same way and checks the stub ran. It usespwshwhen installed and Windows PowerShell otherwise; both join the list the same way.Verification (Windows 11, Windows PowerShell 5.1, Python 3.11; no game files, no GPU needed)
.ps1change reverted, the new test fails (the shell exits with an error and the stub never runs). With it, the test passes.tests/test_game_gate.pystill passes.python -I scripts/check_no_game_data.pyon both files: exit 0. The.ps1stays CRLF and ASCII; the test is LF and ASCII.This touches lines far from #3253's and #3257's edits to the same file, so they merge in any order.
AI assistance
AI-assisted: written with Claude Code (Claude Opus 5.5). It was reviewed by a separate read-only reviewer agent (Claude Opus 5.5), which confirmed that no pwsh 7.x release quotes
-ArgumentListelements, that$launchcannot end in a backslash or hold a quote, and that the call-operator line and the redirect paths are unaffected. It found nothing blocking; I added the clear assertion it suggested to the test.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T22:57:49Z.
Review: COMMENTED
Reviewed
a5712c35. In a Linux PowerShell sandbox I ran the exact gate launch block with a harmless script in a directory with spaces. I omitted-WindowStyle, which is Windows-only. The patched call started the stub and returned 0. Changing onlyStart-Processback to the old inline argument list made it return 64 and the stub never ran.That same one-line mutation leaves the new test green. At
tests/test_game_gate_launch_path.py:31–34the regex prefers the surviving$launchArgsassignment even when the real call ignores it. Could the test exercise the actual call block, or derive the list from the expression passed to-ArgumentList? That would catch a regression at the call site while the correctly quoted variable still exists. Merges with #3253 and #3257 were clean.Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-02T23:05:57Z.
Native Windows PowerShell 7 end-to-end check of
a5712c35on mainef35d683. I ran the actual gate and launcher with an isolated synthetic runtime, mocked process discovery, and a run directory with spaces. In all three arms I held the summary parser constant at #3218, so I could check the exit code it received.This confirms the earlier call-site mutation finding on native Windows and verifies the fix through the full gate. No game files, saves or GPU use. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:09:57Z.
VERIFY-3258 — Windows nativo:
red then greeny la rama fusiona limpiaa5712c357—scripts/game-gate.ps1(+5/−1),tests/test_game_gate_launch_path.py(+57)16243cd6e;git merge-treeagainstmainef35d683e→ cleanRan at the head
Negative control (the commit's hunk in
game-gate.ps1reverted, the test kept):The test bites.
What the change is, and it is a real bug:
Start-Process -ArgumentListjoins its arguments with spaces and quotes none of them, so a run folder whose path contains a space — and the default is under-Data— handed-Filehalf a path. The fix quotes that one argument and leaves the rest alone, with the reasoning in the comment ("It ends in launch.ps1 and holds no quote") rather than a blind quote-everything.Why I like the shape of the test: it is a new file rather than another case bolted onto
test_game_gate.py, it drives the PATH through the gate instead of reimplementing the string surgery, and it fails on the exact line the pull request changes.What I could not test: a whole
game-gate.ps1run against a real run folder — the test synthesises the launch script and asserts what was started.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-03T02:10:31Z.
@merzleckeier good catch, done in
d59f87a9e. The test now takes exactly the expression the call passes to-ArgumentList(a list or a variable), plus the lines before the call that set the variables it names, instead of preferring the$launchArgsassignment. Checked on Windows PowerShell 5.1:@(..., $launch),$launchArgskept): FAILEDmain's gate: FAILED@ecox982745 thanks for the end-to-end run through the whole gate on pwsh 7.
Imported from ubiquitarianism/leonida. Originally posted by OtavMacedo on 2026-12-03T05:41:06Z.
In-game confirmation with the real runtime, not a synthetic one (the earlier checks here used stubs).
main516c9eaab+ this PR atd59f87a9e(merged locally, no conflict)<Data>\gate-runs), under a user folder whose name has a spaceMEASURED
main's gate, real game: the run never started.launcher_exitedwith exit code 64 five seconds afterstarted, verdictERROR not_started(n=1).python -I tests/test_game_gate_launch_path.pyOK with the PR, andAssertionError: 64 != 0withmain'sscripts/game-gate.ps1put back. That is the same exit code the real run got.AI-assisted: yes (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by OtavMacedo on 2026-12-03T05:41:22Z.
CORRECTION to my comment above (https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7369001956):
mainand the red/green stand as written.AI-assisted: yes (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T06:04:13Z.
Rechecked
d59f87a9merged ontod9b618f10. The exact new test ran and passed in the native Windows CI log. I also reran its argument extraction in PowerShell 7.7 on Linux with the OS gate and the synthetic child’s Windows-only-WindowStyleremoved in scratch. The updated call passed. Reverting onlyStart-Processto the inline argument list while retaining$launchArgsfailed with exit 64. This resolves the call-site coverage finding in my review.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:31:21Z.
Windows native verification (
red -> green) -- PASS on headd59f87a9e(merged cleanly viagit merge --no-ffontomaind9b618f10).Checks (Windows 10 x64, Python 3.12, PowerShell 5.1)
python -I scripts/check_no_game_data.py-> PASSpython -I tests/test_game_gate_launch_path.py -v-> Ran 1 test in 1.211s / OKscripts/game-gate.ps1tomaind9b618f10, keeping the PR's tests):tests/test_game_gate_launch_path.py-> Ran 1 test in 1.200s / FAILED (failures=1) (exit1)AI-assisted: yes (Antigravity -- Gemini 4 Neon).
Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-03T11:52:04Z.
Thanks @OtavMacedo for the run with the real game. Exit 64 and
not_startedonmain, and 4 of 4 finished runs reaching the world with this PR, under a user folder with a space: that is the case this fixes. Thanks also @merzleckeier and @lixonik for rechecking the new test on CI and natively.