game-gate: retry a pre-world launch, and require driver control for the world #3419

Code

Clone this repository

Checkout

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

git fetch -u  "game-gate/crash-world-detection:KelboLive-game-gate/crash-world-detection"
git switch "KelboLive-game-gate/crash-world-detection"
Open
leonida/mandy
KelboLive wants to merge 1 commit from KelboLive/mandy:game-gate/crash-world-detection into main

This pull request can be merged automatically.

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request can be merged automatically.
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 'game-gate/crash-world-detection:KelboLive-game-gate/crash-world-detection'
git switch 'KelboLive-game-gate/crash-world-detection'
First-time contributor

What/why

Defects in the harness we use to measure the runtime, found while running A/Bs on the game. Update after upstream #3487: the parser-side half of item 1 landed in main, so this PR now keeps the physical half and the other three items.

  1. A stale crashes.log was attributed to every later run. The parser side is now main's (#3487: entries older than the run are skipped by their unix time header). This PR keeps the physical half: the copied crashes.log is emptied at run start, before launch, and its template path/size/SHA-256 are recorded in run.json (crash_log_template), so attribution does not depend on clocks at all.
  2. A launch that dies before the world wasted an A/B arm. No retry existed for a run that never presented a frame or reached a world.
  3. "The world" was draws >= 500 for two frame lines, which the menu and the opening cinematic satisfy; a menu run was reported as gameplay with world_s and an "in the world" fps.
  4. The driver did not know the intro sequence. Enter alone never advances it; the title needs a Space tap for the menu, then Space held for about 5 s.

Changes

  • tools/game_gate.py
    • times.world_source is gate_control (the driver's GATE CONTROL), draws (a driver run without control - world_at_s: null), or null; times.menu_s keeps the old draw threshold, named for what it is. The fps block anchors on menu_s and says basis: menu+60s when there is no control.
    • A gate-driver run that never logs GATE CONTROL ends ERROR world_not_reached instead of PASS on a cutscene.
    • A retry subcommand: bounded to a run with no world and no frame line that ended not_started/device_lost within 30 s, at most 2 attempts.
  • scripts/game-gate.ps1
    • The copied crashes.log is emptied at run start, before launch, and its template path/size/SHA-256 are recorded in run.json.
    • Display-awake preflight (SetThreadExecutionState, informational run.json fields; no power-plan change) held for the attempt loop.
    • One bounded retry; attempt 1 archived as <folder>-attempt1; a world-reaching run is never retried.
  • mods/gate_driver/driver.lua: Space only (0.4 s tap first, 5 s holds after), never Enter (it pauses gameplay); GATE CONTROL only after two 3 s W walks of 1-30 m with a <=60 m total; GATE MENU/GATE PRESS logged with the held time.

Red/green

  • A high-draw menu/opening log with the driver but no GATE CONTROL -> world_source: draws, menu_s set, basis: menu+60s, world_not_reached.
  • Against the previous driver, GATE PRESS 1 ... hold=5.0 fails the test that expects the 0.4 s menu tap.
  • On five saved runs, the two doomed startup runs would retry and the world-reaching ones would not.
  • The crash-log cases are covered by upstream's #3487 tests, which this branch keeps verbatim.

Tests

  • python -I tests/test_game_gate.py - 61 passed
  • python -I tests/test_game_gate_launch_path.py, tests/test_game_gate_start_quoting.py - pass
  • python -I scripts/check_no_game_data.py - exit 0; git diff --check - clean
  • One real gate run on this machine produced GATE CONTROL t=281.3 moved=5.50 probes=2 and PASS with no manual help.

Item: GAME-GATE-CRASH-WORLD, claimed in #3312 (comment 25074). Depends on: none.
AI-assisted: DeepSeek V4.1 Flash (OpenCode), with subagents; a separate read-only agent audited the gate logic.

## What/why Defects in the harness we use to measure the runtime, found while running A/Bs on the game. **Update after upstream #3487**: the parser-side half of item 1 landed in `main`, so this PR now keeps the physical half and the other three items. 1. **A stale `crashes.log` was attributed to every later run.** The parser side is now `main`'s (#3487: entries older than the run are skipped by their `unix time` header). This PR keeps the *physical* half: the copied `crashes.log` is emptied at run start, before launch, and its template path/size/SHA-256 are recorded in `run.json` (`crash_log_template`), so attribution does not depend on clocks at all. 2. **A launch that dies before the world wasted an A/B arm.** No retry existed for a run that never presented a frame or reached a world. 3. **"The world" was `draws >= 500` for two frame lines**, which the menu and the opening cinematic satisfy; a menu run was reported as gameplay with `world_s` and an "in the world" fps. 4. **The driver did not know the intro sequence.** Enter alone never advances it; the title needs a Space tap for the menu, then Space held for about 5 s. ## Changes - `tools/game_gate.py` - `times.world_source` is `gate_control` (the driver's `GATE CONTROL`), `draws` (a driver run without control - `world_at_s: null`), or `null`; `times.menu_s` keeps the old draw threshold, named for what it is. The fps block anchors on `menu_s` and says `basis: menu+60s` when there is no control. - A gate-driver run that never logs `GATE CONTROL` ends `ERROR world_not_reached` instead of PASS on a cutscene. - A `retry` subcommand: bounded to a run with no world and no frame line that ended `not_started`/`device_lost` within 30 s, at most 2 attempts. - `scripts/game-gate.ps1` - The copied `crashes.log` is emptied at run start, before launch, and its template path/size/SHA-256 are recorded in `run.json`. - Display-awake preflight (`SetThreadExecutionState`, informational `run.json` fields; no power-plan change) held for the attempt loop. - One bounded retry; attempt 1 archived as `<folder>-attempt1`; a world-reaching run is never retried. - `mods/gate_driver/driver.lua`: Space only (0.4 s tap first, 5 s holds after), never Enter (it pauses gameplay); `GATE CONTROL` only after two 3 s W walks of 1-30 m with a <=60 m total; `GATE MENU`/`GATE PRESS` logged with the held time. ## Red/green - A high-draw menu/opening log with the driver but no `GATE CONTROL` -> `world_source: draws`, `menu_s` set, `basis: menu+60s`, `world_not_reached`. - Against the previous driver, `GATE PRESS 1 ... hold=5.0` fails the test that expects the 0.4 s menu tap. - On five saved runs, the two doomed startup runs would retry and the world-reaching ones would not. - The crash-log cases are covered by upstream's #3487 tests, which this branch keeps verbatim. ## Tests - `python -I tests/test_game_gate.py` - **61 passed** - `python -I tests/test_game_gate_launch_path.py`, `tests/test_game_gate_start_quoting.py` - pass - `python -I scripts/check_no_game_data.py` - exit 0; `git diff --check` - clean - One real gate run on this machine produced `GATE CONTROL t=281.3 moved=5.50 probes=2` and `PASS` with no manual help. Item: `GAME-GATE-CRASH-WORLD`, claimed in #3312 (comment 25074). Depends on: none. AI-assisted: DeepSeek V4.1 Flash (OpenCode), with subagents; a separate read-only agent audited the gate logic.
KelboLive force-pushed game-gate/crash-world-detection from 0aa2912df2 to be09cbb813 2026-12-04 02:27:13 +00:00 Compare
KelboLive force-pushed game-gate/crash-world-detection from be09cbb813 to f523aedacf 2026-12-04 04:09:47 +00:00 Compare
KelboLive force-pushed game-gate/crash-world-detection from f523aedacf to 6050c113c8 2026-12-04 10:58:47 +00:00 Compare
KelboLive force-pushed game-gate/crash-world-detection from 6050c113c8 to a5b2ad023c 2026-12-04 12:25:24 +00:00 Compare
KelboLive force-pushed game-gate/crash-world-detection from a5b2ad023c to 7ac554c6ec 2026-12-04 13:37:47 +00:00 Compare
KelboLive force-pushed game-gate/crash-world-detection from 7ac554c6ec to 27fa893060 2026-12-04 15:10:59 +00:00 Compare
Author
First-time contributor

Rebased onto main 44c480a5f (head 27fa89306). Upstream's 8 commits touch only list.rs, which this branch does not. Re-ran: test_game_gate 61 OK, launch_path 1 OK, start_quoting 2 OK.

Rebased onto `main` `44c480a5f` (head `27fa89306`). Upstream's 8 commits touch only `list.rs`, which this branch does not. Re-ran: `test_game_gate` 61 OK, `launch_path` 1 OK, `start_quoting` 2 OK.
KelboLive force-pushed game-gate/crash-world-detection from 27fa893060 to 779cd3bc3a 2026-12-04 15:56:57 +00:00 Compare
Author
First-time contributor

Replayed onto main bba262b94 (head 779cd3bc3). No conflicts. test_game_gate 61 OK, launch_path 1 OK, start_quoting 2 OK.

Replayed onto `main` `bba262b94` (head `779cd3bc3`). No conflicts. `test_game_gate` 61 OK, `launch_path` 1 OK, `start_quoting` 2 OK.
KelboLive force-pushed game-gate/crash-world-detection from 779cd3bc3a to f2c1d86515 2026-12-04 16:15:45 +00:00 Compare
Author
First-time contributor

Replayed onto main e1be896b2 (head f2c1d8651). No conflicts. 61 + 1 + 2 gate tests pass.

Replayed onto `main` `e1be896b2` (head `f2c1d8651`). No conflicts. 61 + 1 + 2 gate tests pass.
KelboLive force-pushed game-gate/crash-world-detection from f2c1d86515 to 1ba2293c5a 2026-12-04 16:32:21 +00:00 Compare
Author
First-time contributor

Replayed onto main 00e245be5 (head 1ba2293c5). No conflicts. Gate tests pass (61; the synthetic 320 s run and the two gate-format tests).

Replayed onto `main` `00e245be5` (head `1ba2293c5`). No conflicts. Gate tests pass (61; the synthetic 320 s run and the two gate-format tests).
KelboLive force-pushed game-gate/crash-world-detection from 1ba2293c5a to d82e1aa3cf 2026-12-04 17:15:02 +00:00 Compare
Author
First-time contributor

Replayed onto main f22b9fa64 (head d82e1aa3c). No conflicts. Gate tests pass.

Replayed onto `main` `f22b9fa64` (head `d82e1aa3c`). No conflicts. Gate tests pass.
KelboLive force-pushed game-gate/crash-world-detection from d82e1aa3cf to 7f3868095d 2026-12-04 18:30:11 +00:00 Compare
KelboLive changed title from game-gate: attribute crash logs to their run, retry a pre-world launch, and require driver control for the world to game-gate: retry a pre-world launch, and require driver control for the world 2026-12-04 18:30:42 +00:00
Author
First-time contributor

Replayed onto main 6491bc1a1; head 7f3868095.

This one needed a real merge decision, not a replay. Upstream #3487 landed the parser-side stale-crash fix this branch also carried, in the same two files. Resolved in favour of upstream: its CRASH_HEADER/CRASH_SLACK_S/skipping-flag read_crashes is now used verbatim, our duplicate read_crashes and its duplicate test are gone, and our per-entry at_s assertion in the kept test was relaxed to the crash kind (upstream attributes kept entries at the log tail).

What stays unique and is what this PR is now: the bounded pre-world retry (retry subcommand + scripts/game-gate.ps1), driver-control world detection (GATE CONTROL -> world_source, menu_s, world_not_reached), the physical crash-log reset + template SHA in run.json (still useful as the second line of defence), and the Space-only driver. Title and body updated to say so.

61 gate tests, launch-path and start-quoting pass; no-game-data and diff clean.

Replayed onto `main` `6491bc1a1`; head **`7f3868095`**. **This one needed a real merge decision, not a replay.** Upstream #3487 landed the parser-side stale-crash fix this branch also carried, in the same two files. Resolved in **favour of upstream**: its `CRASH_HEADER`/`CRASH_SLACK_S`/`skipping`-flag `read_crashes` is now used verbatim, our duplicate `read_crashes` and its duplicate test are gone, and our per-entry `at_s` assertion in the kept test was relaxed to the crash kind (upstream attributes kept entries at the log tail). What stays unique and is what this PR is now: the **bounded pre-world retry** (`retry` subcommand + `scripts/game-gate.ps1`), **driver-control world detection** (`GATE CONTROL` -> `world_source`, `menu_s`, `world_not_reached`), the **physical** crash-log reset + template SHA in `run.json` (still useful as the second line of defence), and the **Space-only driver**. Title and body updated to say so. 61 gate tests, launch-path and start-quoting pass; no-game-data and diff clean.
KelboLive force-pushed game-gate/crash-world-detection from 7f3868095d to abd7fa6343 2026-12-04 18:44:03 +00:00 Compare
Author
First-time contributor

Replayed onto main 6b0498d37 (head abd7fa634). No conflicts; #3488 only touches scripts/ab_cpu.py. Gate suite OK.

Replayed onto `main` `6b0498d37` (head `abd7fa634`). No conflicts; #3488 only touches `scripts/ab_cpu.py`. Gate suite OK.
First-time contributor

Verification — Merge & Test Gate (Windows 11)

Tested PR head abd7fa6343 fast-forwarded cleanly onto main (6b0498d37):

  • python -m unittest tests.test_game_gate — PASS (61 ran: 56 passed, 5 skipped, 0 failed)
  • git diff --check origin/main — PASS
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md — PASS
  • python -I scripts/check_no_game_data.py — PASS

Clean fast-forward and all unit/repo checks pass. Ready for merge.

AI-assisted.

### Verification — Merge & Test Gate (Windows 11) Tested PR head `abd7fa6343` fast-forwarded cleanly onto `main` (`6b0498d37`): - `python -m unittest tests.test_game_gate` — **PASS** (`61` ran: `56` passed, `5` skipped, `0` failed) - `git diff --check origin/main` — PASS - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` — PASS - `python -I scripts/check_no_game_data.py` — PASS Clean fast-forward and all unit/repo checks pass. Ready for merge. AI-assisted.
Contributor

I repeated four generated captures on head abd7fa634. Each capture recorded PID 4242 as the tracked process, a target stop, and a clean exit from that PID.

Generated crash entry Verdict Crash count
No entry PASS 0
PID 4242 before the run PASS 0
PID 4243 during the run FAIL with device_lost 1
PID 4242 during the run FAIL with device_lost 1

The last two fixtures differ only in the PID printed in the crash header. The time filter works for earlier entries. In this case a crash attributed to another process still changes the outcome of the measured run. The parser entry point is read_crashes at tools/game_gate.py:233. Would matching the header PID to the recorded process make sense as a follow-up? PR #3419

I repeated four generated captures on head `abd7fa634`. Each capture recorded PID 4242 as the tracked process, a target stop, and a clean exit from that PID. | Generated crash entry | Verdict | Crash count | |---|---|---:| | No entry | `PASS` | 0 | | PID 4242 before the run | `PASS` | 0 | | PID 4243 during the run | `FAIL` with `device_lost` | 1 | | PID 4242 during the run | `FAIL` with `device_lost` | 1 | The last two fixtures differ only in the PID printed in the crash header. The time filter works for earlier entries. In this case a crash attributed to another process still changes the outcome of the measured run. The parser entry point is `read_crashes` at `tools/game_gate.py:233`. Would matching the header PID to the recorded process make sense as a follow-up? [PR #3419](https://git.leonida.now/leonida/mandy/pulls/3419)
KelboLive force-pushed game-gate/crash-world-detection from abd7fa6343 to 186830e581 2026-12-04 20:52:44 +00:00 Compare
Author
First-time contributor

Replayed onto main 0036195a7 (head 186830e58). No conflicts with the launcher batch; gate suite OK.

Replayed onto `main` `0036195a7` (head `186830e58`). No conflicts with the launcher batch; gate suite OK.
KelboLive force-pushed game-gate/crash-world-detection from 186830e581 to 6e113ad124 2026-12-04 23:20:11 +00:00 Compare
Author
First-time contributor

Replayed onto main f4b0404e9; head 6e113ad12. Conflict resolved with upstream #3483 (numeric telemetry archive), which also edits main() in tools/game_gate.py. Both features are kept: summary <dir> --archive and retry <dir> [within] [attempt]; the archive flag logic is upstream's verbatim, and tests/test_game_gate.py merged cleanly with both test sets. 65 gate tests, launch-path and quoting pass.

Replayed onto `main` `f4b0404e9`; head `6e113ad12`. **Conflict resolved with upstream #3483** (numeric telemetry archive), which also edits `main()` in `tools/game_gate.py`. Both features are kept: `summary <dir> --archive` and `retry <dir> [within] [attempt]`; the archive flag logic is upstream's verbatim, and `tests/test_game_gate.py` merged cleanly with both test sets. 65 gate tests, launch-path and quoting pass.
KelboLive force-pushed game-gate/crash-world-detection from 6e113ad124 to ba6355f953 2026-12-05 05:34:41 +00:00 Compare
Author
First-time contributor

Replayed onto main 93b9d90a2 (head ba6355f95) - the commit that moves the canonical address to clearfieldswimming.com. No conflicts with it. Gate suite passes.

Replayed onto `main` `93b9d90a2` (head `ba6355f95`) - the commit that moves the canonical address to `clearfieldswimming.com`. No conflicts with it. Gate suite passes.
KelboLive force-pushed game-gate/crash-world-detection from ba6355f953 to 80291f91b5 2026-12-05 08:44:17 +00:00 Compare
Author
First-time contributor

Replayed onto main c5355dd25 (head 80291f91b). No conflicts. Gate suite passes.

Replayed onto `main` `c5355dd25` (head `80291f91b`). No conflicts. Gate suite passes.
KelboLive force-pushed game-gate/crash-world-detection from 80291f91b5 to b29d3141bd 2026-12-05 08:53:00 +00:00 Compare
Author
First-time contributor

Replayed onto main e1b0248c1 (head b29d3141b). No conflicts. Gate suite passes.

Replayed onto `main` `e1b0248c1` (head `b29d3141b`). No conflicts. Gate suite passes.
KelboLive force-pushed game-gate/crash-world-detection from b29d3141bd to 8f89a5fcb4 2026-12-05 09:59:33 +00:00 Compare
Author
First-time contributor

Replayed onto main d99bb4d7a (head 8f89a5fcb). No conflicts. Gate suite passes.

Replayed onto `main` `d99bb4d7a` (head `8f89a5fcb`). No conflicts. Gate suite passes.
Sign in to join this conversation.
No description provided.