Skip to content

Studio: finish the backend CI cleanup #8506 started - #8554

Merged
danielhanchen merged 2 commits into
mainfrom
studio/ci-remaining-reds
Aug 12, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
studio/ci-remaining-reds

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Follow-up to #8506, which cleared most of the Backend CI reds. Two things it left.

test_diffusion_convrot.py was on the same footing as the pre-quant tests

#8506 diagnosed this exactly right: the Backend tests job installs torch and transformers and no torchao, so _register_prequant_safe_globals never meets its floor, every load refuses, and the assertions land on the refusal instead of the loader. It fixed test_diffusion_prequant.py with an autouse stand-in fixture.

test_diffusion_convrot.py loads through the same registration (_load_rotated -> pq) and did not get the fixture, so two of its tests still fail on a runner without torchao:

FAILED tests/test_diffusion_convrot.py::test_loader_installs_the_rotation_the_checkpoint_records
FAILED tests/test_diffusion_convrot.py::test_loader_leaves_a_plain_checkpoint_alone

Rather than copy a 25-line fixture into a second file and let the two drift, the fixture moves to tests/conftest.py without autouse, and each of the two modules opts in with a one-line autouse alias. Every existing use of real_prequant_safe_globals as a named parameter keeps working, and nothing else in the suite picks it up.

The STT cancel timeout is a real 2 second cliff, not a flake

#8506 saw test_pending_load_can_be_cancelled_without_waiting_for_model_lock fail in the same run, could not reproduce it, and set it aside. There is a mechanism.

The cancel path ran two full gc.collect() passes back to back while holding the model lock that wait_for_load_to_settle waits on:

if resident_released:
    self._release_engine_locked()   # collects
_clear_device_cache(device)         # collects again

A whole-suite session ends around 2.7M tracked objects, where a single pass costs about a second, so the load thread's join(timeout = 2) sits right on the edge. Reproduced by inflating the heap: two collects of 1.9s and 1.6s, failing at the same line, passing below the cliff.

_release_engine_locked already collects, and candidate is dropped before it runs, so nothing has become garbage in between. The second call keeps its cache sweep, because the device this load picked need not be the resident's, and skips the collection. The branch where no resident was released is unchanged.

Also here: test_research_runs_hardening.py timed the whole test rather than the cleanup, so it measured runner speed. It now asserts on the sum of the discard waits, which is what "one cleanup bound, not two" actually means.

Verification

The CI condition is torchao being absent, which this host does not reproduce on its own (torchao is installed but only partly importable). Blocking it with a ModuleNotFoundError-raising meta_path finder reproduces the failures exactly.

torchao blocked torchao present
before 2 failed, 123 passed, 1 skipped 125 passed, 1 pre-existing failure
after 125 passed, 1 skipped 125 passed, 1 pre-existing failure

The pre-existing failure in the right-hand column is test_the_registration_floor_needs_a_real_torchao, which fails on main on this host for the same reason and is not touched here.

Affected suites together, torchao blocked: 328 passed, 7 skipped, 1 failed. The one failure is test_decoding_stops_as_soon_as_the_request_is_cancelled, which needs PyAV and fails identically on main here.

The research and STT changes rest on measured mechanism rather than a red-to-green flip I could run locally, since neither failure reproduces on this machine. The research change removes the dependency on runner speed entirely; the STT change removes the 2 second cliff and halves the stall behind it.

danielhanchen and others added 2 commits August 12, 2026 12:26
#8506 fixed the pre-quant allowlist tests but left test_diffusion_convrot.py on the
same footing, and set the STT cancel timeout aside as a flake. Both are addressed here.

The allowlist stand-in moves to conftest so the two files that load through the same
registration share it instead of one carrying a private copy.

The STT cancel path collected twice in a row while holding the model lock that
wait_for_load_to_settle waits on. A long-lived backend reaches millions of tracked
objects, where one pass costs about a second, so the join(timeout = 2) sat on a cliff.
The release already collects and nothing becomes garbage after it, so the second call
keeps its cache sweep and skips the collection.
@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: 2daf59ab8b

ℹ️ 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 b01c8b9 into main Aug 12, 2026
38 of 44 checks passed
@danielhanchen
danielhanchen deleted the studio/ci-remaining-reds branch August 12, 2026 12:52
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