warm: distinguish compiler diagnostics from inactivity timeouts #3143

Open
merzleckeier wants to merge 4 commits from upstream-pr/3143 into main
merzleckeier commented 2026-12-02 13:53:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T13:53:37Z.


Claimed in the coordination issue as: WARM-STACK-OVERFLOW-DIAGNOSTIC

Follow-up to closed PR #2656. Addresses the diagnostic reported in #2621.

What and why

The leonida warm subprocess supervisor discards stderr. Under Wine, a compiler process can report a Rust stack overflow and remain alive, leaving the supervisor to record a generic inactivity timeout. This change reports the specific diagnostic and ends the child promptly.

The watcher reads queued stdout and stderr until the direct child exits, so an inherited write handle cannot delay its return. Progress callbacks run in order on the caller thread while the watcher can terminate a stalled child independently. Compiler and library-store arguments, progress receipts, and ordinary exit status reporting are preserved.

Tested

  • Built the locked MSVC-target CLI tests against main 72d143c45 with cargo xwin. All 55 passed under Wine 11.22 on CachyOS.
  • Synthetic cases cover an existing diagnostic followed by an otherwise-live child, a final diagnostic without a newline, the unchanged silent timeout, ordinary exit statuses, a helper retaining pipe handles, and a progress callback waiting while the watchdog reaps the child.
  • The inherited-handle test failed with the earlier stderr-only watcher and passes with both streams polled against the direct child.
  • git diff --check and the repository's no-game-data check passed.

GPUs tested: n/a (CPU only). Native Windows and a retail title were outside this test run.

AI-assisted: OpenAI Codex with GPT-6.2, independently reviewed read-only by GPT-6.2 Sol.

Checklist

  • Based on upstream main (72d143c45).
  • One topic.
  • Synthetic fixtures only.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5607839368 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T13:53:37Z. --- Claimed in the coordination issue as: [WARM-STACK-OVERFLOW-DIAGNOSTIC](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263136541) Follow-up to closed PR #2656. Addresses the diagnostic reported in #2621. ### What and why The `leonida warm` subprocess supervisor discards stderr. Under Wine, a compiler process can report a Rust stack overflow and remain alive, leaving the supervisor to record a generic inactivity timeout. This change reports the specific diagnostic and ends the child promptly. The watcher reads queued stdout and stderr until the direct child exits, so an inherited write handle cannot delay its return. Progress callbacks run in order on the caller thread while the watcher can terminate a stalled child independently. Compiler and library-store arguments, progress receipts, and ordinary exit status reporting are preserved. ### Tested - Built the locked MSVC-target CLI tests against `main` `72d143c45` with `cargo xwin`. All 55 passed under Wine 11.22 on CachyOS. - Synthetic cases cover an existing diagnostic followed by an otherwise-live child, a final diagnostic without a newline, the unchanged silent timeout, ordinary exit statuses, a helper retaining pipe handles, and a progress callback waiting while the watchdog reaps the child. - The inherited-handle test failed with the earlier stderr-only watcher and passes with both streams polled against the direct child. - `git diff --check` and the repository's no-game-data check passed. GPUs tested: n/a (CPU only). Native Windows and a retail title were outside this test run. AI-assisted: OpenAI Codex with GPT-6.2, independently reviewed read-only by GPT-6.2 Sol. ### Checklist - [x] Based on upstream `main` (`72d143c45`). - [x] One topic. - [x] Synthetic fixtures only.
ecox982745 commented 2026-12-02 13:57:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-02T13:57:21Z.


Integration check for ff65cb2f: this PR and #3071 (c2065b54) each merge cleanly onto main 2fc7383b. A read-only git merge-tree of the two heads reports a content conflict in d3d12/apps/leonida/src/warm.rs. Both change child and its process setup. Whichever follows should retain #3071’s --store --jobs N forwarding and this PR’s piped stderr and watchdog. The normal non-store child should still get its idle priority. This is a merge-order note. AI-assisted, CPU-only.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7347741465 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7347741465). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-12-02T13:57:21Z. --- Integration check for `ff65cb2f`: this PR and #3071 (`c2065b54`) each merge cleanly onto `main` `2fc7383b`. A read-only `git merge-tree` of the two heads reports a content conflict in `d3d12/apps/leonida/src/warm.rs`. Both change `child` and its process setup. Whichever follows should retain #3071’s `--store --jobs N` forwarding and this PR’s piped stderr and watchdog. The normal non-store child should still get its idle priority. This is a merge-order note. AI-assisted, CPU-only.
merzleckeier commented 2026-12-02 14:09:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:09:27Z.


