SEMANTIC-PROCESS-TIMEOUT: bound hung test subprocesses #468

Manually merged
github merged 2 commits from gh-pr/468/head into gh-pr/468/base 2026-11-26 09:02:15 +00:00
Owner

@⁠csmith105 on GitHub · 2026-11-24 05:53 UTC · original
csmith105:codex/semantic-process-timeout → main · +87 −6 · 2 files · 2 commits · merged 2026-11-24 06:32 UTC

Claimed in the coordination issue as: SEMANTIC-PROCESS-TIMEOUT

What and why

A hanging test subprocess can block the semantic regression runner indefinitely. Add an optional positive finite --timeout SECONDS (at most 86,400 seconds / 24 hours): it limits each module in parallel mode, or the entire existing unittest-discovery subprocess with -j 1. Timeouts return failure, retain partial output, and allow other parallel modules to finish. Omitting the option preserves existing behavior.

The limit terminates the direct subprocess; it does not promise descendant-process cleanup. This change does not alter shader translation or test discovery.

Tested

Windows 11, Python 3.12.14:

  • python -I tests/test_run_semantic_tests.py: 15 tests passed, including hanging synthetic modules, preserved output, healthy parallel modules, serial behavior, invalid/out-of-range timeout values, and a passing fixture at the maximum supported timeout.
  • python -m compileall -q make_game.py tools tests: passed.
  • python -I make_game.py --help: passed.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 4 --timeout 300: 465 files / 6,104 tests in 484 seconds; two modules failed because spirv-as and spirv-val were absent (test_sopc_validation, test_unary_f16_validation). No timeout failures occurred.
  • After adding checksum-verified SPIRV-Tools 2026.4 to the task-local PATH, reran those two modules with python -m unittest discover -s tests/semantic -p <filename>: 11 and 5 tests passed respectively. The full suite was not rerun after that environment change; the initial failures are retained in the validation record.
  • python -I scripts/check_no_game_data.py scripts/run_semantic_tests.py tests/test_run_semantic_tests.py: passed.
  • git diff --check: passed. Independent source review found no blockers.

GPUs tested: n/a (test-runner change; no GPU execution).

AI-assisted: yes, OpenAI Codex, supervised through csmith105's session.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in quoted logs.
  • Translator contract table: not applicable; no translator rule changes.
**@⁠csmith105** on GitHub · 2026-11-24 05:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/468) `csmith105:codex/semantic-process-timeout` → `main` · +87 −6 · 2 files · 2 commits · merged 2026-11-24 06:32 UTC Claimed in the coordination issue as: [SEMANTIC-PROCESS-TIMEOUT](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why A hanging test subprocess can block the semantic regression runner indefinitely. Add an optional positive finite `--timeout SECONDS` (at most 86,400 seconds / 24 hours): it limits each module in parallel mode, or the entire existing unittest-discovery subprocess with `-j 1`. Timeouts return failure, retain partial output, and allow other parallel modules to finish. Omitting the option preserves existing behavior. The limit terminates the direct subprocess; it does not promise descendant-process cleanup. This change does not alter shader translation or test discovery. ### Tested Windows 11, Python 3.12.14: - `python -I tests/test_run_semantic_tests.py`: 15 tests passed, including hanging synthetic modules, preserved output, healthy parallel modules, serial behavior, invalid/out-of-range timeout values, and a passing fixture at the maximum supported timeout. - `python -m compileall -q make_game.py tools tests`: passed. - `python -I make_game.py --help`: passed. - `python -I scripts/run_semantic_tests.py tests/semantic -j 4 --timeout 300`: 465 files / 6,104 tests in 484 seconds; two modules failed because `spirv-as` and `spirv-val` were absent (`test_sopc_validation`, `test_unary_f16_validation`). No timeout failures occurred. - After adding checksum-verified SPIRV-Tools 2026.4 to the task-local PATH, reran those two modules with `python -m unittest discover -s tests/semantic -p <filename>`: 11 and 5 tests passed respectively. The full suite was not rerun after that environment change; the initial failures are retained in the validation record. - `python -I scripts/check_no_game_data.py scripts/run_semantic_tests.py tests/test_run_semantic_tests.py`: passed. - `git diff --check`: passed. Independent source review found no blockers. GPUs tested: n/a (test-runner change; no GPU execution). AI-assisted: yes, OpenAI Codex, supervised through csmith105's session. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in quoted logs. - [x] Translator contract table: not applicable; no translator rule changes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:02:13 +00:00
github manually merged commit 90eb7284fe into gh-pr/468/base 2026-11-26 09:02:15 +00:00
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 06:02 UTC · original

Independent Windows check on 973593f with CPython 3.14.7. All 13 runner tests passed. A one-test synthetic fixture also passed with --timeout 300 and with the option omitted, using both -j 1 and -j 2.

One validation edge case: --timeout 1e100 is accepted in both modes, but the same passing fixture immediately exits with status 1. With -j 1 the runner reports TIMED OUT after 1e+100 s. With -j 2 it prints an uncaught OverflowError: timestamp out of range for C PyTime_t from the subprocess output reader's thread join. To reproduce, run python -I scripts/run_semantic_tests.py <directory-with-a-passing-test> -j 2 --timeout 1e100, then repeat with -j 1.

Could the parser reject values above a documented, supported maximum before launching the subprocess? A finite out-of-range value in the argument validation test would cover both modes.

Synthetic tests only. AI-assisted (Codex).

**@⁠Dezmonius** on GitHub · 2026-11-24 06:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7123512917) Independent Windows check on `973593f` with CPython 3.14.7. All 13 runner tests passed. A one-test synthetic fixture also passed with `--timeout 300` and with the option omitted, using both `-j 1` and `-j 2`. One validation edge case: `--timeout 1e100` is accepted in both modes, but the same passing fixture immediately exits with status 1. With `-j 1` the runner reports `TIMED OUT after 1e+100 s`. With `-j 2` it prints an uncaught `OverflowError: timestamp out of range for C PyTime_t` from the subprocess output reader's thread join. To reproduce, run `python -I scripts/run_semantic_tests.py <directory-with-a-passing-test> -j 2 --timeout 1e100`, then repeat with `-j 1`. Could the parser reject values above a documented, supported maximum before launching the subprocess? A finite out-of-range value in the argument validation test would cover both modes. Synthetic tests only. AI-assisted (Codex).
Author
Owner

