Repository navigation
Studio diffusion: test-launch sd.cpp binaries without the Windows missing-DLL box - #16031
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Reached Codex review convergence at oobabooga#435. |
…eritance on real Windows [skip ci]
[skip ci]
|
Review record for #16031, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#633. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
…16108) Since #16031 (test-launch sd.cpp binaries without the Windows missing-DLL box), the AV shapes lint finds a new error on main. Every PR's `Source lint` job and the `test_lint_av_shapes.py::test_the_repository_is_clean_against_its_baseline` test in the CPU shards fail on it, for example on #16018 and #15994: ``` studio/backend/tests/test_sd_cpp_probe_error_mode.py:221: [AV009] error: copies a Windows system binary line: shutil.copy(getattr(sys, "_base_executable", sys.executable), binary) 1 new error(s). ``` `test_a_real_binary_missing_its_dll_is_reported_unrunnable` copies `python.exe` into `tmp_path` as `sd-server.exe`, away from `pythonXY.dll`, and cuts `PATH` to System32. The result is a real PE whose loader fails with `STATUS_DLL_NOT_FOUND`, the same failure as an sd.cpp ROCm build without HIP. The lint's suggested replacement, `windows_console_stub.py`, links nothing and starts fine, so it cannot produce that failure. The copy has to stay. The lint documents this route for that case: the finding is recorded in `scripts/av_shapes_baseline.json` with the reason. The entry carries the digest of that one line, so any other copy in the file is still a new error. I did not use `--update`. It would also have pruned many unrelated stale entries across the baseline. This adds the one group (9 lines). The CI message also prints an AV010 warning for `.github/workflows/studio-tauri-smoke.yml:374` first, but warnings do not fail the check. With only this entry added, the test passes. ## Verification - `python scripts/lint_av_shapes.py`: `1 new error(s)` on main, `0 new errors` here. - `tests/security/test_lint_av_shapes.py::test_the_repository_is_clean_against_its_baseline`: fails on main on the AV009 line, passes here. The rest of the file passes (19 passed). - `--self-test` still passes, since the lint is unchanged.
Reported on Reddit in a reply to "Anyone manage to get MOSS Image to load?": the hipblas.dll box still pops up on load after switching to Vulkan.
Problem
On Windows, an sd.cpp bundle that cannot load its DLLs (for example a ROCm bundle installed before #15371 on a host without the HIP SDK) opens a modal "sd-server.exe - System Error: ... hipblas.dll was not found" box when the backend test-launches it. The probes pass only
windows_hidden_subprocess_kwargs(), which hides the console but not the loader's hard-error box. The installer'sprobe_binary_startsand_vulkan_probealready suppress it; the backend's probes did not.The child stays blocked until someone clicks OK, so an unattended probe hits its timeout instead of reading
0xC0000135:_server_binary_runnablereturns True from its timeout branch, so an unrunnable managed binary is kept instead of being reinstalled.ensure_sd_server_binaryprobes again under_install_lock: a second box and another 20 s.UNSLOTH_SD_CPP_WINDOWS_ROCM=1, orhipblas.dllpresent but another HIP DLL missing), the broken binary is returned and later probes open more boxes.Fix
windows_loader_error_boxes_suppressed()inutils/subprocess_compat.pyORsSEM_FAILCRITICALERRORSinto the process error mode around a test-launch, so the child inherits it and exits at once with0xC0000135. It wraps the four sd.cpp test-launches:_server_binary_runnable,_sd_cpp_probe_output,sd_cpp_binary_identifiesandSdCppEngine.version.The error mode is process-wide and these probes can overlap the installer's own probe, so all holders, including the installer's
_windows_error_mode_suppressed(still0x8003), share one record: the mode before the first holder plus the current holders' flags, restored when the last one leaves. The record lives insys.modulesbecause the installer and the backend import this module under different names.Boundaries
windows_hidden_subprocess_kwargsand its ~95 callers are unchanged; the error mode is parent process state, not aCreateProcessargument.Verification
Windows 11, Radeon 8060S, no HIP SDK, with the upstream ROCm bundle installed without the start check (as v0.1.911-beta did). Each scenario ran against
main(A) and this PR (B) in the logged-on desktop session:main_server_binary_runnable(sd-server)_sd_cpp_probe_output(sd-cli, --help)sd_cpp_binary_identifies+version()ensure_*, Vulkan requestedAn installer scope and a probe scope overlapping on the same host, with the installer leaving first, kept the bit for the probe and restored the original mode afterwards. On
mainin the non-interactive service session, the same probe returns in 0.6 s with no box, which is why headless runs never showed this.tests/test_sd_cpp_probe_error_mode.pyadds 11 tests with a fakekernel32, all failing onmain. The sd.cpp, router, hires and Vulkan probe suites pass (1798 passed, 9 skipped).