I reproduced the overlap from the integration check on main 69cd4106c with #3071 c2065b540 and #3143 d7196402a. Both merge individually. The combined tree needs a local resolution for the child signature and the test imports in warm.rs.

The tested resolution retains the jobs parameter, child_args and idle priority from #3071, plus the piped streams and watcher from #3143. All 59 MSVC-target CLI unit tests passed under Wine 11.22, including the --store --jobs Clap round trip, worker caps, inherited-pipe and independent-watchdog cases. The 20 switch-documentation tests passed as well. This was an isolated CPU-only test with synthetic inputs. Both original branches remain available for independent merge. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7348080995 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7348080995). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:09:27Z. --- I reproduced the overlap from the [integration check](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7347741465) on main `69cd4106c` with #3071 `c2065b540` and #3143 `d7196402a`. Both merge individually. The combined tree needs a local resolution for the `child` signature and the test imports in `warm.rs`. The tested resolution retains the `jobs` parameter, `child_args` and idle priority from #3071, plus the piped streams and watcher from #3143. All 59 MSVC-target CLI unit tests passed under Wine 11.22, including the `--store --jobs` Clap round trip, worker caps, inherited-pipe and independent-watchdog cases. The 20 switch-documentation tests passed as well. This was an isolated CPU-only test with synthetic inputs. Both original branches remain available for independent merge. AI-assisted with OpenAI Codex.
Kal0s-design commented 2026-12-02 15:19:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:19:06Z.


Ran natively on Windows 11, head d7196402a merged into current main (43fc605ed, merges cleanly), MSVC target, toolchain 1.98.1, --locked.

Check Result
cargo test -p leonida --bin leonida warm:: 8 passed
cargo test -p leonida (all) 50 + 2 + 2 + 1 passed
tests/test_d3d12_switches.py 20 passed
on main the six new tests can't be built there (collect_child doesn't exist)
cargo clippy -p leonida --all-targets one new warning, test only: zombie_processes on the hold helper spawned by the inherited fixture (warm.rs, fixture_command("hold")...spawn()). CI does not run clippy, so nothing fails.

Extra throwaway cases (not committed), added as more fixture modes and run through collect_child, quiet limit 2 s unless noted:

Child does Result Note
overflow line on stderr 1.8 s after the last stdout line, stays alive compiler process stack overflow at 1.87 s the diagnostic wins just before the limit
overflow line with non-UTF-8 bytes in the thread name, CRLF, stays alive compiler process stack overflow at 0.05 s byte matching works
overflow text on stderr without newline, stays alive hung for 2 s after the timeout only stdout gets its final poll(true, ..), so the partial stderr line is never checked
prints the overflow line on stderr, then exits 0 (1, Some("compiler process stack overflow")) stderr is checked before the exit status
non-UTF-8 lines on stdout every 0.4 s for 3.2 s hung for 2 s such lines don't reset the quiet timer. I ran a copy of main's reader loop on the same fixture. It stops reading at the first such line, its watchdog stops too and the pipe is dropped. The fixture then died writing to the broken pipe (exit code: 101, 0.5 s). A child that ignored the write error would be waited on with no timeout, so the PR's result is the better one
1 MiB stdout line, then a made line both made lines reported, (2, None) the long line is dropped as intended
process::abort() exit code: 0xc0000409
killed from outside (taskkill /F) after 0.7 s exit code: 1 at 1.06 s
16 MiB to stderr, then exit 0 (2, None) in 6.6 s same child with stderr to null (as on main): 0.04 s
2,000,000 short stdout lines, then exit 0 (2, None) in 17.5 s blocking BufReader::lines() reader (as on main): 4.8 s. Both are debug builds

