Skip to content

MLX inference stub: answer the _FIRST_USE_WORK import zoo added - #16537

Merged
danielhanchen merged 1 commit into
mainfrom
dh/mlx-stub-first-use-work
Nov 3, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
dh/mlx-stub-first-use-work

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

MLX CI on Mac M1 (the dispatch job) is red for every unsloth PR it runs on since unsloth-zoo #2365 (57b40cc1) landed. It hit #16517 at 08:16Z:

FAILED tests/test_mlx_inference_backend.py::test_the_stub_answers_every_helper_zoo_imports_from_inference
E   AssertionError: zoo imports ['_FIRST_USE_WORK'] from mlx.inference and the stub cannot answer them

zoo #2365 added from .inference import _FIRST_USE_WORK in unsloth_zoo/mlx/speculative.py, a private counter that inference.py defines and bumps. That is internal to zoo and fine. The guard is doing its job: Studio's backend tests replace unsloth_zoo.mlx.inference with a stub, the stub's fallback refuses private names on purpose, and the guard checks that the stub still answers every name zoo imports from that module. Without the entry, a real-model macOS test that reaches zoo's speculative path through the stub would fail with an ImportError.

Change

studio/backend/tests/test_mlx_inference_backend.py: _FIRST_USE_WORK joins PLAIN_HELPERS next to the other private names speculative.py imports (_SparseDrafter, _VERIFY_GDN_MAX_ROWS). The value is a [0] list, the same shape zoo uses. No product code changes.

Testing

Linux, with unsloth-zoo main (682b3108) on the path, tests/test_mlx_inference_backend.py:

result
main test_the_stub_answers_every_helper_zoo_imports_from_inference fails with the error above
this branch it passes

Apart from that test, both sides fail the same 7 cases. All of them need mlx_lm, which only the macOS runner has.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 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-11-03T08:50:38.033854Z b2f4126 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. 🚀

Reviewed commit: b2f4126239

ℹ️ 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 867c424 into main Nov 3, 2026
@danielhanchen
danielhanchen deleted the dh/mlx-stub-first-use-work branch November 3, 2026 08:56
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