Skip to content

Tests: answer the mlx.inference helpers zoo speculative decode imports since unsloth_zoo #2474 - #17686

Merged
danielhanchen merged 1 commit into
mainfrom
fix/mlx-stub-zoo-2474-helpers
Nov 13, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/mlx-stub-zoo-2474-helpers

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

The Studio MLX dispatch job fails on every PR it runs for (seen on the staging run for #17520 and on #17666), because it installs the current unsloth_zoo:

studio/backend/tests/test_mlx_inference_backend.py::test_the_stub_answers_every_helper_zoo_imports_from_inference
E   AssertionError: zoo imports ['_QSA_TRIM_HELD', '_ast_fingerprint', '_bindings_intact', '_resolved_bindings', '_verify_with_lazy_replay'] from mlx.inference and the stub cannot answer them
studio/backend/tests/test_mlx_inference_backend.py::test_the_stub_accepts_every_call_zoo_makes_to_an_inference_helper
E   AttributeError: _resolved_bindings

unslothai/unsloth-zoo#2474 (faster Qwen3.8 Flash Next decode) added a head replay and a lazy verify to unsloth_zoo/mlx/speculative.py, which import five private names from mlx.inference. The zoo change is correct. This test file stands in for unsloth_zoo.mlx.inference with a stub module, and these two tests exist to fail when zoo starts importing something the stub cannot answer. That is what happened, so the stub needs the new names.

Reproduced with zoo main on PYTHONPATH: both tests fail on main.

Change

studio/backend/tests/test_mlx_inference_backend.py:

  • _QSA_TRIM_HELD joins PLAIN_HELPERS as an empty list (no QSA cache trims are held), next to _FIRST_USE_WORK and the other private names zoo's speculative.py reads.
  • _ast_fingerprint, _bindings_intact, _resolved_bindings and _verify_with_lazy_replay join NEUTRAL_PLAIN_HELPERS as one _no_replay stub that accepts any call and returns None. Their zoo bodies need Metal and a QSA cache, so, like _unless_failed_buffer, they get a do-nothing answer. Putting them in PLAIN_HELPERS would not work, because that table's entries must copy zoo's bodies exactly (test_each_plain_helper_stub_matches_zoos_body).

Test-only change. Extra names in the stub do not affect an older unsloth_zoo.

Testing

Linux, zoo main on PYTHONPATH, the stub and helper tests (-k "stub or plain_helper or unknown_zoo_helper"):

  • main: 2 failed, 10 passed, 1 skipped
  • this branch: 12 passed, 1 skipped (the skip needs mlx_lm)

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T16:10:08.955969Z 1400118 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. Swish!

Reviewed commit: 1400118b7e

ℹ️ 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 c07cb25 into main Nov 13, 2026
@danielhanchen
danielhanchen deleted the fix/mlx-stub-zoo-2474-helpers branch November 13, 2026 16:12
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