The two edge cases I'd look at:

  1. Partial diagnostic, then the timeout. Rust's overflow handler writes a newline at the end, so this is unlikely. But one more stderr.poll(true, &mut is_stack_overflow) after the kill would cover it at no cost. It would also catch a complete diagnostic line that arrives in the last 50 ms before the timeout. (main's loop gives hung for 2 s here too.)
  2. Exit 0 with the line on stderr. That can happen if a helper that inherited stderr prints it, or if a Wine thread overflows and the process still finishes. In the store path (child(todo, Some(&listed), ..)), the library is then reported as "not written" and the fingerprint goes to the failed list, even though the child succeeded. Checking status.success() before the stderr result would keep a clean exit clean.

On throughput: the 50 ms poll makes a child that writes a lot to stderr wait on the pipe. That only matters if the compiler (or Wine's debug channels) writes megabytes per pipeline. That is not normal output, so I'm only noting it.

Not checked: Wine (the case the PR is for), a real compiler stack overflow, the combined resolution with #3071 (already covered above), a release build.

GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7350119124 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7350119124). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T15:19:06Z. --- Ran natively on Windows 11, head `d7196402a` merged into current `main` (`43fc605ed`, merges cleanly), MSVC target, toolchain 1.98.1, `--locked`. | Check | Result | |---|---| | `cargo test -p leonida --bin leonida warm::` | 8 passed | | `cargo test -p leonida` (all) | 50 + 2 + 2 + 1 passed | | `tests/test_d3d12_switches.py` | 20 passed | | on `main` | the six new tests can't be built there (`collect_child` doesn't exist) | | `cargo clippy -p leonida --all-targets` | one new warning, test only: `zombie_processes` on the `hold` helper spawned by the `inherited` fixture (warm.rs, `fixture_command("hold")...spawn()`). CI does not run clippy, so nothing fails. | Extra throwaway cases (not committed), added as more fixture modes and run through `collect_child`, quiet limit 2 s unless noted: | Child does | Result | Note | |---|---|---| | overflow line on stderr 1.8 s after the last stdout line, stays alive | `compiler process stack overflow` at 1.87 s | the diagnostic wins just before the limit | | overflow line with non-UTF-8 bytes in the thread name, CRLF, stays alive | `compiler process stack overflow` at 0.05 s | byte matching works | | overflow text on stderr **without newline**, stays alive | `hung for 2 s` | after the timeout only stdout gets its final `poll(true, ..)`, so the partial stderr line is never checked | | prints the overflow line on stderr, then **exits 0** | `(1, Some("compiler process stack overflow"))` | stderr is checked before the exit status | | non-UTF-8 lines on stdout every 0.4 s for 3.2 s | `hung for 2 s` | such lines don't reset the quiet timer. I ran a copy of `main`'s reader loop on the same fixture. It stops reading at the first such line, its watchdog stops too and the pipe is dropped. The fixture then died writing to the broken pipe (`exit code: 101`, 0.5 s). A child that ignored the write error would be waited on with no timeout, so the PR's result is the better one | | 1 MiB stdout line, then a `made` line | both `made` lines reported, `(2, None)` | the long line is dropped as intended | | `process::abort()` | `exit code: 0xc0000409` | | | killed from outside (`taskkill /F`) after 0.7 s | `exit code: 1` at 1.06 s | | | 16 MiB to stderr, then exit 0 | `(2, None)` in 6.6 s | same child with stderr to null (as on `main`): 0.04 s | | 2,000,000 short stdout lines, then exit 0 | `(2, None)` in 17.5 s | blocking `BufReader::lines()` reader (as on `main`): 4.8 s. Both are debug builds | The two edge cases I'd look at: 1. **Partial diagnostic, then the timeout.** Rust's overflow handler writes a newline at the end, so this is unlikely. But one more `stderr.poll(true, &mut is_stack_overflow)` after the kill would cover it at no cost. It would also catch a complete diagnostic line that arrives in the last 50 ms before the timeout. (`main`'s loop gives `hung for 2 s` here too.) 2. **Exit 0 with the line on stderr.** That can happen if a helper that inherited stderr prints it, or if a Wine thread overflows and the process still finishes. In the store path (`child(todo, Some(&listed), ..)`), the library is then reported as "not written" and the fingerprint goes to the failed list, even though the child succeeded. Checking `status.success()` before the stderr result would keep a clean exit clean. On throughput: the 50 ms poll makes a child that writes a lot to stderr wait on the pipe. That only matters if the compiler (or Wine's debug channels) writes megabytes per pipeline. That is not normal output, so I'm only noting it. Not checked: Wine (the case the PR is for), a real compiler stack overflow, the combined resolution with #3071 (already covered above), a release build. GPUs tested: n/a (CPU-only tests). AI-assisted: yes (Claude Code).
merzleckeier commented 2026-12-02 15:27:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T15:27:40Z.


Thanks for testing this natively on Windows. b6023d1dc addresses both findings. The watcher now drains the final stderr fragment after stopping and reaping the child. A confirmed exit code 0 from the direct child takes precedence over a matching line on shared stderr. The scoped Clippy expectation documents why the fixture helper must outlive its parent.

Both added regression tests failed against the published implementation at d7196402a. On the updated PR merged locally into main at 0d6757b70, all 57 MSVC-target CLI tests and five Leonida integration tests passed under Wine 11.22. The 20 switch-documentation tests passed, and the MSVC-target Clippy run produced no warning in warm.rs.

GPU testing was not applicable to these synthetic subprocess cases. AI-assisted with OpenAI Codex, with a separate read-only review by GPT-6.2 Sol.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7350362075 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7350362075). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T15:27:40Z. --- Thanks for testing this natively on Windows. `b6023d1dc` addresses both findings. The watcher now drains the final stderr fragment after stopping and reaping the child. A confirmed exit code 0 from the direct child takes precedence over a matching line on shared stderr. The scoped Clippy expectation documents why the fixture helper must outlive its parent. Both added regression tests failed against the published implementation at `d7196402a`. On the updated PR merged locally into `main` at `0d6757b70`, all 57 MSVC-target CLI tests and five Leonida integration tests passed under Wine 11.22. The 20 switch-documentation tests passed, and the MSVC-target Clippy run produced no warning in `warm.rs`. GPU testing was not applicable to these synthetic subprocess cases. AI-assisted with OpenAI Codex, with a separate read-only review by GPT-6.2 Sol.
fiestorra commented 2026-12-02 15:54:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T15:54:37Z.


