game-gate.ps1: a run folder with a space starts its launch script (GAME-GATE-LAUNCH-PATH-SPACE) #3258

Merged
LouisRiverstone merged 2 commits from upstream-pr/3258 into main 2026-12-03 15:39:11 +00:00
LouisRiverstone commented 2026-12-02 22:55:43 +00:00 (Migrated from github.com)

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.ps1 starts the run as Start-Process pwsh -ArgumentList @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $launch). Start-Process joins 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 -File only part of the path, and the run never started. The default run root is <Data>\gate-runs, so a data folder under C:\Users\John Doe\ is enough to hit it.

What changed

  • scripts/game-gate.ps1: the path is quoted (""$launch""), in a $launchArgs list so the line stays within 120 columns. $launch is Join-Path $RunDir 'launch.ps1': it always ends in launch.ps1, so no trailing backslash can escape the quote, and a Windows path holds no ". The & pwsh ... -DryRun line before it uses the call operator, which quotes by itself, so it is unaffected.
  • tests/test_game_gate_launch_path.py takes the gate's own argument list, points it at a stub launch.ps1 in a folder with spaces (...\John Doe\gate-runs\one run\), starts it the same way and checks the stub ran. It uses pwsh when 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)

  • Red/green by hand: with the .ps1 change 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.py still passes.
  • python -I scripts/check_no_game_data.py on both files: exit 0. The .ps1 stays CRLF and ASCII; the test is LF and ASCII.
  • pwsh is not installed on this machine, so the pwsh 7 run of the test happens wherever pwsh is present (the Windows CI runners have it).

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 -ArgumentList elements, that $launch cannot 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5616183580 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258). Originally posted by [LouisRiverstone](https://github.com/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.ps1` starts the run as `Start-Process pwsh -ArgumentList @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $launch)`. `Start-Process` joins 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 `-File` only part of the path, and the run never started. The default run root is `<Data>\gate-runs`, so a data folder under `C:\Users\John Doe\` is enough to hit it. ### What changed - `scripts/game-gate.ps1`: the path is quoted (`"`"$launch`""`), in a `$launchArgs` list so the line stays within 120 columns. `$launch` is `Join-Path $RunDir 'launch.ps1'`: it always ends in `launch.ps1`, so no trailing backslash can escape the quote, and a Windows path holds no `"`. The `& pwsh ... -DryRun` line before it uses the call operator, which quotes by itself, so it is unaffected. - `tests/test_game_gate_launch_path.py` takes the gate's own argument list, points it at a stub `launch.ps1` in a folder with spaces (`...\John Doe\gate-runs\one run\`), starts it the same way and checks the stub ran. It uses `pwsh` when 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) - Red/green by hand: with the `.ps1` change 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.py` still passes. - `python -I scripts/check_no_game_data.py` on both files: exit 0. The `.ps1` stays CRLF and ASCII; the test is LF and ASCII. - pwsh is not installed on this machine, so the pwsh 7 run of the test happens wherever pwsh is present (the Windows CI runners have it). 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 `-ArgumentList` elements, that `$launch` cannot 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.
merzleckeier commented 2026-12-02 22:57:49 +00:00 (Migrated from github.com)

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 only Start-Process back 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–34 the regex prefers the surviving $launchArgs assignment 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6160531675 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#pullrequestreview-6160531675). Originally posted by [merzleckeier](https://github.com/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 only `Start-Process` back 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–34` the regex prefers the surviving `$launchArgs` assignment 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.
ecox982745 commented 2026-12-02 23:05:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-02T23:05:57Z.


Native Windows PowerShell 7 end-to-end check of a5712c35 on main ef35d683. 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.

Gate script Runtime reached Recorded launcher exit
Main No 64
Main + #3258 Yes 23, the synthetic runtime’s status
#3258 with only the call site reverted, quoted variable left in place No 64

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361561464 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7361561464). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-12-02T23:05:57Z. --- Native Windows PowerShell 7 end-to-end check of `a5712c35` on main `ef35d683`. 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. | Gate script | Runtime reached | Recorded launcher exit | | --- | --- | --- | | Main | No | 64 | | Main + #3258 | Yes | 23, the synthetic runtime’s status | | #3258 with only the call site reverted, quoted variable left in place | No | 64 | 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.
fiestorra commented 2026-12-02 23:09:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:09:57Z.


VERIFY-3258 — Windows nativo: red then green y la rama fusiona limpia

Own commit a5712c357 — scripts/game-gate.ps1 (+5/−1), tests/test_game_gate_launch_path.py (+57)
Merge base 16243cd6e; git merge-tree against main ef35d683e → clean

Ran at the head

python -I tests/test_game_gate_launch_path.py     OK

Negative control (the commit's hunk in game-gate.ps1 reverted, the test kept):

FAIL: test_a_run_folder_with_a_space_starts_its_launch_script
Ran 1 test — FAILED (failures=1)

The test bites.

What the change is, and it is a real bug: Start-Process -ArgumentList joins 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 -File half 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.ps1 run against a real run folder — the test synthesises the launch script and asserts what was started.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361646271 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7361646271). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T23:09:57Z. --- ## VERIFY-3258 — Windows nativo: `red then green` y la rama fusiona limpia | | | |---|---| | Own commit | `a5712c357` — `scripts/game-gate.ps1` (+5/−1), `tests/test_game_gate_launch_path.py` (+57) | | Merge base | `16243cd6e`; `git merge-tree` against `main` `ef35d683e` → **clean** | **Ran at the head** ``` python -I tests/test_game_gate_launch_path.py OK ``` **Negative control** (the commit's hunk in `game-gate.ps1` reverted, the test kept): ``` FAIL: test_a_run_folder_with_a_space_starts_its_launch_script Ran 1 test — FAILED (failures=1) ``` **The test bites.** **What the change is, and it is a real bug**: `Start-Process -ArgumentList` **joins 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 `-File` **half 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.ps1` run against a real run folder — the test synthesises the launch script and asserts what was started. Written with an AI assistant.
LouisRiverstone commented 2026-12-03 02:10:31 +00:00 (Migrated from github.com)

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 $launchArgs assignment. Checked on Windows PowerShell 5.1:

  • fix as is: OK
  • your mutation (call back to the inline @(..., $launch), $launchArgs kept): FAILED
  • main's gate: FAILED

@ecox982745 thanks for the end-to-end run through the whole gate on pwsh 7.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7365167704 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7365167704). Originally posted by [LouisRiverstone](https://github.com/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 `$launchArgs` assignment. Checked on Windows PowerShell 5.1: - fix as is: OK - your mutation (call back to the inline `@(..., $launch)`, `$launchArgs` kept): FAILED - `main`'s gate: FAILED @ecox982745 thanks for the end-to-end run through the whole gate on pwsh 7.
OtavMacedo commented 2026-12-03 05:41:06 +00:00 (Migrated from github.com)

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

Machine NVIDIA GeForce RTX 3070 8 GB desktop, driver 621.24, Windows 11, 16 GB RAM (profile M), PowerShell 7.7.0
Base main 516c9eaab + this PR at d59f87a9e (merged locally, no conflict)
Run root the gate's default (<Data>\gate-runs), under a user folder whose name has a space

MEASURED

  • main's gate, real game: the run never started. launcher_exited with exit code 64 five seconds after started, verdict ERROR not_started (n=1).
  • With this PR: 5 of 5 real gate runs started the game and reached the world (Series X and Series S, 600 s targets), with the gate's own stop at the end. The verdicts that followed were about the runs themselves (memory stop, present gap), not the launch.
  • Red/green with the PR's test on this machine: python -I tests/test_game_gate_launch_path.py OK with the PR, and AssertionError: 64 != 0 with main's scripts/game-gate.ps1 put back. That is the same exit code the real run got.

AI-assisted: yes (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369001956 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7369001956). Originally posted by [OtavMacedo](https://github.com/OtavMacedo) on 2026-12-03T05:41:06Z. --- In-game confirmation with the real runtime, not a synthetic one (the earlier checks here used stubs). | | | |---|---| | Machine | NVIDIA GeForce RTX 3070 8 GB desktop, driver 621.24, Windows 11, 16 GB RAM (profile M), PowerShell 7.7.0 | | Base | `main` `516c9eaab` + this PR at `d59f87a9e` (merged locally, no conflict) | | Run root | the gate's default (`<Data>\gate-runs`), under a user folder whose name has a space | **MEASURED** - `main`'s gate, real game: the run never started. `launcher_exited` with exit code 64 five seconds after `started`, verdict `ERROR not_started` (n=1). - With this PR: 5 of 5 real gate runs started the game and reached the world (Series X and Series S, 600 s targets), with the gate's own stop at the end. The verdicts that followed were about the runs themselves (memory stop, present gap), not the launch. - Red/green with the PR's test on this machine: `python -I tests/test_game_gate_launch_path.py` OK with the PR, and `AssertionError: 64 != 0` with `main`'s `scripts/game-gate.ps1` put back. That is the same exit code the real run got. AI-assisted: yes (Claude Code, Claude Opus 5.5).
OtavMacedo commented 2026-12-03 05:41:22 +00:00 (Migrated from github.com)

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

  • Wrong: "With this PR: 5 of 5 real gate runs started the game and reached the world".
  • Right: 4 of 4 finished runs started the game and reached the world. A fifth run started its launch script (so the launch path is fine there as well) but was still warming pipelines when I posted. It had not reached the world yet, so it does not count.
  • Cause: I counted the run in progress with the finished ones.
  • Nothing else changes: the exit code 64 on main and the red/green stand as written.

AI-assisted: yes (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369006726 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7369006726). Originally posted by [OtavMacedo](https://github.com/OtavMacedo) on 2026-12-03T05:41:22Z. --- CORRECTION to my comment above (https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7369001956): - Wrong: "With this PR: 5 of 5 real gate runs started the game and reached the world". - Right: **4 of 4 finished runs** started the game and reached the world. A fifth run started its launch script (so the launch path is fine there as well) but was still warming pipelines when I posted. It had not reached the world yet, so it does not count. - Cause: I counted the run in progress with the finished ones. - Nothing else changes: the exit code 64 on `main` and the red/green stand as written. AI-assisted: yes (Claude Code, Claude Opus 5.5).
merzleckeier commented 2026-12-03 06:04:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T06:04:13Z.


Rechecked d59f87a9 merged onto d9b618f10. 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 -WindowStyle removed in scratch. The updated call passed. Reverting only Start-Process to the inline argument list while retaining $launchArgs failed with exit 64. This resolves the call-site coverage finding in my review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369421376 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7369421376). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T06:04:13Z. --- Rechecked `d59f87a9` merged onto `d9b618f10`. The exact new test ran and passed in the [native Windows CI log](https://github.com/ProjectLeonida/mandy/actions/runs/47017585921/job/143951345972). I also reran its argument extraction in PowerShell 7.7 on Linux with the OS gate and the synthetic child’s Windows-only `-WindowStyle` removed in scratch. The updated call passed. Reverting only `Start-Process` to the inline argument list while retaining `$launchArgs` failed with exit 64. This resolves the call-site coverage finding in my review.
lixonik commented 2026-12-03 06:31:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:31:21Z.


Windows native verification (red -> green) -- PASS on head d59f87a9e (merged cleanly via git merge --no-ff onto main d9b618f10).

Checks (Windows 10 x64, Python 3.12, PowerShell 5.1)

  • python -I scripts/check_no_game_data.py -> PASS
  • Green:
    • python -I tests/test_game_gate_launch_path.py -v -> Ran 1 test in 1.211s / OK
  • Red (reverted scripts/game-gate.ps1 to main d9b618f10, keeping the PR's tests):
    • tests/test_game_gate_launch_path.py -> Ran 1 test in 1.200s / FAILED (failures=1) (exit 1)

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369929472 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7369929472). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T06:31:21Z. --- **Windows native verification (`red -> green`) -- PASS** on head `d59f87a9e` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Checks (Windows 10 x64, Python 3.12, PowerShell 5.1) - `python -I scripts/check_no_game_data.py` -> **PASS** - **Green:** - `python -I tests/test_game_gate_launch_path.py -v` -> **Ran 1 test in 1.211s / OK** - **Red** (reverted `scripts/game-gate.ps1` to `main` `d9b618f10`, keeping the PR's tests): - `tests/test_game_gate_launch_path.py` -> **Ran 1 test in 1.200s / FAILED (failures=1)** (exit `1`) AI-assisted: yes (Antigravity -- Gemini 4 Neon).
LouisRiverstone commented 2026-12-03 11:52:04 +00:00 (Migrated from github.com)

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_started on main, 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7377283373 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3258#issuecomment-7377283373). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-03T11:52:04Z. --- Thanks @OtavMacedo for the run with the real game. Exit 64 and `not_started` on `main`, 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.
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!3258
No description provided.