game-abba: pass the gate's memory stops to every gate run (D3D12-GAME-ABBA-MEMORY-STOP) #3305

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "github-pr/3305:github-pr/3305"
git switch "github-pr/3305"
Open
leonida/mandy
OtavMacedo wants to merge 3 commits from github-pr/3305 into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'github-pr/3305:github-pr/3305'
git switch 'github-pr/3305'
OtavMacedo commented 2026-12-03 07:16:17 +00:00

Claimed in the coordination issue as: D3D12-GAME-ABBA-MEMORY-STOP (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7370240477)

What and why

scripts/game-gate.ps1 has three memory stops (-StopPrivateMB, -StopCommitLeftMB, -StopOverBudgetSeconds, docs/game_gate.md), but scripts/game-abba.ps1 could not pass them on, so every ABBA gate run took the gate's defaults.

On a PC with 16 GB of memory the default private-bytes cap is min(0.9 x commit limit, 1.25 x RAM), which is 20,382 MB here. That is under what the title holds in the world, so the measured runs fail their gate by memory_stop and the runner never reaches a comparison. The numbers are in the finding in #2570 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7369342822). For example, a Series X run went over the cap 16.7 s into the world (20,769 MB private), with 4,956 MB still free to commit. MEASURED, n=1 for Series X at the default cap. The cap is there for a reason (two Windows crashes at about 100 GB private), so the fix is to let the caller set it, not to change the default.

The change:

  • game-abba.ps1 takes -StopPrivateMB, -StopCommitLeftMB and -StopOverBudgetSeconds. Only the ones given go to every gate run of both arms (warm-up, discarded, measured, retries). A stop left out keeps the gate's own default: an unbound [int] would be 0, which means "off" to the gate.
  • abba.json records them as given in memory_stops ({} when none is given). Each run's run.json already has the values the gate used.
  • -DryRun prints them on each gate command.
  • In two-build mode, a checkout whose gate lacks a stop that was given (gates before 2026-12-01, aa75f1319) is refused before any run. Without this, that arm's first run would fail after the other arm's warm-up, with an error that does not say why.
  • docs/measuring_fps.md section 3 and the script's header describe all of the above.

Tested

  • tests/test_game_abba.py: 27 tests pass on Windows 11 with PowerShell 7. The stand-in gate now accepts the three stops and logs which ones were bound. Four new tests:
    • the stops given reach every gate call of both arms, including a negative -StopCommitLeftMB, and are recorded;
    • one stop given alone goes alone;
    • with no stop given, none is bound and memory_stops is {};
    • a gate without a given stop is refused before any run, with nothing deleted;
    • plus a -DryRun test of the printed plan.
  • Red and green with python -I scripts/red_green.py d3d12-game-abba-memory-stop --no-cargo. Base origin/main d9b618f10. The 4 new tests are red, then green; 23 tests pass on both sides.
  • tests/test_docs_*.py: all pass. python -I scripts/check_no_game_data.py: passes.
  • In game: an ABBA (LEONIDA_WINDOWS_BAR_MB=3072 against 0, Series X -Resolution 1080 -NoFrameGen, 300 s in the world, 4 pairs) is running with the runner from the first commit and -StopPrivateMB 27000 -StopOverBudgetSeconds 0. Both warm-ups PASS, with the stops on the gate's command line. The data for #3035 will follow there once the comparison is done. On this PC the measured runs fail their gate without -StopPrivateMB.

The change was reviewed by a separate read-only Claude Opus 5.5 agent before this pull request. It found nothing blocking. Fixed from its review: the older-gate refusal, test-comment wording (a negative -StopOverBudgetSeconds means off, not the default), a -DryRun test, the memory_stops-as-given note, and line wrapping.

GPUs tested: NVIDIA GeForce RTX 3070 8 GB desktop, driver 621.24, Windows 11, 16 GB RAM (profile M). Runner change; no GPU code.

AI-assisted: yes, Claude Code (Claude Opus 5.5); reviewer: separate read-only Claude Opus 5.5 agent

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a)

🤖 Generated with Claude Code

