Repository navigation
Give Repo tests (CPU) a budget it fits in, and name the patcher when it falls back - #10862
Merged
Merged
Conversation
…it falls back Repo tests (CPU) carried timeout-minutes: 30 under a comment claiming the job measured 13.4 minutes. Across the last 40 runs of it on main the pytest step alone measures 852s to 1683s, and the install plus the four steps after it add a further 351s, so the worst measured run needs 33.9 minutes. Run 0eedeee passed at 1738s, 62 seconds under the cap. Which run loses is a property of the runner, not of the PR. #10849 and #10861 were both cancelled at 30m1x against a green main, on branches that touch none of this. The cap also fires mid-step, so the run blames whichever step was unlucky. On both of those it was "Shell installer tests", 84s in and unrelated, and the shell, CLI and Docker steps never ran at all, so those PRs silently lost that coverage too. Raised to 45, which is what the backend pytest job in this same file already uses after the identical failure mode. A backstop is only worth raising if something below it can still name a hang, so this picks up that job's other two guards, with numbers measured from this suite rather than copied: --timeout=330 against a tail of 63.6s, 48.3s and a run of ~31s cases (this step is ~2.2x slower on a 4-vCPU runner than on the box that measured them, so the worst legitimate test is ~140s and the cap is ~2.4x that), and an outer timeout --signal=INT --kill-after=60 2100, which is 1.25x the worst of the 40 runs and still lands 4 minutes under the job cap. Separately, tests/utils/test_packing.py now routes its three unbound _prepare_dataset tests through _fake_sft_self(). They pass a SimpleNamespace as self, which is fine against the patched implementation (it reads data_collator and nothing else) and is not fine against TRL's own, which reaches for self._is_vlm. So when the SFT patch silently falls back, as it did between unsloth-zoo #1192 and #10854, all four report AttributeError: 'types.SimpleNamespace' object has no attribute '_is_vlm' which names the fake object and not the patcher. Those four were the loudest of 16 failures across five files that all had the one cause. They now assert the patch applied first and say so. Padding the namespace out with _is_vlm would be worse than the AttributeError: the tests would then quietly pass against TRL's trainer and assert nothing about Unsloth's. Checked both directions. On main tests/utils/test_packing.py is 62 passed, 2 skipped. Against fc66948, the commit before #10854, the same four fail with "trl.SFTTrainer is 'SFTTrainer', so Unsloth's SFT patch did not apply". The --timeout=330 flag was run over the five slowest files in the discovered set: 143 passed, no spurious kills, including the tests that deliberately hang.
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. |
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.
Why
I went through the failing checks on the last 30 PRs of
unslothandunsloth-zooand grouped them by root cause. 64 failing jobs, three causes. Two of them are already fixed and need nothing from this PR; the third is this one.unsloth-zoo#1190 / #1191Repo tests (CPU)does not fit intimeout-minutes: 30Only the third needed a change. The other two are written up below because "already fixed" is a claim worth checking rather than asserting.
1. The timeout
Repo tests (CPU)carriedtimeout-minutes: 30under a comment claiming the job measured 13.4 minutes. It does not. Across the last 40 runs of this job onmain:So the cap sat inside the measured spread rather than above it. The clearest single run is
0eedeeeb, which passed, at 1738s: 62 seconds of margin on a green main.Which run loses is therefore a property of the runner, not of the PR. #10849 and #10861 were both cancelled at 30m1x against a green main, on branches that touch none of this.
A cancelled job is also worse than a slow one, twice over. The cap fires mid-step, so the run blames whichever step was unlucky. On both of those it was
Shell installer tests, 84s in and unrelated to anything. And the shell, CLI and Docker steps after it never ran, so those two PRs silently lost that coverage as well as gaining a red check.Raised to 45, which is what the
pytestjob in this same file already uses after the identical failure mode. Its comment makes the point that a raised cap "reports the word cancelled and names nothing", so this picks up its other two guards as well, with numbers measured from this suite rather than copied across:--timeout=330. Measured under-n 4over the whole discovered set, the tail istest_source_read_encoding.py::test_checked_in_file_reads_name_an_encodingat 63.6s, then 48.3s, then a run of ~31s docker-notebook durability cases. This step runs ~2.2x slower on a 4-vCPU runner than on the box those came off, so the worst legitimate test is ~140s and the cap is ~2.4x that. It is also the same 330 thepytestjob settled on against its own tail.timeout --signal=INT --kill-after=60 2100around the session, because--timeoutarms inside each xdist worker and a wedged controller escapes it. 2100s is 1.25x the worst of the 40 runs above, and 2100 + 351 still lands 4 minutes under the job cap, so this fires first and says where it was stuck.pytest-timeoutjoins this job's install line for the same reason it is on the other one.2. Naming the patcher instead of the fake object
tests/utils/test_packing.pyhas three tests that callSFTTrainer._prepare_datasetunbound, passing aSimpleNamespaceasself. That is fine against the patched implementation, which readsdata_collatorand nothing else. It is not fine against TRL's own, which reaches forself._is_vlm.So when the SFT patch silently falls back, as it did between unsloth-zoo #1192 and #10854, all four cases report:
which names the fake object and not the patcher. Those four were the loudest of 16 failures across five files that all had the one cause, and nothing in that message points at the one cause.
_fake_sft_self()asserts the patch applied first, so they now say:Padding the namespace out with
_is_vlmwould be worse than the AttributeError: the tests would then quietly pass against TRL's trainer and assert nothing about Unsloth's. The point of the assertion is that it is the failure, not a workaround for it.The two causes that needed no change
The five PRs reddened by the SFT fallback. #10841, #10842, #10847, #10848 and #10850 were red across
Coreon all three HF/TRL pins,Repo tests (CPU)andGRPO fake-run. Sixteen failures presenting four different ways:AttributeError: ... no attribute '_is_vlm'tests/utils/test_packing.pyValueError: Your setup doesn't support bf16/gputests/test_warnings_issued_guard.py,tests/python/test_rl_config_pickling.pyassert base.__name__ == "SFTConfig"got_BaseConfigtests/python/test_rl_config_pickling.pySFT patch did not applytests/version_compat/filesAll one cause, and #10854 fixed it. Checked in both directions rather than assumed: on current
mainthose files are 216 passed, 4 skipped; in a worktree atfc6694816, the commit before #10854, they reproduce the CI failures verbatim. Every one of those five runs started before #10854 merged. They need a re-run, not a fix.Worth stating plainly, since the question is asked each time: neither the PRs nor the tests were wrong here. The tests caught a real regression in unsloth, correctly, and by name in the suites that name it.
unsloth-zoo. The newest failure in its last 30 PRs is 09-10 and
mainis green. #1191 and #1190 failSource linton the 13 ruffE9,F63,F7,F82findings that zoo #1192 cleared. Reproduced locally on both branches, and confirmed that merging currentmaininto either one makes the lint pass. Stale base, nothing to fix.Checks
tests/utils/test_packing.pyonmain: 62 passed, 2 skipped.fc6694816: the same four cases fail, now naming the patcher.--timeout=330over the five slowest files in the discovered set: 143 passed, no spurious kills, includingtest_probe_timeouts.pyandtest_a_child_that_never_returns_does_not_hang_the_installer, which hang on purpose.scripts/lint_workflow_triggers.py: OK, 47 workflow files.ruff checkand the pinnedruff-format-with-kwargshook on the touched test file: clean, and a fixed point.