@⁠csmith105 on GitHub · 2026-11-24 06:20 UTC · original

Fixed in 90eb7284fe. I reproduced both reported failures before the change. The optional timeout now accepts positive finite values up to a documented 86,400 seconds (24 hours), keeping the wait within portable platform limits. Larger values are rejected by argparse before discovery or subprocess launch. Added regressions for 86,400.1 and 1e100 in both modes, plus a passing fixture at the exact maximum. All 15 focused runner tests pass on Windows/Python 3.12.14; independent source review found no blockers. The default remains unlimited.

**@⁠csmith105** on GitHub · 2026-11-24 06:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7123838249) Fixed in 90eb7284feaae3d2e1511ffef0685d95a7dd7525. I reproduced both reported failures before the change. The optional timeout now accepts positive finite values up to a documented 86,400 seconds (24 hours), keeping the wait within portable platform limits. Larger values are rejected by argparse before discovery or subprocess launch. Added regressions for 86,400.1 and 1e100 in both modes, plus a passing fixture at the exact maximum. All 15 focused runner tests pass on Windows/Python 3.12.14; independent source review found no blockers. The default remains unlimited.
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 06:22 UTC · original

Confirmed the fix at 90eb728 on Windows with CPython 3.14.7. All 15 runner tests passed. On the original synthetic fixture, both -j 1 and -j 2 pass with the option omitted and at 86400, and reject 86400.1 and 1e100 with argparse exit 2 and the documented maximum. Thanks for the fix.

AI-assisted (Codex).

**@⁠Dezmonius** on GitHub · 2026-11-24 06:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7123862427) Confirmed the fix at `90eb728` on Windows with CPython 3.14.7. All 15 runner tests passed. On the original synthetic fixture, both `-j 1` and `-j 2` pass with the option omitted and at `86400`, and reject `86400.1` and `1e100` with argparse exit 2 and the documented maximum. Thanks for the fix. AI-assisted (Codex).
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 06:32 UTC · original

Merging. Why merged: scripts/run_semantic_tests.py gains a per-file timeout and rejects a zero timeout, so one hung semantic test file can't stall the whole run.
Why it's good: security-reviewed (argv-list subprocess on sys.executable only). Tested on Windows 11 merged onto main 8f481cf: tests/test_run_semantic_tests.py 10 passed on main -> 15 passed with this PR (new tests fail without the fix); a real run with --timeout 300 over test_sdwa* ran 40 tests with 0 failures and --timeout 0 is refused. Merges cleanly together with #474.

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

**@⁠QemmHD** on GitHub · 2026-11-24 06:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7124045726) Merging. Why merged: scripts/run_semantic_tests.py gains a per-file timeout and rejects a zero timeout, so one hung semantic test file can't stall the whole run. Why it's good: security-reviewed (argv-list subprocess on sys.executable only). Tested on Windows 11 merged onto main 8f481cf: tests/test_run_semantic_tests.py 10 passed on main -> 15 passed with this PR (new tests fail without the fix); a real run with --timeout 300 over test_sdwa* ran 40 tests with 0 failures and --timeout 0 is refused. Merges cleanly together with #474. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.