Skip to content

MLX diffusion backend: decode the sysctl chip name as UTF-8 - #13430

Merged
danielhanchen merged 1 commit into
mainfrom
ci-mlx-diffusion-subprocess-encoding
Oct 12, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-mlx-diffusion-subprocess-encoding

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

studio/backend/tests/test_text_io_encoding.py::test_text_io_names_its_encoding[mlx_diffusion_backend.py] fails on main since #13379 (opt-in MLX image engine). It also shows up on unrelated PRs such as #13425:

mlx_diffusion_backend.py:137: subprocess(text = True) without encoding

_chip_name() reads sysctl -n machdep.cpu.brand_string with text = True and no encoding. That path only runs on macOS, but the guard's point stands: under a C or POSIX locale the default decoder is ASCII, and the test deliberately does not exempt platform-specific paths. The guard is right; the new call just missed the convention.

Fix

  • Pass encoding = "utf-8", errors = "replace" to that subprocess.run, the same as the other inference subprocess calls (diffusion_attention.py, diffusion_nvfp4_install.py, audio_cpp_server.py).
  • Apply the repo's ruff-format-with-kwargs hook to the file. It also wraps one over-long if not all(...) line from Studio: opt-in MLX image engine for Apple Silicon (Z-Image) #13379, with no behaviour change.

Verification

main this PR
tests/test_text_io_encoding.py 1 failed, 749 passed 750 passed
tests/test_text_io_encoding.py tests/test_mlx_diffusion_backend.py 825 passed

#13379 added a subprocess.run(text=True) with no encoding in _chip_name, which test_text_io_encoding flags on main (it would fall back to the locale codec under a C/POSIX locale). Pass encoding='utf-8', errors='replace' like the other inference subprocess calls, and apply the formatter hook to the file.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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 🔄 Running since 2026-10-12T14:01:12.732206Z fa13ee8 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. Hooray!

Reviewed commit: fa13ee844d

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

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 12, 2026
@danielhanchen
danielhanchen merged commit 465aef8 into main Oct 12, 2026
@danielhanchen
danielhanchen deleted the ci-mlx-diffusion-subprocess-encoding branch October 12, 2026 14:08
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