Repository navigation
CI: run the multi-rank Repo tests shards only when what they import changes - #19127
Merged
Merged
Conversation
…hanges The seven fsdp2 / gloo shards of Backend CI's Repo tests (CPU) import unsloth, torch and sibling test modules, not studio, but Backend CI's path list matched 98.8% of main's commits since 2026-10-01, so every Studio PR queued and ran them. They move unchanged into distributed-cpu-ci.yml, whose paths are their import closure (unsloth/**, the multi-rank test files and the siblings they import, tests/_*.py, tests/_shared/**, the conftest, pyproject, the requirements and install inputs): 22.9% of those commits. A nightly run keeps catching unsloth_zoo main drift, which no path can see. Same check names, steps, install, timeouts and concurrency contract. The pip cache is borrowed read-only from Backend CI's repo-cpu-tests entry. The union of collected node IDs over all shards is unchanged (46,711, identical per shard). The shard guard reads both matrices and now also checks that the new workflow's paths cover every tests/ file its shards import, that push and PR paths match, and that the moved step and install are identical.
Codex Review Summary: ❌ FailedThis 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. |
danielhanchen
added a commit
that referenced
this pull request
Nov 23, 2026
…19135) ## Problem `tests/test_runtime_text_encoding.py::test_shipping_code_names_an_encoding` is red on `main` in `Repo tests (CPU, rest)`, for example on #19122 and #19127: ``` 4 text read/write call sites in shipping code let the operator's locale decide the encoding 'unsloth/models/inkling2.py:364: open()' 'unsloth/models/inkling2.py:532: open()' 'unsloth/models/inkling2.py:537: open()' 'unsloth/models/inkling2.py:545: open()' ``` ## Cause The guard is right; the new code is wrong. #19016 (Inkling 2 merged 16-bit save and GGUF export) added four text-mode `open()` calls with no encoding: - reading `model.safetensors.index.json` (`index_path`); - writing the merged index; - reading `config.json`; - writing `config.json`. On Windows, Python uses the locale code page there. A config or index with a non-ASCII byte then fails to load, or is written in a codec the next reader does not expect. The guard has been in the repo since October; the lines all come from `c69ffd79be`. ## Fix Pass `encoding = "utf-8"` on all four calls in `unsloth/models/inkling2.py`. Nothing else changes: the JSON written is the same on a UTF-8 host. ## Verification - `tests/test_runtime_text_encoding.py`: 9 passed (`main`: 1 failed, listing exactly these four sites). - `tests/test_inkling2_support.py` on transformers 5.24.0, including the merged-save tests: 42 passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backend CI's seven multi-rank Repo tests shards (fsdp2, fsdp2-native, gloo, gloo-tp-env, gloo-cp, gloo-tp, gloo-pp) are about 342k of the roughly 1.77M runner minutes in the last Actions usage export, and each queues for about two hours first. They run on almost every PR because Backend CI's path list is broad. But they import only
unsloth.*, torch and sibling test helpers: of 5,593 non-merge commits onmainsince 2026-10-01, 98.8% trigger Backend CI and 22.9% touch anything these tests read.Change
.github/workflows/distributed-cpu-ci.yml: the seven shards moved verbatim. That includes selections,workers: 2on gloo-cp, check names (Repo tests (CPU, <shard>)), install and ruff steps, the pytest step, timeouts, runner, concurrency group and cancel rule. It borrowsrepo-cpu-tests' pip cache read-only.unsloth/**, the multi-rank test files and the five sibling modules they import,tests/_*.py,tests/_shared/**,tests/conftest.py,pyproject.toml,studio/backend/requirements/**, the install inputs, the two local actions it uses and the workflow itself.mainand no path filter can see that.studio-backend-ci.ymlkeeps studio-install, studio, rest and rest-2, and lists the new workflow in its paths so the shard-layout guards run when it changes.tests/test_ci_repo_cpu_shards.pyreads both matrices and checks that the moved steps stay identical, that every test file the moved shards import matches a path, that push and PR paths agree, and that the schedule exists.test_backend_ci_parallel_isolation.pyscans both workflows, so its 16 parallel and 11 repo-root counts are unchanged.test_pip_cache_naming.pyandtest_cache_budget_discipline.pylist the new read-only borrower.mainhas no required status checks, so a skipped workflow blocks nothing.Results
main: no shard loses an ID (old 11 shards 46,740, new 4 + 7 shards 46,763). The 23 extra IDs are this PR's 6 new guards and workflow-scanning tests that gain one parametrized case for the new workflow file.studioshard, and a subprocess timeout in a gloo test in the Python 3.13 diffusion shard).tests/_shared/**andtests/test_tp_*.pyfrom the paths fails 2 guard tests, deleting the gloo-pp shard fails the dropped-file test, and removing a shard from the new workflow fails the isolation guard.test_cached_paths_hold_no_credentials, 2 intest_save_mtp_head_stitch.py, and a collection error intest_rocm_support.py.