Verified on native Windows, which is the side the body says was not run: cargo xwin + Wine there, native here - the warm tests pass, and a real warm run comes out clean.

The checker first:

python -I scripts/red_green.py 3143                   0.9 min

base origin/main 3c106eb2f, head 3143 b6023d1dc, merge base 72d143c45
ran: cargo -p leonida
red does not build: error[E0433]: cannot find module or crate `io` in this scope
only on green (57): ...
verdict: red does not build

red does not build is the correct answer, not a failure: the new tests use an io the change imports, so they cannot compile on the base - the same shape as any PR whose tests need the new code. The green side builds and its 57 tests pass.

Then the tests that matter here, run natively (cargo test -p leonida --bins -- --test-threads=1 warm, 1.1 min, head b6023d1dc):

warm::tests::keeps_a_successful_exit_with_a_matching_stderr_line ... ok
warm::tests::keeps_status_for_ordinary_child_exits ... ok
warm::tests::only_pipelines_drawn_with_go_into_the_library ... ok
warm::tests::reads_the_final_diagnostic_after_stopping_a_child ... ok
warm::tests::reads_the_final_diagnostic_when_the_child_exits ... ok
warm::tests::reports_stack_overflow_before_waiting_for_the_timeout ... ok
warm::tests::returns_before_an_inherited_stderr_handle_closes ... ok
warm::tests::silent_child_still_times_out ... ok

returns_before_an_inherited_stderr_handle_closes is the one worth naming: inherited handles and how a child's stderr closes are exactly where Wine and Windows differ, so this is the test the Wine run could not speak for, and it passes here.

And a real run, leonida warm --limit 40 --jobs 8 on this machine's own book (a copy of a cache from a real run):

