Skip to content

Give Repo tests (CPU) a budget it fits in, and name the patcher when it falls back - #10862

Merged
danielhanchen merged 1 commit into
mainfrom
ci-unblock-repo-tests-timeout
Sep 13, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-unblock-repo-tests-timeout

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Why

I went through the failing checks on the last 30 PRs of unsloth and unsloth-zoo and 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.

Cause Blast radius Verdict
SFT patch fell back silently (zoo #1192 vs the source anchor) 5 PRs, 16 failures in 5 files fixed by #10854, those runs just predate it
Stale base on unsloth-zoo #1190 / #1191 2 PRs fixed by zoo #1192, a merge from main clears it
Repo tests (CPU) does not fit in timeout-minutes: 30 #10849, #10861, and any run that draws a slow runner the budget was wrong

Only 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) carried timeout-minutes: 30 under a comment claiming the job measured 13.4 minutes. It does not. Across the last 40 runs of this job on main:

pytest step surrounding steps total
fastest 852s ~351s ~20.1 min
slowest 1683s ~351s ~33.9 min

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 pytest job 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 4 over the whole discovered set, the tail is test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding at 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 the pytest job settled on against its own tail.
  • timeout --signal=INT --kill-after=60 2100 around the session, because --timeout arms 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-timeout joins 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.py has three tests that call SFTTrainer._prepare_dataset unbound, passing a SimpleNamespace as self. That is fine against the patched implementation, which reads data_collator and nothing else. It 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 cases 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, and nothing in that message points at the one cause. _fake_sft_self() asserts the patch applied first, so they now say:

trl.SFTTrainer is 'SFTTrainer', so Unsloth's SFT patch did not apply and these
tests would be exercising TRL's _prepare_dataset instead of the patched one.
`import unsloth` reports the cause as a warning ('Could not build the patched
trl.trainer.sft_trainer'), not an error.

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. 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 Core on all three HF/TRL pins, Repo tests (CPU) and GRPO fake-run. Sixteen failures presenting four different ways:

Presented as File
AttributeError: ... no attribute '_is_vlm' tests/utils/test_packing.py
ValueError: Your setup doesn't support bf16/gpu tests/test_warnings_issued_guard.py, tests/python/test_rl_config_pickling.py
assert base.__name__ == "SFTConfig" got _BaseConfig tests/python/test_rl_config_pickling.py
SFT patch did not apply four tests/version_compat/ files

All one cause, and #10854 fixed it. Checked in both directions rather than assumed: on current main those files are 216 passed, 4 skipped; in a worktree at fc6694816, 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 main is green. #1191 and #1190 fail Source lint on the 13 ruff E9,F63,F7,F82 findings that zoo #1192 cleared. Reproduced locally on both branches, and confirmed that merging current main into either one makes the lint pass. Stale base, nothing to fix.

Checks

  • tests/utils/test_packing.py on main: 62 passed, 2 skipped.
  • Same file against fc6694816: the same four cases fail, now naming the patcher.
  • --timeout=330 over the five slowest files in the discovered set: 143 passed, no spurious kills, including test_probe_timeouts.py and test_a_child_that_never_returns_does_not_hang_the_installer, which hang on purpose.
  • scripts/lint_workflow_triggers.py: OK, 47 workflow files.
  • ruff check and the pinned ruff-format-with-kwargs hook on the touched test file: clean, and a fixed point.

…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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 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-13T11:29:16.749144Z da07e74 PR opened
🔒 Security Review ✅ Completed 2026-09-13T11:32:11.539057Z da07e74 PR opened
ℹ️ 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.

@danielhanchen
danielhanchen merged commit ed64d90 into main Sep 13, 2026
16 checks passed
@danielhanchen
danielhanchen deleted the ci-unblock-repo-tests-timeout branch September 13, 2026 12:10
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