Claimed in the coordination issue as: D3D12-GAME-ABBA-MEMORY-STOP (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7370240477) ### What and why `scripts/game-gate.ps1` has three memory stops (`-StopPrivateMB`, `-StopCommitLeftMB`, `-StopOverBudgetSeconds`, docs/game_gate.md), but `scripts/game-abba.ps1` could not pass them on, so every ABBA gate run took the gate's defaults. On a PC with 16 GB of memory the default private-bytes cap is `min(0.9 x commit limit, 1.25 x RAM)`, which is 20,382 MB here. That is under what the title holds in the world, so the measured runs fail their gate by `memory_stop` and the runner never reaches a comparison. The numbers are in the finding in #2570 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7369342822). For example, a Series X run went over the cap 16.7 s into the world (20,769 MB private), with 4,956 MB still free to commit. MEASURED, n=1 for Series X at the default cap. The cap is there for a reason (two Windows crashes at about 100 GB private), so the fix is to let the caller set it, not to change the default. The change: - `game-abba.ps1` takes `-StopPrivateMB`, `-StopCommitLeftMB` and `-StopOverBudgetSeconds`. Only the ones given go to every gate run of both arms (warm-up, discarded, measured, retries). A stop left out keeps the gate's own default: an unbound `[int]` would be 0, which means "off" to the gate. - `abba.json` records them as given in `memory_stops` (`{}` when none is given). Each run's `run.json` already has the values the gate used. - `-DryRun` prints them on each gate command. - In two-build mode, a checkout whose gate lacks a stop that was given (gates before 2026-12-01, aa75f1319) is refused before any run. Without this, that arm's first run would fail after the other arm's warm-up, with an error that does not say why. - `docs/measuring_fps.md` section 3 and the script's header describe all of the above. ### Tested - `tests/test_game_abba.py`: 27 tests pass on Windows 11 with PowerShell 7. The stand-in gate now accepts the three stops and logs which ones were bound. Four new tests: - the stops given reach every gate call of both arms, including a negative `-StopCommitLeftMB`, and are recorded; - one stop given alone goes alone; - with no stop given, none is bound and `memory_stops` is `{}`; - a gate without a given stop is refused before any run, with nothing deleted; - plus a `-DryRun` test of the printed plan. - Red and green with `python -I scripts/red_green.py d3d12-game-abba-memory-stop --no-cargo`. Base origin/main `d9b618f10`. The 4 new tests are red, then green; 23 tests pass on both sides. - `tests/test_docs_*.py`: all pass. `python -I scripts/check_no_game_data.py`: passes. - In game: an ABBA (`LEONIDA_WINDOWS_BAR_MB=3072` against `0`, Series X `-Resolution 1080 -NoFrameGen`, 300 s in the world, 4 pairs) is running with the runner from the first commit and `-StopPrivateMB 27000 -StopOverBudgetSeconds 0`. Both warm-ups PASS, with the stops on the gate's command line. The data for #3035 will follow there once the comparison is done. On this PC the measured runs fail their gate without `-StopPrivateMB`. The change was reviewed by a separate read-only Claude Opus 5.5 agent before this pull request. It found nothing blocking. Fixed from its review: the older-gate refusal, test-comment wording (a negative `-StopOverBudgetSeconds` means off, not the default), a `-DryRun` test, the `memory_stops`-as-given note, and line wrapping. GPUs tested: NVIDIA GeForce RTX 3070 8 GB desktop, driver 621.24, Windows 11, 16 GB RAM (profile M). Runner change; no GPU code. AI-assisted: yes, Claude Code (Claude Opus 5.5); reviewer: separate read-only Claude Opus 5.5 agent ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
merzleckeier reviewed 2026-12-03 07:18:33 +00:00
merzleckeier left a comment
No description provided.
**[P2] Check the gate's declared parameters before clearing earlier results.** At `f1829698`, `scripts/game-abba.ps1:164–166` searches the entire script for `$StopOverBudgetSeconds`. A comment or local variable can match even when the gate has no such parameter. I reproduced this with the PR's synthetic gate fixture on `d9b618f1` plus `f1829698`. Arm B's gate lacked `-StopOverBudgetSeconds` and mentioned `$StopOverBudgetSeconds` once in a comment. I seeded a successful previous comparison, then reran in two-build mode with `-StopOverBudgetSeconds 0`. The preflight let the run through, the runner removed the previous comparison, arm A completed one warm-up, and arm B's binder then rejected the option. Reading `Parser.ParseFile(...).ParamBlock.Parameters` in the same preflight rejected the same fixture before either arm started and preserved the previous comparison byte-for-byte. The three existing forwarding, omission and missing-parameter tests also passed when I ran the synthetic fixture under Linux PowerShell 7.7.0. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 07:26:12 +00:00

VERIFY-3305 — 27 tests en verde (97 s), y el cambio es de la herramienta que mide A/B

scripts/game-abba.ps1    +23/−…     pasa los topes de memoria del portón a cada corrida
tests/test_game_abba.py  +67/−…     27 passed   (97 s)
docs/measuring_fps.md    +26/−…     documenta lo que cambia

Y el título es preciso: «pass the gate's memory stops to every gate run» — el gate es el A/B que compara main con una rama, y sus topes de memoria (los LEONIDA_* que limitan cuánta memoria puede usar el título) no se estaban pasando a todas las corridas.

Por qué eso invalida una medida, y no es un detalle: si la corrida A va con un tope y la B sin él, la diferencia de fps entre las dos puede ser el tope y no el cambio. Es el mismo error que un control mal puesto, en una herramienta cuyo único propósito es comparar.

Y docs/measuring_fps.md cambia con él, que es la señal de que el procedimiento documentado también cambia — bien: una herramienta de medida que cambia sin que cambie su documentación deja dos procedimientos en el repositorio.

Lo que verifiqué: los 27 tests del fichero, en su árbol.
Lo que no: una corrida A/B de verdad — necesita el juego, dos compilaciones y una hora; lo que el test cubre es que los parámetros llegan a las dos corridas, que es exactamente la mitad que se puede probar sin jugar.

Y una nota sobre el tiempo: 97 segundos para 27 tests — arranca procesos, como test_docs_cli_flags (34 s para 4) y test_red_green (86 s para 42). Los tres son de las herramientas, no del juego, y son los más lentos por test del repositorio: merece la pena saberlo antes de meterlos en un bucle de CI.

## VERIFY-3305 — 27 tests en verde (97 s), y el cambio es de la herramienta que mide A/B ``` scripts/game-abba.ps1 +23/−… pasa los topes de memoria del portón a cada corrida tests/test_game_abba.py +67/−… 27 passed (97 s) docs/measuring_fps.md +26/−… documenta lo que cambia ``` **Y el título es preciso**: **«pass the gate's memory stops to every gate run»** — **el *gate* es el A/B que compara `main` con una rama, y sus topes de memoria (**los `LEONIDA_*` que limitan cuánta memoria puede usar el título**) no se estaban pasando a todas las corridas.** **Por qué eso invalida una medida, y no es un detalle**: **si la corrida A va con un tope y la B sin él, la diferencia de fps entre las dos puede ser el tope y no el cambio.** **Es el mismo error que un control mal puesto, en una herramienta cuyo único propósito es comparar.** **Y `docs/measuring_fps.md` cambia con él**, **que es la señal de que el procedimiento documentado también cambia** — **bien: una herramienta de medida que cambia sin que cambie su documentación deja dos procedimientos en el repositorio.** **Lo que verifiqué**: **los 27 tests del fichero, en su árbol.** **Lo que no**: **una corrida A/B de verdad** — **necesita el juego, dos compilaciones y una hora; lo que el test cubre es que los parámetros llegan a las dos corridas, que es exactamente la mitad que se puede probar sin jugar.** **Y una nota sobre el tiempo**: **97 segundos para 27 tests** — **arranca procesos, como `test_docs_cli_flags` (34 s para 4) y `test_red_green` (86 s para 42).** **Los tres son de las herramientas, no del juego, y son los más lentos por test del repositorio: merece la pena saberlo antes de meterlos en un bucle de CI.**
lixonik commented 2026-12-03 07:40:57 +00:00

Windows native check (partial -- PowerShell 7 / pwsh tests skipped) on head f1829698c (merged cleanly via git merge --no-ff onto main d9b618f10).

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

  • python -I scripts/check_no_game_data.py -> PASS
  • python -I tests/test_game_abba.py -v -> Ran 4 tests in 0.003s / OK (skipped=23) (the 23 PowerShell subtests skipped on this host, so the red control did not exercise the changed PowerShell paths; reporting transparently rather than claiming a red -> green pass).

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

**Windows native check (partial -- PowerShell 7 / `pwsh` tests skipped)** on head `f1829698c` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Checks (Windows 10 x64, Python 3.12, Windows PowerShell 5.1) - `python -I scripts/check_no_game_data.py` -> **PASS** - `python -I tests/test_game_abba.py -v` -> **`Ran 4 tests in 0.003s` / `OK (skipped=23)`** (the 23 PowerShell subtests skipped on this host, so the `red` control did not exercise the changed PowerShell paths; reporting transparently rather than claiming a `red -> green` pass). AI-assisted: yes (Antigravity -- Gemini 4 Neon).
OtavMacedo commented 2026-12-03 08:20:13 +00:00

@merzleckeier thanks, you're right. Fixed in 7a36c1a87: the preflight now reads the gate's declared parameters with [System.Management.Automation.Language.Parser]::ParseFile(...).ParamBlock.Parameters, as you did, instead of searching the text.

The test's gate now lacks -StopOverBudgetSeconds, but names $StopOverBudgetSeconds in a comment and assigns it as a variable. It must be refused before any run, with runs and the earlier comparison.json unchanged byte for byte.

Red and green on this machine:

  • Previous head f1829698c: that test fails. The runner let it through, and the warm-up's gate refused the parameter (the gate did not start 01-warm-up-A).
  • This head: it passes.
  • Full file: 27 tests pass with PowerShell 7 on Windows 11 (95 s).
  • check_no_game_data.py passes.

