Skip to content

Repair four checks red on main - #14991

Merged
danielhanchen merged 5 commits into
mainfrom
ci-repair-main-reds
Oct 23, 2026
Merged

danielhanchen merged 5 commits into
mainfrom
ci-repair-main-reds

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Four checks fail on main (fd924a5), so every open PR inherits them. Each was reproduced on a clean main worktree and attributed. A fifth, test_every_resolver_probe_forwards_the_trust_decision, was fixed on main by #14990 in the meantime, so this PR takes that version.

Check Introduced by Wrong side Fix
studio/backend/tests/test_text_io_encoding.py::test_text_io_names_its_encoding[_xpu_triton_toolchain.py] #14814 Product The vswhere call used text=True with no encoding, so it decoded with the locale code page. A Visual Studio install path with non-ASCII characters would garble. It now passes -utf8 to vswhere and decodes as UTF-8 (errors="replace").
tests/python/test_accelerator_skip_guards.py::test_no_skip_guard_reads_a_spoofable_accelerator_probe 0947723 Test test_packed_fp32_cuda_parity skipped on torch.cuda.is_available(), which the CPU CI spoof answers True. It is now gated on has_real_cuda(), same as the sibling attention tests.
tests/studio/test_usage_examples_model_source_contract.py::test_examples_never_print_a_hardcoded_model_id #14914 Test #14914 deliberately renders the example with a YOUR_MODEL placeholder when nothing is servable, instead of hiding it. The test still asserted the old "no snippet" shape.
tests/test_fp8_pre_sm89_byte_dequant.py::test_kill_switch_env_is_read_at_import #14936 Test The subprocess imports unsloth in a fresh interpreter that has no conftest spoof, so on CPU CI the import raised "cannot find any torch accelerator" before the switch was read. With no GPU, the subprocess now applies tests/_zoo_aggressive_cuda_spoof.py, the same pattern test_qat_phone_deployment.py uses. It now checks both 0 and 1.

For the third check, the invariant is unchanged: no hardcoded unsloth/... id and no MODEL_FALLBACK. The test now also pins the new contract:

  • the placeholder constant
  • the model ?? MODEL_PLACEHOLDER call as the only buildSnippets call site
  • the no-model note rendering exactly when the placeholder is shown

Verification

  • On main before Fix test_every_resolver_probe_forwards_the_trust_decision on main #14990: 4 failed in tests/ and 1 failed in studio/backend/tests.
  • On this branch: test_accelerator_skip_guards.py, test_usage_examples_model_source_contract.py and test_attention_packed_fp32_routing.py give 48 passed, 1 skipped. With the two new files and test_audio_load_routing.py added, the run gives 94 passed, 133 skipped. test_text_io_encoding.py and test_xpu_triton_toolchain_14807.py give 904 passed.
  • Sabotage check: hardcoding _HIP_FP8_BYTES_DEQUANT = True fails the kill-switch test.
  • Sabotage check: both edits below make the updated contract test fail.
    • Changing the placeholder to "unsloth/Qwen3-4B".
    • Dropping the model ? null : gate on the note.

- _xpu_triton_toolchain: the vswhere call decoded with the locale code page; name UTF-8 and ask vswhere for it (-utf8), which test_text_io_encoding requires.
- test_attention_packed_fp32_routing: gate the CUDA parity test on has_real_cuda(), since torch.cuda.is_available() is spoofed on CPU CI.
- test_usage_examples_model_source_contract: follow #14914, where a null model renders a YOUR_MODEL placeholder under the no-model note instead of hiding the snippet. Keeps the no-hardcoded-id invariant.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T16:41:25.711011Z 3549259 Manual request
ℹ️ 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. Bravo.

Reviewed commit: 7e1d604659

ℹ️ 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".

- loader._resolve_non_vlm_auto_model: name trust_remote_code like its sibling resolvers, so test_every_resolver_probe_forwards_the_trust_decision can see the trust decision reach every class probe (#14945).
- test_kill_switch_env_is_read_at_import: the fresh interpreter had no CUDA spoof, so on CPU CI import unsloth raised before the switch was read (#14936). Install the CI spoof when there is no GPU, and check both values.
@danielhanchen danielhanchen changed the title Repair three checks red on main Repair five checks red on main Oct 23, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen danielhanchen changed the title Repair five checks red on main Repair four checks red on main Oct 23, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 3549259834

ℹ️ 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 7f9576a into main Oct 23, 2026
23 of 35 checks passed
@danielhanchen
danielhanchen deleted the ci-repair-main-reds branch October 23, 2026 16:54
danielhanchen added a commit to unslothai/unsloth-zoo that referenced this pull request Oct 23, 2026
…A router chain (#2042)

In unsloth's `Core zoo (HF=default + TRL=default)` job,
`tests/test_pad_token_resize_not_inference.py::test_pad_token_resize_under_inference_mode_is_trainable`
fails with `RecursionError: maximum recursion depth exceeded`. It
happened on unslothai/unsloth#14941 and again on a staging run of
unslothai/unsloth#14991. The test passes on its own. The traceback
alternates between `_sdpa_maybe_muse_glimmer_banded` and
`_sdpa_maybe_flash_sliding`: the two SDPA routers had ended up wrapping
each other.

## Cause

Each router guards against re-wrapping by reading a sentinel off the
installed `ALL_ATTENTION_FUNCTIONS["sdpa"]` entry. When the Muse Glimmer
router wraps gemma-4's, it copies `_unsloth_gemma4_flash` onto itself,
so gemma-4 still sees its own sentinel on the next pass.

`test_patch_preserves_wrapped_router_sentinels` cleans up with
`vars(mg._sdpa_maybe_muse_glimmer_banded).pop("_unsloth_gemma4_flash",
None)`. That is fine in a fresh process. But when the process has
already installed the real chain (unsloth's import does), it strips the
real sentinel. The next `TEMPORARY_PATCHES` pass then wraps gemma-4
around the Muse Glimmer router while the Muse Glimmer router still wraps
gemma-4, so any SDPA model recurses.

Reproduced locally:
- run `tests/test_muse_glimmer_banded_attention.py`, then a test that
re-runs `patch_gemma4_flash_sliding()` and
`patch_muse_glimmer_banded_sliding_attention()`;
- after that, `gf._ORIG_SDPA[0] is mg._sdpa_maybe_muse_glimmer_banded`
and `mg._ORIG_SDPA[0] is gf._sdpa_maybe_flash_sliding`.

Production does not strip the sentinel, so this is test isolation only.

## Fix

- The sentinel test snapshots the wrapper's attributes and restores them
exactly, instead of popping one.
- New `test_sentinel_test_leaves_a_live_chain_intact`:
1. installs the real chain the way unsloth does, with gemma-4's router
under the Muse Glimmer one;
  2. runs the sentinel test inside it;
  3. runs both patches again, and asserts neither router re-wrapped.

## Verification

- `tests/test_muse_glimmer_banded_attention.py`,
`tests/test_gemma4_flash_sliding.py` and
`tests/test_pad_token_resize_not_inference.py`: 23 passed, 1 skipped.
- The muse-then-repatch sequence above no longer produces a cycle.
- Sabotage check: putting the `pop` back fails the new test.
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