Repository navigation
Fix three CI failures that were not the PRs they failed on - #10896
Conversation
Backend CI's (Python 3.13) leg has been failing intermittently on main and on
five open PRs with `KeyError: 'active'` out of
test_video_shape_validation.py, and Repo tests (CPU) has been failing on PRs
whose diffs touch none of the code involved. Three separate causes, all real,
none of them belonging to the branches that went red.
/video/generate-progress declares VideoGenerateProgressResponse but can return
account_access.hidden_resident_response(), which is {"loaded", "yours"} and has
no `active` at all. FastAPI does not validate a returned Response, so the
declared model is bypassed and a poller reading `active` gets a KeyError rather
than "nothing is running". /images/generate-progress has the same three early
returns. Add hidden_generate_progress_response(), beside the existing
hidden_chat_status_response() that already exists for exactly this reason, and
use it on both progress routes: the response model's own defaults are idle, so
the shape costs no privacy.
What made it fire is routes.video._generation_account, a module global written
by _note_generation_account() and never reset. A multi-account test leaves a
foreign id in it and the next test's poll reads as hidden. Six test files reset
it by hand; every other file was exposed. Reset it once in the backend
conftest, off sys.modules so no test pays an import for it.
Reproduces before this change and passes after:
pytest studio/backend/tests/multi_account \
studio/backend/tests/test_video_shape_validation.py
test_save_lora_without_vllm.py let peft resolve the load device. peft's
infer_device() answers "cuda" whenever torch.cuda.is_available() does, and on a
CPU-only runner that is True because tests/_zoo_aggressive_cuda_spoof.py sets it
so deliberately. The safetensors read then dispatches to a CUDA backend that is
not there and the test dies on aten::empty_strided, naming neither peft nor the
spoof. #10864 fixed the skip guards that read the same probe; this is the other
half, where the library reads it at runtime. Pin the device at the call site,
here and at the one other instance in tests/kaggle, and extend
test_accelerator_skip_guards.py so it scans for the shape rather than only for
skipif decorators.
test_rl_config_pickling.py's config sweep was the only construction in that file
that bypassed its own _make() helper, so on a CPU runner TRL's bf16=None resolved
to True and transformers raised before the assertion about pickling ran. That
error is what the sweep reported when the RL patch fell back, which is the thing
the file is actually about. Route it through _make(), filtered against each
config's declared fields, and front the subclass test with an explicit check that
the patch applied, so a fallback reports the patcher instead of
`assert 'TrainingArguments' == 'SFTConfig'`.
Verified against the full backend suite run the way CI runs it: identical
failure set to main, plus one new passing regression test.
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. |
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
What this is
Three separate CI failures that have been reddening PRs whose diffs touch none of the code involved, plus one that fires on
main. Found while going through the last 40 PRs in this repo and inunsloth-zooto see which red checks were real.None of the three belongs to the branch it failed on.
1.
/video/generate-progressanswers a shape it does not declareBackend CI's
(Python 3.13)leg has failed intermittently onmain(run34789895058, commit9360dcce) and on PRs #10858, #10847, #10837, #10830 and #10864 with:routes/video.pydeclaresresponse_model = VideoGenerateProgressResponse(active: bool = False,phase: Optional[str] = None), but two early returns answeraccount_access.hidden_resident_response(), which isJSONResponse({"loaded": True, "yours": False}). FastAPI does not validate a returnedResponse, so the declared model is bypassed andactiveis simply absent. A poller that reads it gets aKeyErrorrather than "nothing is running", which is what it is entitled to learn either way./images/generate-progresshas the same hazard at three returns.The fix adds
hidden_generate_progress_response()next to the existinghidden_chat_status_response(), which is already there because the chat status shape differs in exactly this way. It returns the response model's own defaults plus the hidden markers, so the shape reveals nothing that theloaded/yourspair did not.What made the gate fire is
routes.video._generation_account, a module global written by_note_generation_account()and never reset. A multi-account test leaves a foreign id in it, and the next test's poll reads as a hidden resident. Six test files reset it by hand; every other file in the suite was exposed. It is now reset once in the backend conftest, read out ofsys.modulesrather than imported, so no test pays aroutes.videoimport it does not need.Reproduces on
mainand passes here:2.
test_save_lora_without_vllm.pyloaded an adapter onto a spoofed CUDARepo tests (CPU)on #10864:The call at
tests/test_save_lora_without_vllm.py:212let PEFT resolve the device.PeftModel.load_adapterfalls back topeft.utils.other.infer_device(), which answers"cuda"for anythingtorch.cuda.is_available()says yes to, and on a CPU-only runner that isTruebecausetests/_zoo_aggressive_cuda_spoof.pysets it so deliberately. The safetensors read then dispatches to a CUDA backend that is not there, and the message names neither PEFT nor the spoof.#10864 rewired 20
skipifguards that read the same probe. This is the other half of the hazard, where library code reads it at runtime rather than at import. The device is now named at the call site, here and at the one other instance intests/kaggle/, andtest_accelerator_skip_guards.pygains a scan for the shape so the next one fails there instead of in safetensors.3.
test_rl_config_pickling.pyreported an accelerator error instead of its own assertionOn #10848, a Studio logging PR:
The underlying cause was fixed on
mainby #10854: a# noqacomment added inunsloth-zoo#1192 broke a literal source anchor,_patch_trl_rl_trainersswallowed theRuntimeErrorinto a warning and returned, andtrl.SFTConfigwas never patched.What is left is that the file described that badly. The config sweep was the only construction in it that bypassed its own
_make()helper, so TRL'sbf16 = Noneresolved toTrueand transformers raised before the assertion about pickling ran. The sweep now goes through_make(), filtered against each config's declared fields since it is handed everytrl.*Configthere is, and the subclass test is fronted with an explicit check that the patch applied, so the next fallback names_patch_trl_rl_trainersrather than the pristine class's base. Same treatment_fake_sft_self()already gives the packing tests.Verification
Backend suite run the way
studio-backend-ci.ymlruns it, againstmainand against this branch:mainIdentical failure set (all pre-existing local dependency gaps,
sqlite-vecandfastmcp), plus one new passing test: the hidden path must still answer the declared shape.Repo tests (CPU)selection: the three failures on this branch's tree are two pre-existingtorchcodecones that also fail onmain.Lint gates run locally:
ruff check,lint_exec_literals.py,lint_duplicate_definitions.py,verify_import_hoist.py --self-test.UI evidence
The route change only touches the account-HIDDEN early returns, so a single-account session never
reaches them and the Images composer must render exactly as it did before. Shot on the PR merge base
and on this branch, same scene, same model (
unsloth/Z-Image-Turbo-GGUF,z-image-turbo-Q4_K_M.gguf),polling
/images/generate-progressthroughout.Mid-generation: the live Stop control in place of Generate, on both sides.
Just after Stop: the green Generate back, on both sides.
Read off the same servers that were photographed, the polled facts agree on both sides:
active=truemid-run,
active=falseonce settled, and the same button text at each shot. No value moved.