Skip to content

Run the llama.cpp keep-install back-compat tests on Windows - #10106

Merged
danielhanchen merged 2 commits into
mainfrom
ci/keep-install-windows-parity
Sep 1, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
ci/keep-install-windows-parity

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

studio-backend-ci.yml runs tests/studio/install/ on ubuntu-latest only, both jobs. The keep-path back-compat matrix added in #9979 simulates Windows by injecting HostInfo(is_windows=True) on Linux, which is the right pattern for the path decisions and payload tables but proves nothing about the Windows loader. So the installer keep path is currently unverified on Windows rather than verified working.

Running those files on a real windows-latest runner produced 76 failures: 43 in test_install_llama_prebuilt_logic.py and 33 in test_keep_install_backcompat_9979.py.

The two failure classes are not the same thing

A fixture artifact. build_install writes #!/bin/sh\nexit 0\n into a file named llama-server.exe. Windows refuses it with ERROR_BAD_EXE_FORMAT, _binary_image_runs correctly reports "not an executable image", and every healthy-install case fails. The fixture is wrong here, not the product.

A real platform difference. os.access(path, os.X_OK) returns true for any file that exists on Windows, and os.chmod cannot clear an execute bit Windows does not have. So the executable=False trees are indistinguishable from healthy ones there, and the X_OK gate in _existing_install_runs does nothing on that platform. That gets labelled, not silently skipped.

Changes

tests/studio/install/test_keep_install_backcompat_9979.py:

  • On Windows, healthy binaries are a real PE copied from System32 and bad ones are deliberate non-PE bytes. _binary_image_runs then sees a genuine ERROR_BAD_EXE_FORMAT from CreateProcess instead of a stubbed run_capture. That branch and the 0xC0000135 one are structurally unreachable on Linux: OSError.winerror does not exist there, and a POSIX exit status cannot reach 0xC0000000.
  • The stub is verified by running the copy at import rather than assumed. Copying python.exe alone would lose python3xx.dll and die 0xC0000135, hence a System32 tool whose imports are all KnownDLLs. If no candidate starts, the module skips with a clear reason instead of reporting the loader's refusal as a back-compat failure.
  • The one executable=False case is skipped on Windows, reusing the reason already in test_install_whisper_prebuilt_logic.py:
reason = "os.access(X_OK) is always true on Windows, so the guard is POSIX only"

.github/workflows/cross-platform-parity-ci.yml:

  • adds the file to the pytest list and to both paths: blocks.

Why this workflow, and why only this file

The parity job is already windows-latest, already capped at 10 minutes, already installs a superset of what these tests need, already runs with -rs so a silently skipped case is visible, and its paths: filter already includes studio/install_*.py, so the module under test triggers it today. Its Windows row runs in about 1m40s. Every other Windows job in the repo is a full-install smoke test measured in tens of minutes.

test_install_llama_prebuilt_logic.py is deliberately left out. It has 11 symlink sites, 22 shebangs and tests that shell out to bash (which on windows-latest resolves to a WSL stub), and it already carries per-case Windows guards. It is POSIX by design and forcing it onto Windows is a large fight for little signal.

What this still does not prove

Worth being precise, because the point of the change is to stop overstating coverage. Still unverified on real Windows after this: DLL and cudart loading and the 0xC0000135 path, ACL and denied-file semantics, binary_env's PATH construction (on Linux os.pathsep is ":", so the Windows branch builds a colon-joined PATH and asserts nothing about the real one), NTFS case-insensitive glob in _runtime_payload_has, and long-path .exists() behaviour.

The narrow claim: the keep-path back-compat matrix runs for real on Windows, and bad-image rejection is genuinely exercised there.

Verification

Linux is unchanged, 96 passed before and after with zero new skips. The parity job's own suite plus this file: 174 passed.

The Windows row wants reading rather than trusting once this is up. A green job with the file silently skipped is a failure, not a pass; the -rs summary should show only the labelled X_OK case.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T01:11:17.965485Z 6cd7207 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e398482fb3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +195 to +196
if WINDOWS_HOST:
path.write_bytes(RUNNABLE_STUB if ok else b"not a PE image\n")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep Windows-native probes on executable-suffixed paths

