gate: a memory stop ends a run before memory runs out (D3D12-GATE-MEMORY-STOP) #2812
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2812"
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 TheGeogeo on 2026-12-01T00:40:16Z.
Claimed in the coordination issue as: D3D12-GATE-MEMORY-STOP (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7296478431)
What and why
A memory pile-up has taken a PC's whole Windows down twice, not only the device (bug check 0x10E on a 3090). Testers stop their runs at 80 GB of private bytes or 60 s of full video memory. A fixed 80 GB cap never triggers on a PC whose commit limit is 40 GB. The gate now stops a run before memory runs out, with limits taken from the machine:
The supervisor of
scripts/game-gate.ps1already askstools/game_gate.py stateevery 5 s.statenow also answersmemory_stop, from the runtime's latest memory lines (#2810), so it works on any card. It stops when any of these holds:-StopPrivateMB(default: the lower of 90 % of this PC's commit limit and 1.25 times its physical memory: with a large page file the commit limit is far above what a PC survives, and two Windows crashes (0x10E) came at about 100 GB private on a PC with 64 GB of memory and a 175 GB limit);-StopCommitLeftMBleft to commit for 20 s (default: the larger of 128 MB and 0.25 % of the limit). On a PC with no page file, a normal run here left 267 MB at its lowest, so the floor is low and must hold for 20 s;-StopOverBudgetSeconds(60).0 or less turns a limit off (for the two memory limits, a negative value is how the script asks for the computed default).
The run then stops the same clean way as at the end of its time (title suspended, cache saved), with the reason
memory.The limits go into
run.json(memory_stop) and the summary (memory.stop_limits), and the gate's whole sentence (which limit, its value and the measured one) intostop.memory_why. The verdict is FAILmemory_stop: the run was on its way to running out.world_time_shortandworld_not_reachedare not added on top.At each 5 s check the order is: relaunched, world time reached, memory, STOP file, time limit. A run that reaches its world time at the same check as a limit stops as
targetand counts as a measurement; its memory peaks are in the summary anyway.startforwards the limits to the detached run.docs/game_gate.mddescribes all of it.Tested
On Windows 11 Pro 10.0, rebased on
main8422def75:tests/test_game_gate.py: 30 tests OK (PowerShell 7 present, so the script tests ran). The new ones fail onmain:startforwards them, andrun.jsongets them;Get-StopReasonis taken out of the script and run under PowerShell 7 with made-up polls; putting memory before the target, or the time limit before memory, fails the test).test_tool_stdout_encoding.pyandscripts/check_no_game_data.pyon the changed files are clean. The script parses in PowerShell 7.main8f41d7d01code, the driver mod from #2784,-StopPrivateMB 15000(a normal run reaches about 24 GB here).stop_requestedwith reasonmemoryandwhy: private bytes 18766 MB, over 15000 MB, then sent the close.memory_stop,stop_limits{15000, 128, 60}. The 128 MB is the default floor here: this PC's limit is 39.7 GB.GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140
AI-assisted: yes. Claude Code (Claude Fable 5.2 and Claude Opus 5.5); a separate Claude Opus 5.5 agent reviewed the diff before this push.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T00:42:39Z.
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head
0cd683949, mainb7a1be296. CPU only, no pwsh and no game here. This branch contains #2810's headf806537a8, so red is #2810 + this PR's tests rather than main.MEASURED
f806537a8+ only this PR'stests/test_game_gate.py): 3 failed, 23 passed. The failures are the three new tests:test_a_run_stopped_for_memory_fails_with_its_reason;test_the_memory_stop_asks_for_a_stop_past_each_limit;test_the_memory_stop_limits_reach_the_run_and_its_detached_start([int]$StopPrivateMB =not in the script).READ IN CODE
memory_alarm()reads the limits fromrun.json(memory_stop), and 0 turns a limit off.since_end(...) >= 20 sof consecutive low lines.over_budget_s.state()exposes the result asmemory_stop, for the script to act on.summary(), amemorystop addsmemory_stoptofails, and stopsworld_not_reachedorworld_time_shortfrom piling on. The verdict therefore names the real reason.d3d12\target\diag\leonida.exe, so that holds for gate runs. A non-diagnostics exe would never trigger the stop.ASSUMED
-StopPrivateMB/-StopCommitLeftMB/-StopOverBudgetSecondsreachingrun.json, the clean close) was not run here (no pwsh). Only the static test that checks the parameters ran. Your RTX 3080 run (stop at 79.7 s, 18,766 MB) is not reproduced.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-01T00:43:02Z.
Thanks, checked and agreed. With a large page file the commit limit is far above what a PC survives. Your two Windows crashes (0x10E) came at about 100 GB private, on 64 GB of memory with a 175 GB limit. 90 % of that limit is 158 GB, which is too late.
Fixed in
5323dfa69: the default-StopPrivateMBis now the lower of 90 % of the commit limit and 1.25 times the physical memory. That is 80 GB on that PC, the same as your wrapper, and 36 GB here. The video memory stop (over the budget for 60 s) was already on by default and stays so. The script test now checks the physical-memory bound, and the docs say why.test_game_gate.py26 OK.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T00:51:21Z.
Re-verified on the new head
5323dfa69(my comment above was on0cd683949). macOS 27.2.1, Apple M5, Python 3.12, maind920d850d. CPU only, no pwsh.MEASURED
f806537a8+ this head'stests/test_game_gate.py): 3 failed, 23 passed. The failures are the same three new tests.READ IN CODE (
0cd683949..5323dfa69:game-gate.ps1,game_gate.md, the test)-StopPrivateMBis now[math]::Min($commitLimitMB * 0.9, $physicalMB * 1.25), with$physicalMBfromWin32_ComputerSystem.TotalPhysicalMemory. On enlighted's PC (64 GB RAM, a 175 GB commit limit) that gives 80 GB instead of about 158 GB, so it stops runs before the ~100 GB where their two 0x10E crashes happened. The over-budget-VRAM criterion is unchanged and still on by default.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T01:21:22Z.
Verified on Windows with the control: the suite fails when
tools/game_gate.pyis put back tomain.Cherry-picked onto
maind920d850d, Python 3.13.14, no GPU and no game data:python -m pytest tests/test_game_gate.py -q with this pull request: 26 passed in 3.67 s with tools/game_gate.py from main: 4 failed, 22 passedSo the new cases are tied to the new code and not to fixtures the file already had. They add to the same suite that #2805, #2804 and #2810 touch, and all five together are consistent - I have now run every one of them.
#2813 applies on top of this one (its tip cherry-picks cleanly over it), so the merge order is #2812 then #2813.
What I could not test: the PowerShell side (
scripts/game-gate.ps1, 28 lines changed here). That path drives a real run folder, and this machine has the game but not the gate harness the reports describe - the Python parser and its summary are what the tests cover, and they are green.AI-assisted: yes - DeepSeek v4.1 (flash), applied and ran both arms on the machine above.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-01T02:14:35Z.
I ran the stock PowerShell supervisor with real
game_gate.pyand a synthetic launcher under Windows 11, PowerShell 7.6.9 and Python 3.13. Head5323dfa69merged cleanly withbf19719ab(tree8b471096e). The stock Python suite passed all 26 tests, including the runtime log contract test.The harness supplied synthetic CIM values and fed the launcher synthetic log rows. The following are the recorded limits in
run.jsonand the supervisor's resulting decisions.Each positive case produced one
stop_requestedevent with reasonmemoryand the parser's explanation.summary.jsonpreserved that explanation and flaggedmemory_stop. The fixture exercises configuration and stop-reason propagation. Closing a title window and stopping the real process are outside this check. No game or GPU work was started.AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T16:20:14Z.
Review: COMMENTED
Re-ran on today's
main(7f8bb903): the conflict is onlytests/test_game_gate.py— both the #2805Scripttest and this PR insert at the same spot — and keeping both gives 27 passed, so this is a one-line rebase. Theneeds rebaselabel is still correct, and #2810 (which the branch is stacked on) is already in main, so there is no duplicate work.The core path holds: limits are read from the machine and written to
run.json(scripts/game-gate.ps1:127-132,:149), the alarm is computed intools/game_gate.py:286-304and exposed asstate.memory_stop(:318), the supervisor stops with reasonmemorybefore target/timeout (:207) and closes cleanly (:214-222), and the verdict is FAILmemory_stopwithworld_not_reached/world_time_shortsuppressed (:431-433,:438,:440). Deletingand reason != "memory"makestest_a_run_stopped_for_memory_fails_with_its_reasonfail, so that guard is covered.Three things before merge:
5323dfa69: it still says the private cap defaults to "90 % of this PC's commit limit", but code and docs now use the lower of that and 1.25 × physical (scripts/game-gate.ps1:131,docs/game_gate.md:30). Update the body.>=→>attools/game_gate.py:298survives the suite. A 20 s case would close it (the 60 s VRAM boundary is covered at exactly 60).docs/game_gate.md:69callsmemory_why"the limit passed", but the code stores the full explanation string — say so.One question, not a blocker:
memoryis checked beforetarget(scripts/game-gate.ps1:207-209), so a run that reaches its world time in the same 5 s poll as a limit is reported FAILmemory_stoprather than PASS. If that is intended, it deserves a sentence; if not, check the target first.Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-02T03:44:41Z.
Rebased on
main8422def75(#2810 is inmainnow, so its commit dropped out) and changed after @KelboLive's review (head01203fb3b):>=changed to>the test fails.docs/game_gate.mdsaysmemory_whyis the gate's whole sentence, with the limit and the measured value.Get-StopReason, which the test takes out of the script and runs under PowerShell 7 with made-up polls. Putting memory before the target, or the time limit before memory, fails it. The docs give the order.Also from a second review: a negative
-StopOverBudgetSecondsstopped the run at the first video line. Every limit is now off at 0 or less. For the two memory limits, -1 stays the script's way to ask for the computed default. There is also a row exactly at the private limit.tests/test_game_gate.py: 30 OK on Windows 11 with PowerShell 7.AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5; a separate Claude Opus 5.5 agent reviewed the diff before this push).
Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T09:01:11Z.
VERIFY-2812 — Linux, Fedora 45, Python 3.15.2, no PowerShell 7 (no pwsh), no GPU device, no game files
Verdict: PASS. The change is a real, root-cause addition to the frame-time gate: a memory stop that ends a run before memory runs out, with limits taken from the machine rather than a fixed cap, wired from the PowerShell supervisor through
run.jsonto the Python parser and into the verdict and summary. The three new tests that exercise the Python side and the script's text go red→green (they fail on the merge base with exactly the assertions the feature is about and pass on the head); the fourth new test, the PowerShellGet-StopReasonordering test, fails on red on its first text assertion and is skipped (ignored) on green because pwsh is not installed here, so it is tied to the new code but I could not run it; and nothing regressed: 25 tests pass on both sides, 0 regressions. The one thing I could not run is the PowerShell execution itself (no pwsh here), so the supervisor'sGet-StopReasonordering and theWin32_*default computation were verified by reading the script and by simulating the function's logic, not by running it; the in-game measurement in the description is the author's own and I could only check it for internal consistency.head
01203fb3bf08("gate: a negative memory limit is off, and the poll's order tested in full (review)"), branchd3d12-gate-memory-stop; baseorigin/main=a917c54d6aff(fetched by the red/green verifier during this review; the task's base was0ae5a266), merge base8422def759cda12c89f918438eeb8d53dd5972a6(#2810is inmain, so the branch is no longer stacked on it). Four files, +211/−15:tools/game_gate.py(+45/−2),scripts/game-gate.ps1(+44/−12),tests/test_game_gate.py(+124),docs/game_gate.md(+13/−4).mergeable_stateisclean.1. What it changes
The gate's supervisor (
scripts/game-gate.ps1) already pollstools/game_gate.py stateevery 5 s and stops the run forrelaunched, the world time, aSTOPfile, or the time limit. The PR adds a fifth stop reason,memory, and a machine-derived set of limits:scripts/game-gate.ps1:36-38,:154-159): three new parameters,-StopPrivateMB,-StopCommitLeftMB,-StopOverBudgetSeconds.-StopPrivateMBdefaults to[math]::Min($commitLimitMB * 0.9, $physicalMB * 1.25)(:158), where$commitLimitMBis the PC's commit limit fromWin32_OperatingSystem.TotalVirtualMemorySize / 1KB(:154) and$physicalMBisWin32_ComputerSystem.TotalPhysicalMemory / 1MB(:155).-StopCommitLeftMBdefaults to[math]::Max(128, $commitLimitMB * 0.0025)(:159).-StopOverBudgetSecondsdefaults to 60 (:38). A negative-StopPrivateMB/-StopCommitLeftMBasks for the computed default (if (... -lt 0),:158-159); 0 turns a limit off (the Python side reads> 0,tools/game_gate.py:295,:297,:302). The limits are written intorun.jsonasmemory_stop = { private_max_mb, commit_left_min_mb, over_budget_s }(:175), andstartforwards the three parameters to the detachedrun(:108).tools/game_gate.py:276-304):since_end(rows, low)returns the seconds the last rows have all beenlow(from the first of them to the last row, 0.0 if the last is not).memory_alarm(run)readsrun.meta["memory_stop"](an older gate'srun.jsonhas none →{}→ all limits off) and answers, in order: the last memory line's private bytes overprivate_max_mb→"private bytes {p} MB, over {m} MB"; the PC having undercommit_left_min_mbMB left to commit forCOMMIT_LOW_S= 20 s (:35) →"the PC had under {m} MB left to commit for {s:.0f} s"; the video line having been over its budget (v[2] > v[1]) forover_budget_s→"video memory over its budget for {s:.0f} s".state()exposes it asstate.memory_stop(:318).scripts/game-gate.ps1:216-220,:242-244): a newGet-StopReasonfunction decides the stop in one place:relaunched→ world time reached (target) →memory→STOPfile → time limit. The world time is deliberately checked before memory, so a run that reaches-WorldSecondsin the same poll as a limit stops astarget(a measurement); the memorywhystring is captured into$memoryWhy(:244) and written into thestop_requestedevent (:249,:257).tools/game_gate.py:431-441,:476,:490): amemorystop addsfailsmemory_stop(FAIL) and suppressesworld_not_reached(:438) andworld_time_short(:440) — the stop is why the run was short.memory.stop_limitsholds the limits fromrun.json(:476), andstop.memory_whyholds the gate's whole sentence (:490).docs/game_gate.md): the ending of the run, the memory stop, the five check order, thestop.memory_whyfield, and thememory_stopverdict reason.2. The claims, checked one by one
scripts/game-gate.ps1already askstools/game_gate.py stateevery 5 s" — true; the poll loop isStart-Sleep -Seconds 5then& $Python -I $tool state $RunDir(scripts/game-gate.ps1:238,:242), unchanged by the PR.statenow also answersmemory_stop" —state()adds"memory_stop": memory_alarm(run)(tools/game_gate.py:318). Verified bytest_the_memory_stop_asks_for_a_stop_past_each_limit, which readsstate()["memory_stop"]for each limit and gets the exact sentence.31000 > 30000→ the private sentence; commit left150 < 200for 25 s → the commit sentence; video9000 > 8000for 60 s → the video sentence. The private check uses the last memory line only (run.memory[-1][1],:294), as the author says; the commit floor needs consecutive low lines (since_endoverm[4] < left_min); the video over-budget is consecutive too (since_endoverv[2] > v[1]).:158is exactly that. Internal consistency of the example: 64 GB RAM with a 175 GB limit givesmin(175·1024·0.9, 64·1024·1.25)=min(161280, 81920)= 81,920 MB = 80 GB, below the ~100 GB where the author says two 0x10E crashes came; the reviewerecox982745measured both branches on Windows (81,920 MB and 36,000 MB with a 40,000 MB commit limit), which matches the formula. I could not run theWin32_*queries (no Windows), so I checked the arithmetic only.:159is that. On the author's 39.7 GB-limit PC,max(128, 39700·0.0025)=max(128, 99.25)= 128, matching thestop_limits {15000, 128, 60}in the description.-StopOverBudgetSeconds(60)" —over_s > 0 and run.videoandsince_end(...) >= over_s(:300-303); the 60 s boundary is tested at exactly 60 (13 over-budget lines 5 s apart) and the "not long enough" at 12 lines.> 0(:295,:297,:302), and the test checks each limit set to 0 and to −1 produces no stop. In the script,-StopPrivateMB -1/-StopCommitLeftMB -1compute the default (:158-159);-StopOverBudgetSecondsis never computed (default 60, a negative turns it off). Consistent with the description.memory" — the stop path is the same for every reason:Add-Event 'stop_requested',[GateWindow]::Close, wait, kill after 60 s (:247-254). Amemorystop does not take a different branch. Thememory_whyis carried in the same event (:249).run.json(memory_stop) and the summary (memory.stop_limits), and the gate's whole sentence ... intostop.memory_why" —run.json:175,memory.stop_limitstools/game_gate.py:476,stop.memory_why:490.test_a_run_stopped_for_memory_fails_with_its_reasonassertsmemory.stop_limits == limitsandstop.memory_why == "private bytes 31000 MB, over 30000 MB".memory_stop...world_time_shortandworld_not_reachedare not added on top" —tools/game_gate.py:431-433appendsmemory_stoptofails;:438and:440gateworld_not_reached/world_time_shortonreason != "memory".test_a_run_stopped_for_memory_fails_with_its_reasonassertsresult == "FAIL"andreasons == ["memory_stop"], and a second case stops before the world is reached (worldNone) and still gets["memory_stop"]with noworld_not_reached. On the merge base that first case reports['world_time_short']instead (the old code did not knowmemory), which is exactly the red failure.Get-StopReason(:216-220) is that order.test_a_poll_stops_for_the_target_before_the_memory_stoptakes the function out of the script and runs it under PowerShell 7 with eight made-up polls; I could not run it (no pwsh), so I simulated the same eight cases against the function as written and all eight match the expected output (e.g.world_s 300+ memory alarm →target;world_s 295+ alarm →memory; alarm +STOPfile →memory; alarm + 45 min →memory; no alarm + 45 min →timeout; no alarm + noSTOP+ 20 min → nothing →none).startforwards the limits to the detached run" —:108adds'-StopPrivateMB'; $StopPrivateMB; '-StopCommitLeftMB'; $StopCommitLeftMB; '-StopOverBudgetSeconds'; $StopOverBudgetSecondsto theruncommand line;test_the_memory_stop_limits_reach_the_run_and_its_detached_startasserts each'-{name}'; ${name}is present and thememory_stopobject is inrun.json.memoryandwhy: private bytes 18766 MB, over 15000 MB... Summary: FAILmemory_stop,stop_limits{15000, 128, 60}"): I could not reproduce them (no Windows, no GPU, no game), and the author gives no log. I checked internal consistency:18766 > 15000, thewhystring is exactlyf"private bytes {private} MB, over {private_max} MB"(tools/game_gate.py:296), andstop_limitsis{15000, 128, 60}where 128 is the computed floor on a 39.7 GB-limit PC and 60 the default over-budget seconds. The "game ended by itself 3 s later with exit 0, the title suspended and the cache saved" is consistent with the code path (the same[GateWindow]::Close/wait as any stop;cache_savedcomes from thetitle suspended; ending the titleline).3. The new tests and what they do
Four tests are added. Three exercise Python/script text and go red→green; the fourth needs PowerShell 7 and was skipped here (see §5).
test_the_memory_stop_asks_for_a_stop_past_each_limit(tests/test_game_gate.py:244-281) builds synthetic runs (Fakewith memory/video lines every 5 s from 70 s) and asserts each limit produces exactly its sentence, that a row exactly at the private limit (30000 over 30000) does not stop (the>boundary), that the commit floor stops at exactly 20 s (5 low lines, the boundary KelboLive asked to be exercised) and not at 15 s, that the video budget stops at exactly 60 s and not 12 lines, and that 0 / nomemory_stop/ −1 each turn a limit off. On the merge base this fails asKeyError: 'memory_stop'—state()had no such key.test_a_run_stopped_for_memory_fails_with_its_reason(:283-305) stops a synthetic run withreason="memory"and asserts FAIL,reasons == ["memory_stop"],stop.memory_why,memory.stop_limits, and a second run that never reached the world still reports onlymemory_stop. On the merge base it fails withAssertionError: Lists differ: ['world_time_short'] != ['memory_stop'].test_the_memory_stop_limits_reach_the_run_and_its_detached_start(:383-393) is a static text check ofscripts/game-gate.ps1: the three parameters, their forwarding instart, thememory_stopobject,TotalPhysicalMemory, and[math]::Min($commitLimitMB * 0.9, $physicalMB * 1.25). On the merge base it fails with'[int]$StopPrivateMB = ' not found.test_a_poll_stops_for_the_target_before_the_memory_stop(:395-447) first asserts the script text ($stopReason = Get-StopReason -Poll $state,-TargetSeconds $WorldSeconds -LimitMinutes $MaxMinutes, exactly two$stopReason =assignments, the$memoryWhyline), then extractsGet-StopReasonfrom the script and runs it under PowerShell 7 with the eight polls. On the merge base it fails on the first text assertion (noGet-StopReasonin the script). On the head, with no pwsh, the text assertions pass and the PowerShell run is skipped.4. What the tests do here (measured)
The repository's own red/green verifier,
python3 -I scripts/red_green.py 2812 --work-dir /home/shangli/oc-workspace/gta6/rg-2812:8422def7+ only the PR's test hunks, onmaina917c54dtests/test_game_gate.pytest_the_memory_stop_asks_for_a_stop_past_each_limit(KeyErrormemory_stop),test_a_run_stopped_for_memory_fails_with_its_reason(['world_time_short'] != ['memory_stop']),test_the_memory_stop_limits_reach_the_run_and_its_detached_start([int]$StopPrivateMB =not found),test_a_poll_stops_for_the_target_before_the_memory_stop(Get-StopReasonnot in the script)01203fb3btests/test_game_gate.pyignoredhere — no PowerShell)The tool's verdict: "red then green" — 3 red→green, 25 pass on both, 0 regressions, 0 fail on both. I rebuilt the red side by hand (merge base + the PR's test hunks) to confirm the four red failures are the feature's own assertions and not incidental: the messages are exactly the ones in the table. I also ran the full file on the head directly:
python3 -I tests/test_game_gate.py→ 30 tests, OK (2 skipped — the twopwshtests). Thedocshygiene suite (python3 -I -m unittest discover -s tests -p "test_docs_*.py") → 57 tests, OK on the head;tests/test_tool_stdout_encoding.py→ 4 OK;python3 -I scripts/check_no_game_data.py <the 4 changed files>→ clean (exit 0);python3 -m compileall -q tools tests→ clean. The same checks pass on the merge base and on the PR head.5. Anything wrong
Nothing that changes the verdict. Two observations, neither a defect of the change:
Get-StopReasontest and theWin32_*default computation are the only untested (here) parts of the script, and they are the ones that decide a real run's stop. The test is written so it runs under pwsh; on this machine it skipped. I verified the eight-poll ordering by simulating the function, and the default arithmetic by hand (min(0.9·limit, 1.25·physical),max(128, 0.0025·limit)), andecox982745's Windows comment measured both branches of the default and the ordering with a synthetic harness — but I did not execute the script.tools/game_gate.py:294), as the author states and the test encodes; a run that peaked over the limit and then freed memory would not stop. This is a deliberate design choice (the stop is for "before it runs out"), not a bug, and it is what the description says.6. What I did not check
pwshis not installed here, soGet-StopReasonwas never actually run, and theWin32_OperatingSystem/Win32_ComputerSystem/Win32_VideoControllerCIM queries and the-StopPrivateMB/-StopCommitLeftMBcomputed defaults were not measured on this machine. The author andecox982745ran them on Windows; I checked the formula and the ordering by reading and simulation only.memorystop before a crash, nor the author's in-game numbers (18,766 MB private at 79.7 s,stop_limits {15000, 128, 60}, FAILmemory_stop) — those are the author's own measurement on an RTX 3080 and I only checked them for internal consistency.enlight3d's account, not something I can reproduce.state/summarytimings (the alarm runs per 5 s poll;since_endis linear in the memory lines) — I did not measure the cost ofmemory_alarmon a long run; it is not a hot path.ecox982745's synthetic-harness table andfiestorra'spytestrun on Windows are their measurements, quoted only as supporting evidence; I ran the repository's own tests and the red/green verifier, which is what I can stand behind.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T09:49:11Z.
Merging. Head
01203fb3bmerges cleanly withmaina917c54d6and does not force a rebase of #2566. Checked on head01203fb3b: all 5 CI checks green, third-party red/green PASS by imShangLi on this exact head, item D3D12-GATE-MEMORY-STOP claimed in #2570, reviewer question answered and fixed, no CI/security/rendering paths, and a conflict-free merge against maina917c54d6. #2813 is stacked on it and follows. Merged by MoonEyes.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T10:12:58Z.
RUN (independent run on Windows, #2812 head
01203fb3b, merged locally intomaina917c54d6withgit merge --no-ff, no conflicts. It was merged intomain(80910637f) while this ran, at the head checked here. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)The game was not started for this run: everything below is tests, a parse check and reading. No cargo (the change is Python, PowerShell and docs).
Commands, unittest files run with
python -Ias the CI's standalone loop runs them. PowerShell 7 is present, so the script tests ran (none skipped):python -I tests/test_game_gate.py -v: main 26 OK; merge 30 OK.main'stools/game_gate.pyandscripts/game-gate.ps1with this pull request'stests/test_game_gate.py: 30 run, 3 failures and 1 error, exactly the 4 new tests, each for the missing feature:test_the_memory_stop_asks_for_a_stop_past_each_limit(KeyErrormemory_stop:statehas no such field),test_a_run_stopped_for_memory_fails_with_its_reason(reasons['world_time_short']instead of['memory_stop']),test_a_poll_stops_for_the_target_before_the_memory_stopandtest_the_memory_stop_limits_reach_the_run_and_its_detached_start(the script has noGet-StopReasonand no-StopPrivateMB). The other 26 pass.scripts/run_standalone_tests.py -j 4(the 13tests/test_docs_*.py,test_i18n_index.py,test_design_contract_rows.py,test_ci_registration.py,test_tool_stdout_encoding.py,test_game_gate.py,test_d3d12_ab_compare.py,test_red_green.py): main 20 files, 0 failed; merge 20 files, 0 failed.[System.Management.Automation.Language.Parser]::ParseFileonscripts/game-gate.ps1: 0 errors.-StopPrivateMB81,524 (1.25 x memory, below 90 % of the limit) and-StopCommitLeftMB467.Mutations of the merge, each run with
tests/test_game_gate.py(30 tests), the file restored after each:private > private_maxto>=: killed (test_the_memory_stop_asks_for_a_stop_past_each_limit, the row exactly at the limit).low >= COMMIT_LOW_Sto>: killed (same test, the floor at exactly 20 s).Get-StopReasonwith the memory stop before the target: killed (test_a_poll_stops_for_the_target_before_the_memory_stop).world_time_shortno longer skipped on a memory stop: killed (test_a_run_stopped_for_memory_fails_with_its_reason).startno longer forwards-StopPrivateMB: killed (test_the_memory_stop_limits_reach_the_run_and_its_detached_start).$commitLimitMB * 0.9to0.95: killed by the same test, which reads the formula as text; no test computes the defaults.v[2] > v[1]to>=: survives (30 OK). A card exactly at its budget is not pinned either way. Minor.scripts/red_green.py --mutatefrom #2817 on this pull request (--no-fetch --no-cargo): red then green, 4 tests; 26 pass on both; 8 hunks oftools/game_gate.pyundone one at a time, 8 caught. It does not mutate PowerShell; the script's hunks are the ones mutated by hand above.Read:
mainoutside the memory stop:mainlooked at the STOP file before the world time, this head looks at the world time first (relaunched, target, memory, STOP file, time limit). A run that reaches its world time in the poll where a STOP file appears now ends astarget, notstop_file. The description gives this order, so it reads as intended. ThePOLLStable pins target before memory, memory before the STOP file and memory before the time limit, but has no case for target and STOP file in the same poll.memory_alarmreads the limits fromrun.json. A missingmemory_stopblock, 0 or null turns each limit off, so a run folder written before this change never asks for a stop (the test's case with no limits covers it).Not covered here: the game (no run started, so no real memory line, and no real close, suspend and cache save after a memory stop), the supervisor loop as a whole and the detached
start(only checked as text and through the extractedGet-StopReason), Linux and macOS.Verdict: PASS.
Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40, Python 3.13.12 (the CI uses 3.12), PowerShell 7.6.10.