Skip to content

Studio tests: run the shipped isServedByMlx rule in the auto-load harness - #19121

Merged
danielhanchen merged 1 commit into
mainfrom
ci/autoload-mlx-inference-rule
Nov 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/autoload-mlx-inference-rule

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

Three Studio tests are red on main since #19040 (they fail on Repo tests (CPU, studio) for every PR based on it, for example #18775 and #19110):

  • tests/studio/test_chat_autoload_failure_gate.py::test_a_chat_only_mac_without_mlx_skips_its_cached_mlx_repo
  • tests/studio/test_chat_autoload_failure_gate.py::test_a_chat_only_mac_auto_loads_an_omlx_folder_with_a_plain_name[false-False]
  • tests/studio/test_model_picker_contracts.py::test_cached_non_gguf_rows_get_the_chat_only_platform_gate

Bisected: all three pass on 956e62778b^ and fail on 956e62778b (#19040).

Cause

#19040 is correct. It routes every Chat only MLX gate in chat-adapter.ts through the shared isServedByMlx(isGguf, deviceType, chatOnlyReason, mlxInference), which answers from mlx_inference when the backend reports it.

The tests were behind it:

  • The auto-load harness kept a hand-written isServedByMlx that took three arguments and ignored mlx_inference. A Chat only Mac reporting mlx_inference: false therefore looked like it served MLX, and the scenarios loaded an MLX repo where the shipped code does not.
  • The contract test pinned the old platform.mlxInference === true literal, which Studio: repair MLX on Chat only Macs and offer MLX models exactly where they run #19040 replaced with return platformServesMlx(platform);.

Fix

  • The harness now inlines NO_MLX_REASONS and isServedByMlx from per-model-config.ts as shipped, the same way it already inlines isOtherCacheSnapshot, llamaServerLoadFields and the server-model wait gate. A missing definition fails with a clear message instead of a silent stub.
  • The contract test pins the new shape: the cached-row gate returns platformServesMlx(platform), and that helper calls isServedByMlx(...) with platform.mlxInference.

Verification

  • Both files: 305 passed (were 3 failed on main).
  • Sabotage 1: drop the typeof mlxInference === "boolean" branch from isServedByMlx in per-model-config.ts; the two harness scenarios fail again.
  • Sabotage 2: pass null instead of platform.mlxInference in chat-adapter.ts; the contract test and both scenarios fail.

Tests only; no product code changes.

…ness

#19040 routed every Chat only MLX gate in chat-adapter.ts through
isServedByMlx(..., mlxInference). The auto-load harness kept a hand copy
of isServedByMlx that ignored mlx_inference, and a contract test pinned
the old 'platform.mlxInference === true' literal, so three Studio tests
went red on main. Inline the rule from per-model-config.ts and pin the
new delegation instead of the old literal.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 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-23T17:16:30.655336Z e57ec2f 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. What shall we delve into next?

Reviewed commit: e57ec2fab0

ℹ️ 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 739b756 into main Nov 23, 2026
@danielhanchen
danielhanchen deleted the ci/autoload-mlx-inference-rule branch November 23, 2026 17:53
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