On the new Windows runner, test_a_rotten_root_entrypoint_is_caught_even_when_build_bin_is_fine still builds its tree with the default simulated LINUX host, so these PE bytes are written to extensionless llama-server paths. Windows process resolution appends .exe when launching such a command, cannot find the extensionless fixture, and raises FileNotFoundError; _binary_image_runs deliberately treats that non-193 OSError as healthy. Consequently the rotten-root assertion remains True and the newly added Windows workflow fails consistently. Run this bad-image case with a Windows-shaped host/path or otherwise ensure the native probe launches the actual fixture.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prediction is testable and it did not hold, so no change here. parity (windows-latest) on this PR passed in 2m24s, and the run log shows the file collected and executed rather than skipped:

SKIPPED [1] tests\studio\install\test_keep_install_backcompat_9979.py:516: os.access(X_OK) is always true on Windows, so the guard is POSIX only
611 passed, 3 skipped in 79.47s

That single skip is the labelled X_OK case, so the other 95 cases in the file ran natively, test_a_rotten_root_entrypoint_is_caught_even_when_build_bin_is_fine among them.

The mechanism assumed does not apply. CreateProcess appends .exe when resolving a bare name, but subprocess is handed a fully qualified path to a file that exists, and the literal path resolves first. The non-PE bytes then produce the intended ERROR_BAD_EXE_FORMAT, _binary_image_runs rejects the image, and the assertion holds. FileNotFoundError would need the path itself to be absent.

Worth noting the check that matters here is the one you point at indirectly: a green Windows job with the file silently skipped would be a false pass, which is why the job runs with -rs and why I read the summary rather than the conclusion.

copy = Path(probe_dir) / "llama-server.exe"
try:
shutil.copyfile(source, copy)
subprocess.run([str(copy)], capture_output = True, timeout = 30)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject loader failures while vetting the runnable stub

If a copied candidate can be created but terminates with a Windows loader status such as 0xC0000135, subprocess.run returns a CompletedProcess rather than raising, so this probe accepts the bytes despite the helper's promise that they were verified runnable. That is precisely the missing-DLL failure described in the docstring; subsequent healthy fixtures then inherit the broken image and are rejected by _binary_image_runs, making the Windows row fail for the fixture rather than the product. Check the returned status for NTSTATUS loader failures before returning the candidate.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair: the docstring promised the candidate was verified runnable and the code only verified that it started. Fixed in 6cd7207 by checking the status before accepting the bytes.

if probe.returncode >= 0xC0000000:
    continue

In practice the current candidates are System32 tools whose imports are all KnownDLLs, so this has not fired, and the Windows row is green either way. Tightening it anyway because the gap was between the comment and the code, and a future candidate is exactly where that bites.

Comment on lines +70 to +72
# studio-backend-ci runs tests/studio/install on ubuntu only, so the windows
# row here is the sole place the keep path meets a real loader.
- 'tests/studio/install/test_keep_install_backcompat_9979.py'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trigger Windows coverage for imported installer dependencies

The added path filter only triggers for this test file or studio/install_*.py, but the loaded installer directly depends on studio/prebuilt_core.py and studio/backend/utils/prebuilt/llama_backend.py; neither path matches either the pull-request or push filter. A change confined to those dependencies therefore receives only the existing Ubuntu execution from studio-backend-ci.yml, and the new native Windows loader coverage is silently skipped even though those modules supply installer behavior used by this test. Add the imported dependency paths to both filter blocks.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, fixed in 6cd7207. install_llama_prebuilt.py imports both at module scope:

import prebuilt_core as _core  # noqa: E402
from backend.utils.prebuilt.llama_backend import (  # noqa: E402

so a change confined to either would have left this row unrun while still changing what it covers. Both paths added to the pull_request and push blocks.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 6cd7207035

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit d983613 into main Sep 1, 2026
25 of 26 checks passed
@danielhanchen
danielhanchen deleted the ci/keep-install-windows-parity branch September 1, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant