Skip to content

Fix main's red CI after #13806, #13899 and recent formatter drift - #13909

Merged
danielhanchen merged 1 commit into
mainfrom
ci-main-red-after-13899
Oct 15, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-main-red-after-13899

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

With #13846 merged, main (d303bac) is still red in Backend CI and Repo tests, from three regressions that landed in the last few hours. Each is reproduced locally on main and fixed here.

1. test_text_io_names_its_encoding[drafter.py] (from #13806)

drafter.py:222: subprocess(text = True) without encoding

core/training/drafter.py runs the drafter capability probe in a child interpreter with text = True and no encoding, so the parent decodes the child's output with the locale codec (cp1252 on Windows, ASCII under a C locale). The guard is right and the code is what changes: the call now passes encoding = "utf-8", errors = "replace", and the child gets PYTHONIOENCODING=utf-8 so it writes what the parent reads. That matches how core/training/worker.py runs its own probes. The payload line is json.dumps output, so nothing parsed changes.

2. test_backfill_splits_a_quant_suffix_the_way_the_backend_does (from #13899)

AssertionError: MXFP

#13899 widened the GGUF known-quant pattern from MXFP... to (?:MX|NV)FP... so NVFP4 files get their own variant key. That change is right, and it was made consistently in all three places that must agree: core/inference/llama_cpp.py (_GGUF_KNOWN_QUANT_RE), hub/utils/gguf.py (_GGUF_QUANT_RE) and the frontend's model-identity.ts (QUANT_TOKEN_SOURCE). The test was checking that the literal substring MXFP appears in llama_cpp.py, which it no longer does.

The test now checks the property it was standing in for: it reads the pattern string out of both Python modules with ast (adjacent literals joined as Python joins them) and the TypeScript constant, asserts all three are identical, and asserts the shared pattern still fully matches MXFP4, NVFP4, IQ4_XS, TQ1_0, Q4_K_M, Q8_0, BF16, F16 and F32. That is stricter than before, since a pattern edited on one side only now fails, and it no longer breaks on a correct rewording.

3. test_every_tracked_python_file_is_already_formatted

Formatter drift (pinned ruff 0.6.9 via scripts/run_ruff_format.py), output only, no logic change:

file from
studio/backend/core/inference/llama_cpp.py, offload_layout.py, tests/test_nemotron35_bolt_super.py, tests/test_nemotron35_planner.py #13899
studio/backend/tests/test_muse_spark.py #13903
tests/test_norm_fast_launch.py, unsloth/kernels/layernorm.py #13889
tests/test_remote_code_class_and_expert_submodules.py, unsloth/models/_utils.py #13851
tests/test_triton_fp_fusion.py #13846

Verification

  • tests/test_formatter_fixed_point.py (ruff 0.6.9): fails on main, 16 passed here.
  • tests/studio/test_model_picker_contracts.py and tests/test_runtime_text_encoding.py: 210 passed.
  • studio/backend/tests/test_text_io_encoding.py, test_nemotron35_bolt_super.py, test_drafter_training.py: all pass except test_capability_child_process_runs_for_real, which fails identically on main without this change on this host (it runs the probe in a real child interpreter) and is not failing in CI.
  • Sabotage on the rewritten picker guard: dropping NV from the pattern in hub/utils/gguf.py only, or in model-identity.ts only, fails it; restored, it passes.
  • Sabotage for (1) is main itself: without the encoding, the guard fails as quoted above.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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-10-15T18:25:19.896450Z d4ba1da Manual request
🔒 Security Review ⚠️ Failed 2026-10-15T18:23:36.192270Z d4ba1da 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: d4ba1dab61

ℹ️ 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 5e55110 into main Oct 15, 2026
@danielhanchen
danielhanchen deleted the ci-main-red-after-13899 branch October 15, 2026 18:29
danielhanchen added a commit that referenced this pull request Oct 15, 2026
…13922)

`(Python 3.13, rest)` is red on main since #13806 (1be7795),
including on #13909's own run:

```
FAILED studio/backend/tests/test_tensor_parallel.py::test_mtp_decode_probe_wired_under_tensor_parallel
AssertionError: the probe must precede the drafter-drop fallback
```

#13806 is right. It made an EAGLE-3 drafter droppable on a failed load
like the others, so the fallback in `LlamaCppBackend.load_model` became

```python
if (
    not healthy
    and (
        _spec_requested_mtp
        or _spec_requested_dspark
        or _spec_requested_dflash
        or _spec_requested_eagle3
    )
    and not _load_cancelled()
):
```

The test located that block with `src.find("and (_spec_requested_mtp or
_spec_requested_dspark or _spec_requested_dflash)")`, the old one-line
spelling. After the change `find` returns -1, so `0 <= probe < fallback`
fails even though the probe still comes first. The ordering it guards is
intact.

The test now finds the fallback by its shape: `not healthy and (`
followed by the `_spec_requested_mtp or _spec_requested_dspark ...
_spec_requested_dflash` alternatives, whitespace and line breaks
allowed, so adding another drafter kind or rewrapping does not break it.
If no such block exists it fails with its own message (`load_model no
longer has a drafter-drop fallback for MTP`) rather than reporting a
misleading order failure.

Verification:
- `studio/backend/tests/test_tensor_parallel.py`: fails on main as
above, 111 passed with this change.
- Sabotage, `_spec_requested_dflash` removed from the fallback in
`llama_cpp.py`: fails with `load_model no longer has a drafter-drop
fallback for MTP`.
- Sabotage, the fallback block moved ahead of the probe in the source
the test reads: fails with `the probe must precede the drafter-drop
fallback`.
- `tests/test_formatter_fixed_point.py`: passes.
danielhanchen added a commit that referenced this pull request Oct 15, 2026
Main (bd06376) is red in Backend CI on five tests, seen on every PR
based on it (#13914, #13919). Four come from #13850 and #13806, which
are both right; one comes from my own #13909. Each is reproduced locally
on main and fixed here.

## From #13850 (token preview)

**`test_every_long_lived_spawner_consults_the_shutdown_latch`**:
`core/training/token_preview.py` adopts its worker with `adopt_pid` but
was in neither the gated nor the not-gated set. It already checks
`is_process_shutting_down()` before spawning, so it belongs with the
gated spawners, but a gated spawner also has to recheck after adopting:
a quit that lands between the check and `adopt_pid` happens after the
shutdown sweep took its snapshot, and the worker would outlive it.
`_spawn_locked` now rechecks right after adopting, and if the latch is
set it stops the new worker and raises `TokenPreviewError("Unsloth is
shutting down.")`, the same message `_start_locked` uses. The module
goes into the gated set.

New test `test_a_quit_that_races_the_spawn_reaps_the_new_worker` drives
that race: the latch flips inside `Process.start()`, and the worker must
be stopped and the call refused.

**`test_the_dataset_format_check_installs_the_decoder`**:
`check_format_response` now reads its rows through `load_preview_slice`,
which calls `ensure_audio_decoding()` before any tier, so the wiring is
intact. The test only read `check_format_response`'s own source. It now
checks that `check_format_response` reads through `load_preview_slice`,
and that `load_preview_slice` installs the decoder before its first read
(`resolve_dataset_path(` / `load_dataset(`), which also pins the
ordering the old form never checked.

**`test_the_subprocess_tokenizes_and_masks_typed_text`**: the
completion-masking half imports unsloth in the worker, as training does,
and Backend CI has torch but no `unsloth_zoo` (`Unsloth: Please install
unsloth_zoo via pip install unsloth_zoo then retry!`). The test skipped
only when torch was missing; it now also skips when `unsloth_zoo` is not
importable. The plain tokenization half still runs everywhere.

## From #13806 (drafter training)

**`test_owner_training_start_status_cancel_bytes_are_unchanged`**: the
training status details gained `"drafter": null`. The test pins the
exact status bytes on purpose, so a new field is a deliberate, one-line
update to the expected dict.

## From #13909 (mine)

**`test_python_children_are_told_to_emit_utf8`**: #13909 made the
drafter capability probe decode its child as UTF-8 but set
`PYTHONIOENCODING` on its own line, while this guard requires the child
env to go through `utf8_child_env()` at the call site. The probe now
passes `env = utf8_child_env(env)`, which sets the same variable through
the shared helper.

## Verification

- `test_audio_dataset_decode.py`, `test_chat_text_encoding.py`,
`test_job_accounts.py`, `test_orchestrator_unload_cancel.py`,
`test_token_preview.py`, `test_text_io_encoding.py`,
`test_drafter_training.py`: 1144 passed. One failure,
`test_capability_child_process_runs_for_real`, fails identically on main
on this host (it runs the probe in a real child interpreter) and is not
failing in CI.
- Without `unsloth_zoo` importable: the token preview real-worker test
tokenizes, then skips the masking half with its reason.
- Sabotage, the post-adopt recheck removed: the spawner-set guard fails
(`never rechecks the latch after adopting`) and the new race test fails
(`DID NOT RAISE TokenPreviewError`).
- Sabotage, `ensure_audio_decoding()` moved after
`resolve_dataset_path(` in `load_preview_slice`: the decoder test fails
(`the decoder must be installed before the first row is read`).
- `tests/test_formatter_fixed_point.py`: passes.
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