On what the gate is (re the VERIFY note): scripts/game-gate.ps1 is one supervised game run with a PASS/FAIL verdict, not an A/B of main against a branch. Its memory stops are its own parameters (-StopPrivateMB, -StopCommitLeftMB, -StopOverBudgetSeconds), not LEONIDA_* settings. Before this PR both arms took the same defaults, so the arms did not differ. The problem was that on a 16 GB PC every measured run failed its gate on those defaults.

In-game use: the ABBA on #3035 (LEONIDA_WINDOWS_BAR_MB 3072 against 0) ran end to end with this runner (first-commit version) and -StopPrivateMB 27000 -StopOverBudgetSeconds 0: 12 gate runs, 1 left out and retried, verdict reached. Numbers on #3035.

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

@merzleckeier thanks, you're right. Fixed in `7a36c1a87`: the preflight now reads the gate's declared parameters with `[System.Management.Automation.Language.Parser]::ParseFile(...).ParamBlock.Parameters`, as you did, instead of searching the text. The test's gate now lacks `-StopOverBudgetSeconds`, but names `$StopOverBudgetSeconds` in a comment and assigns it as a variable. It must be refused before any run, with `runs` and the earlier `comparison.json` unchanged byte for byte. Red and green on this machine: - **Previous head `f1829698c`:** that test fails. The runner let it through, and the warm-up's gate refused the parameter (`the gate did not start 01-warm-up-A`). - **This head:** it passes. - **Full file:** 27 tests pass with PowerShell 7 on Windows 11 (95 s). - `check_no_game_data.py` passes. On what the gate is (re the VERIFY note): `scripts/game-gate.ps1` is one supervised game run with a PASS/FAIL verdict, not an A/B of `main` against a branch. Its memory stops are its own parameters (`-StopPrivateMB`, `-StopCommitLeftMB`, `-StopOverBudgetSeconds`), not `LEONIDA_*` settings. Before this PR both arms took the same defaults, so the arms did not differ. The problem was that on a 16 GB PC every measured run failed its gate on those defaults. In-game use: the ABBA on #3035 (`LEONIDA_WINDOWS_BAR_MB` 3072 against 0) ran end to end with this runner (first-commit version) and `-StopPrivateMB 27000 -StopOverBudgetSeconds 0`: 12 gate runs, 1 left out and retried, verdict reached. Numbers on #3035. AI-assisted (Claude Code, Claude Opus 5.5).
merzleckeier approved these changes 2026-12-03 08:31:36 +00:00
merzleckeier left a comment

The preflight issue from my earlier review is resolved in 7a36c1a8, tested on main d9b618f1. I ran five focused cases with synthetic gates and PowerShell 7.7.0 on Linux, enabling those cases in a local test copy. All five passed, including explicit zero and negative stop values, omitted stops, and the dry-run plan.

In the two-checkout control, only B lacked the parameter and its name appeared in a comment. With the new head, the script identified B before either gate ran and preserved the existing comparison byte for byte. Restoring only the previous f1829698 runner let A warm up, removed the previous comparison, and then failed when B rejected the argument. The one-checkout regression also went red on that older runner.

AI-assisted with OpenAI Codex.

The preflight issue from my earlier review is resolved in `7a36c1a8`, tested on `main` `d9b618f1`. I ran five focused cases with synthetic gates and PowerShell 7.7.0 on Linux, enabling those cases in a local test copy. All five passed, including explicit zero and negative stop values, omitted stops, and the dry-run plan. In the two-checkout control, only B lacked the parameter and its name appeared in a comment. With the new head, the script identified B before either gate ran and preserved the existing comparison byte for byte. Restoring only the previous `f1829698` runner let A warm up, removed the previous comparison, and then failed when B rejected the argument. The one-checkout regression also went red on that older runner. AI-assisted with OpenAI Codex.
Member

Review while Forgejo Actions is off (separate read-only judge, Claude Opus 5.5): the change reads right (memory stops passed only when given, each checkout's gate checked by its AST before any run, the parameters exist in scripts/game-gate.ps1), and the merge with main is clean. But every PowerShell test in tests/test_game_abba.py is skipped without PowerShell 7 (skipUnless(... PWSH ...)), so nothing was actually exercised here. It can be merged once someone runs python -I tests/test_game_abba.py with pwsh 7 on the merge with main and the new tests fail with main's script.

Review while Forgejo Actions is off (separate read-only judge, Claude Opus 5.5): the change reads right (memory stops passed only when given, each checkout's gate checked by its AST before any run, the parameters exist in `scripts/game-gate.ps1`), and the merge with main is clean. But every PowerShell test in `tests/test_game_abba.py` is skipped without PowerShell 7 (`skipUnless(... PWSH ...)`), so nothing was actually exercised here. It can be merged once someone runs `python -I tests/test_game_abba.py` with `pwsh` 7 on the merge with main and the new tests fail with main's script.
Sign in to join this conversation.
No description provided.