83563 pipelines known, 0 made before, 0 bad; 40 to make, 8 processes
40 made in 9 s (13 have no host pipeline, 0 ended their process); ms each: median 7.4, p90 544.6, p99 ...
27 of 27 in the pipeline library, written in 0 s

0 ended their process is the line this change is about - the watcher distinguishes a diagnostic from an inactivity timeout - and the new summary prints the per-pipeline spread without a crash. (The 83,563 also settles something I claimed in #3041 from the module's notes: the title really does create about 84,000 pipelines.)

What it does not cover: a compiler that actually overflows - that needs an 8 GiB card and a title run - and the game, which this machine cannot start.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351130537 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7351130537). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T15:54:37Z. --- **Verified on native Windows, which is the side the body says was not run: `cargo xwin` + Wine there, native here - the `warm` tests pass, and a real `warm` run comes out clean.** **The checker first:** ``` python -I scripts/red_green.py 3143 0.9 min base origin/main 3c106eb2f, head 3143 b6023d1dc, merge base 72d143c45 ran: cargo -p leonida red does not build: error[E0433]: cannot find module or crate `io` in this scope only on green (57): ... verdict: red does not build ``` **`red does not build` is the correct answer, not a failure**: the new tests use an `io` the change imports, so they cannot compile on the base - **the same shape as any PR whose tests need the new code.** **The green side builds and its 57 tests pass.** **Then the tests that matter here, run natively** (`cargo test -p leonida --bins -- --test-threads=1 warm`, 1.1 min, head `b6023d1dc`): ``` warm::tests::keeps_a_successful_exit_with_a_matching_stderr_line ... ok warm::tests::keeps_status_for_ordinary_child_exits ... ok warm::tests::only_pipelines_drawn_with_go_into_the_library ... ok warm::tests::reads_the_final_diagnostic_after_stopping_a_child ... ok warm::tests::reads_the_final_diagnostic_when_the_child_exits ... ok warm::tests::reports_stack_overflow_before_waiting_for_the_timeout ... ok warm::tests::returns_before_an_inherited_stderr_handle_closes ... ok warm::tests::silent_child_still_times_out ... ok ``` **`returns_before_an_inherited_stderr_handle_closes` is the one worth naming**: inherited handles and how a child's stderr closes are exactly where Wine and Windows differ, **so this is the test the Wine run could not speak for, and it passes here.** **And a real run**, `leonida warm --limit 40 --jobs 8` on this machine's own book (a copy of a cache from a real run): ``` 83563 pipelines known, 0 made before, 0 bad; 40 to make, 8 processes 40 made in 9 s (13 have no host pipeline, 0 ended their process); ms each: median 7.4, p90 544.6, p99 ... 27 of 27 in the pipeline library, written in 0 s ``` **`0 ended their process` is the line this change is about** - the watcher distinguishes a diagnostic from an inactivity timeout - **and the new summary prints the per-pipeline spread without a crash.** **(The 83,563 also settles something I claimed in #3041 from the module's notes: the title really does create about 84,000 pipelines.)** **What it does not cover**: **a compiler that actually overflows** - that needs an 8 GiB card and a title run - and **the game**, which this machine cannot start. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
MoonEyes commented 2026-12-02 18:18:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:18:19Z.


Verification of #3143 (third party, code review on Linux; not built: Windows-only leonida app)

  • Head verified: b6023d1dcb20e13cff75c61091577cfb7beacb1e (2 files: apps/leonida/src/warm.rs +352/-35,
    docs/switches.md).
  • Merge base 72d143c45. git merge-tree --write-tree origin/main pr/3143 against main 45dc41f95 is clean
    (46 commits behind). CI on the head: 6/6 success.
  • python -I scripts/check_no_game_data.py on both files: exit 0.
  • Cross-PR: #3071 conflicts with this in warm.rs (child signature and the test imports), as ecox982745 and
    merzleckeier reported. Whichever lands second must keep #3071's --store --jobs N forwarding.

Review

  • Cause: the supervisor discarded the compiler child's stderr, so under Wine a Rust stack overflow, where the
    process stays alive, was recorded as a generic inactivity timeout. With stderr piped, the child is ended on the
    thread '..' has overflowed its stack line (is_stack_overflow) and the reason is reported. This fixes the
    diagnostic at its source.
  • Exit detection now uses the process handle (try_wait) instead of stdout EOF. That is right when a helper
    inherits the pipe and outlives the child (the comment at PipeLines). A confirmed exit 0 takes precedence over
    a matching stderr line, and the final stderr fragment is drained after kill and reap. Both follow the native
    review on the previous head.
  • Points to consider (non-blocking):
    1. Polling instead of blocking reads: watch_child drains with PeekNamedPipe and sleeps 50 ms per loop.
      An anonymous pipe's buffer is small (about 4 KiB by default). A child that writes progress faster than one
      buffer per 50 ms blocks on its own stdout, so the supervisor would throttle the compile. A warm run with
      tens of thousands of shaders and parallel children could reach that rate. A timing of a full warm on main
      against the PR would settle it. fiestorra's "real warm run comes out clean" shows correctness, not
      throughput.
    2. pipe_bytes_available declares PeekNamedPipe by hand through #[link(name = "kernel32")]. The app does
      not depend on windows-sys directly, so this avoids a new dependency. That is acceptable.
    3. The unconditional std::os::windows import in warm.rs is fine: mod warm is #[cfg(windows)]
      (main.rs:25-26).
  • Tests: a warm_child_fixture re-executes the test binary as a fake child (hold, overflow line, helper
    keeping the pipe). That is a sound way to test the supervisor without a compiler. fiestorra's
    python -I scripts/red_green.py 3143 and Kal0s-design's 8 warm:: tests ran natively.

Process

  • Claim and AI disclosure (Codex GPT-6.2, GPT-6.2 Sol reviewer) are present.

Verdict: ready on review (not built here). Point 1 is worth one timing run before merge. Coordinate the
warm.rs merge with #3071.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354332253 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7354332253). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:18:19Z. --- **Verification of #3143 (third party, code review on Linux; not built: Windows-only `leonida` app)** - Head verified: `b6023d1dcb20e13cff75c61091577cfb7beacb1e` (2 files: `apps/leonida/src/warm.rs` +352/-35, `docs/switches.md`). - Merge base `72d143c45`. `git merge-tree --write-tree origin/main pr/3143` against `main` `45dc41f95` is clean (46 commits behind). CI on the head: 6/6 success. - `python -I scripts/check_no_game_data.py` on both files: exit 0. - Cross-PR: #3071 conflicts with this in `warm.rs` (`child` signature and the test imports), as ecox982745 and merzleckeier reported. Whichever lands second must keep #3071's `--store --jobs N` forwarding. **Review** - Cause: the supervisor discarded the compiler child's stderr, so under Wine a Rust stack overflow, where the process stays alive, was recorded as a generic inactivity timeout. With stderr piped, the child is ended on the `thread '..' has overflowed its stack` line (`is_stack_overflow`) and the reason is reported. This fixes the diagnostic at its source. - Exit detection now uses the process handle (`try_wait`) instead of stdout EOF. That is right when a helper inherits the pipe and outlives the child (the comment at `PipeLines`). A confirmed exit 0 takes precedence over a matching stderr line, and the final stderr fragment is drained after kill and reap. Both follow the native review on the previous head. - Points to consider (non-blocking): 1. **Polling instead of blocking reads:** `watch_child` drains with `PeekNamedPipe` and sleeps 50 ms per loop. An anonymous pipe's buffer is small (about 4 KiB by default). A child that writes progress faster than one buffer per 50 ms blocks on its own stdout, so the supervisor would throttle the compile. A warm run with tens of thousands of shaders and parallel children could reach that rate. A timing of a full `warm` on `main` against the PR would settle it. fiestorra's "real warm run comes out clean" shows correctness, not throughput. 2. `pipe_bytes_available` declares `PeekNamedPipe` by hand through `#[link(name = "kernel32")]`. The app does not depend on `windows-sys` directly, so this avoids a new dependency. That is acceptable. 3. The unconditional `std::os::windows` import in `warm.rs` is fine: `mod warm` is `#[cfg(windows)]` (`main.rs:25-26`). - Tests: a `warm_child_fixture` re-executes the test binary as a fake child (`hold`, overflow line, helper keeping the pipe). That is a sound way to test the supervisor without a compiler. fiestorra's `python -I scripts/red_green.py 3143` and Kal0s-design's 8 `warm::` tests ran natively. **Process** - Claim and AI disclosure (Codex GPT-6.2, GPT-6.2 Sol reviewer) are present. **Verdict: ready on review** (not built here). Point 1 is worth one timing run before merge. Coordinate the `warm.rs` merge with #3071. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 22:00:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T22:00:57Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360103325 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7360103325). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T22:00:57Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
fiestorra commented 2026-12-02 23:19:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:19:12Z.


VERIFY-3143 — Windows nativo: las pruebas de warm pasan y el control mata dos

Own commit b6023d1dc — apps/leonida/src/warm.rs, +52/−4 (and its tests in the same file)
Merge base recent

Ran at the head

cargo test -p leonida warm
  warm::tests::keeps_a_successful_exit_with_a_matching_stderr_line ... ok
  warm::tests::returns_before_an_inherited_stderr_handle_closes ... ok
  warm::tests::reports_stack_overflow_before_waiting_for_the_timeout ... ok
  warm::tests::reads_the_final_diagnostic_when_the_child_exits ... ok
  warm::tests::only_pipelines_drawn_with_go_into_the_library ... ok
  warm::tests::warm_child_fixture ... ok

Negative control (synthetic): I replaced the stack-overflow reason with a dummy string (break String::from("no overflow")), rebuilt and ran:

FAILED. 8 passed; 2 failed

Two bite — the one named after the stack overflow and the one that reads the final diagnostic.

What the change is, and why it is not cosmetic: the warm-up child's exit status is now preserved when a helper shares its stderr ("the direct child's successful exit takes precedence"), a stack overflow is reported before waiting out the timeout (a child that died on overflow never closes its own handle, so the old code waited the full budget), and the last diagnostic is read when the child exits. All three are "the run looks like a timeout when it is really a crash" — the kind of failure that costs an hour of reading logs.

Note on how it was run, because the test naming lies to a script: cargo test -p leonida --lib warm finds nothing (the app is a binary: no library targets found), and the plain cargo test -p leonida warm prints 0 passed for the other targets before the binary's own line — the six warm tests are in --bin leonida.

What I could not test

  • A real warm-up run: warm.rs drives the shader/pipeline warm-up child against the title's toolchain; the tests use a fixture child. No title, no warm-up here.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361842808 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7361842808). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T23:19:12Z. --- ## VERIFY-3143 — Windows nativo: las pruebas de `warm` pasan y el control mata dos | | | |---|---| | Own commit | `b6023d1dc` — `apps/leonida/src/warm.rs`, +52/−4 (and its tests in the same file) | | Merge base | recent | **Ran at the head** ``` cargo test -p leonida warm warm::tests::keeps_a_successful_exit_with_a_matching_stderr_line ... ok warm::tests::returns_before_an_inherited_stderr_handle_closes ... ok warm::tests::reports_stack_overflow_before_waiting_for_the_timeout ... ok warm::tests::reads_the_final_diagnostic_when_the_child_exits ... ok warm::tests::only_pipelines_drawn_with_go_into_the_library ... ok warm::tests::warm_child_fixture ... ok ``` **Negative control (synthetic)**: I replaced the stack-overflow reason with a dummy string (`break String::from("no overflow")`), rebuilt and ran: ``` FAILED. 8 passed; 2 failed ``` **Two bite** — the one named after the stack overflow and the one that reads the final diagnostic. **What the change is, and why it is not cosmetic**: the warm-up **child**'s exit status is now preserved when a **helper shares its stderr** (*"the direct child's successful exit takes precedence"*), **a stack overflow is reported before waiting out the timeout** (a child that died on overflow never closes its own handle, so the old code waited the full budget), and **the last diagnostic is read when the child exits**. **All three are "the run looks like a timeout when it is really a crash"** — the kind of failure that costs an hour of reading logs. **Note on how it was run, because the test naming lies to a script**: `cargo test -p leonida --lib warm` finds **nothing** (the app is a binary: `no library targets found`), and the plain `cargo test -p leonida warm` prints `0 passed` for the *other* targets before the binary's own line — **the six warm tests are in `--bin leonida`**. ## What I could not test - **A real warm-up run**: `warm.rs` drives the shader/pipeline warm-up child against the title's toolchain; the tests use a fixture child. **No title, no warm-up here.** Written with an AI assistant.
merzleckeier commented 2026-12-02 23:25:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T23:25:10Z.


Follow-up to the pipe throughput question. I put the reader from main (81efe4566, same warm code as ef35d683e) and the watcher from b6023d1dc in the same MSVC-target harness and ran it under Wine 11.22. The synthetic direct child flushed a realistic at line and made line per record, as fast as it could. Every run checked the status, callback count and pipeline ID checksum.

Progress records per child main median #3143 median
40 (one compile batch) 504 ms 55 ms
1,000 504 ms 105 ms
10,000 504 ms 564 ms
50,000 (synthetic library-size burst) 2,504 ms 2,604 ms

Medians are from three runs per row per version. The baseline includes the old 500 ms watchdog join. The largest stdout burst added about 100 ms in this Wine setup. This measures pipe handling only. Thanks for the native Windows regression check. The requested in-game run remains open. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361970211 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7361970211). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T23:25:10Z. --- Follow-up to the [pipe throughput question](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7354332253). I put the reader from `main` (`81efe4566`, same warm code as `ef35d683e`) and the watcher from `b6023d1dc` in the same MSVC-target harness and ran it under Wine 11.22. The synthetic direct child flushed a realistic `at` line and `made` line per record, as fast as it could. Every run checked the status, callback count and pipeline ID checksum. | Progress records per child | `main` median | #3143 median | | --- | ---: | ---: | | 40 (one compile batch) | 504 ms | 55 ms | | 1,000 | 504 ms | 105 ms | | 10,000 | 504 ms | 564 ms | | 50,000 (synthetic library-size burst) | 2,504 ms | 2,604 ms | Medians are from three runs per row per version. The baseline includes the old 500 ms watchdog join. The largest stdout burst added about 100 ms in this Wine setup. This measures pipe handling only. Thanks for the [native Windows regression check](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7361842808). The requested in-game run remains open. AI-assisted.
merzleckeier commented 2026-12-03 14:52:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T14:52:32Z.


