tests: the quick-program GPU timeout case no longer races Python startup (TEST-GPU-TIMEOUT-QUICK-LOAD) #1427

Open
github-bot wants to merge 1 commit from github-bot/gh-1427 into main AGit
Owner

@⁠Anonymous78e on GitHub · 2026-11-25 00:01 UTC · original
Anonymous78e:test/gpu-timeout-quick-load → main · +7 −3 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-GPU-TIMEOUT-QUICK-LOAD (#14)

What and why

tests/test_gpu_test_timeout.py HungProgram.test_quick_program_is_unaffected runs a quick child, python -c "print('ok')", through run_gpu_tests.run_cmd and check.run under the class's LEONIDA_GPU_TEST_TIMEOUT=0.5. That limit is meant for the hang cases. On a loaded Windows host, starting a Python child alone can take longer than 0.5 s, so the quick program is killed and the test fails for the wrong reason:

AssertionError: Tuples differ: (1, 'timed out after 0.5 s: python.exe was killed (a GPU hang?); LEONIDA_GPU_TEST_TIMEOUT sets the limit') != (0, 'ok')

It passes alone. I first saw it in a full parallel run of tests/, and it is not one of the three in the parallel-load finding of the coordination issue (#1410 covers the timing.log one).

This case now runs under a 60 s limit. That is still a limit, and the test asserts check.gpu_test_timeout() is 60, so it keeps checking that a limit in force leaves a quick program alone. The hang cases keep 0.5 s, and test_translator_step_has_no_limit still checks that 0.5 is passed through.

Tested

Windows 11 Pro 26H2, CPython 3.13.15, 16 threads, with the CPU saturated by 64 busy processes, on main 6fe83805a:

test_quick_program_is_unaffected alone whole file
main 3 / 10 failed
this branch 0 / 20 failed 0 / 5 failed (8 tests each)

Unloaded, python -I tests/test_gpu_test_timeout.py runs 8 tests OK. scripts/check_no_game_data.py on the file: clean.

GPUs tested: n/a (no GPU involved; the hang is a sleeping Python child)

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

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: no translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo

**@⁠Anonymous78e** on GitHub · 2026-11-25 00:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1427) `Anonymous78e:test/gpu-timeout-quick-load` → `main` · +7 −3 · 1 files · 1 commits · open Claimed in the coordination issue as: TEST-GPU-TIMEOUT-QUICK-LOAD (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why `tests/test_gpu_test_timeout.py` `HungProgram.test_quick_program_is_unaffected` runs a quick child, `python -c "print('ok')"`, through `run_gpu_tests.run_cmd` and `check.run` under the class's `LEONIDA_GPU_TEST_TIMEOUT=0.5`. That limit is meant for the hang cases. On a loaded Windows host, starting a Python child alone can take longer than 0.5 s, so the quick program is killed and the test fails for the wrong reason: ``` AssertionError: Tuples differ: (1, 'timed out after 0.5 s: python.exe was killed (a GPU hang?); LEONIDA_GPU_TEST_TIMEOUT sets the limit') != (0, 'ok') ``` It passes alone. I first saw it in a full parallel run of `tests/`, and it is not one of the three in the parallel-load finding of the coordination issue (#1410 covers the `timing.log` one). This case now runs under a 60 s limit. That is still a limit, and the test asserts `check.gpu_test_timeout()` is 60, so it keeps checking that a limit in force leaves a quick program alone. The hang cases keep 0.5 s, and `test_translator_step_has_no_limit` still checks that 0.5 is passed through. ### Tested Windows 11 Pro 26H2, CPython 3.13.15, 16 threads, with the CPU saturated by 64 busy processes, on `main` 6fe83805a: | | `test_quick_program_is_unaffected` alone | whole file | |---|---|---| | `main` | **3 / 10 failed** | | | this branch | 0 / 20 failed | 0 / 5 failed (8 tests each) | Unloaded, `python -I tests/test_gpu_test_timeout.py` runs 8 tests OK. `scripts/check_no_game_data.py` on the file: clean. GPUs tested: n/a (no GPU involved; the hang is a sleeping Python child) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo
test_quick_program_is_unaffected ran `python -c "print('ok')"` under the
0.5 s limit the hang cases use. On a loaded Windows host starting the child
alone can take longer, so the quick program was killed and the test failed
for the wrong reason (3 of 10 runs with the CPU saturated). That one case now
runs under a 60 s limit, still a limit; the hang cases keep 0.5 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:51:03 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 10:37 UTC · original

Reviewed 7a6eb36: Ran python3 -I tests/test_gpu_test_timeout.py in the sandbox on main and on this
branch (8 tests, OK on both, no GPU needed) and reproduced the reported race: with 60 CPU spinners on
2 cores, main's quick-program case fails because the child is killed by the 0.5 s limit
((1, 'timed out after 0.5 s: ...') != (0, 'ok')), while this branch passes (60 s limit, 0.93 s
under the same load). No findings; the hang cases keep 0.5 s. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 10:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1427#issuecomment-7159940877) Reviewed 7a6eb36: Ran `python3 -I tests/test_gpu_test_timeout.py` in the sandbox on main and on this branch (8 tests, OK on both, no GPU needed) and reproduced the reported race: with 60 CPU spinners on 2 cores, main's quick-program case fails because the child is killed by the 0.5 s limit (`(1, 'timed out after 0.5 s: ...') != (0, 'ok')`), while this branch passes (60 s limit, 0.93 s under the same load). No findings; the hang cases keep 0.5 s. AI-assisted review. **Recommendation:** Merge
This pull request can be merged automatically.
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 '+refs/pull/1427/head:github-bot/gh-1427'
git switch 'github-bot/gh-1427'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1427'
git switch 'github-bot/gh-1427'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1427'
git switch 'github-bot/gh-1427'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1427'
git switch 'main'
git merge --squash 'github-bot/gh-1427'
git switch 'main'
git merge --ff-only 'github-bot/gh-1427'
git switch 'main'
git merge 'github-bot/gh-1427'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.