I checked the warm-bad report in coordination against current 128579e9 and #3143 b6023d1d. The warm scheduler is byte-identical in both.

With three synthetic keys and a worker stub that exits before reporting any pipeline, the scheduler puts the first key in warm-bad.txt and continues with the remaining two. The same happens for a timeout before progress. In either case --again still excludes the first key. Changing the driver/translation fingerprint in the fixture also leaves it excluded. A control without the saved bad entry schedules and completes all three.

This confirms the bookkeeping behavior independently of the reported driver incident. #3143 improves the diagnostic from the worker. Identifying which pipeline was actually attempted and deciding when to retry recorded failures are separate scheduling questions. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7382180353 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3143#issuecomment-7382180353). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T14:52:32Z. --- I checked the [warm-bad report in coordination](https://github.com/ProjectLeonida/mandy/issues/3312#issuecomment-7382094186) against current `128579e9` and #3143 `b6023d1d`. The warm scheduler is byte-identical in both. With three synthetic keys and a worker stub that exits before reporting any pipeline, the scheduler puts the first key in `warm-bad.txt` and continues with the remaining two. The same happens for a timeout before progress. In either case `--again` still excludes the first key. Changing the driver/translation fingerprint in the fixture also leaves it excluded. A control without the saved bad entry schedules and completes all three. This confirms the bookkeeping behavior independently of the reported driver incident. #3143 improves the diagnostic from the worker. Identifying which pipeline was actually attempted and deciding when to retry recorded failures are separate scheduling questions. AI-assisted (Codex).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3143:upstream-pr/3143'
git switch 'upstream-pr/3143'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3143'
git switch 'upstream-pr/3143'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3143'
git switch 'upstream-pr/3143'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3143'
git switch 'main'
git merge --squash 'upstream-pr/3143'
git switch 'main'
git merge --ff-only 'upstream-pr/3143'
git switch 'main'
git merge 'upstream-pr/3143'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3143
No description provided.