fix(cookbook): reset MLX env vars before each serve run - #6317
Open
Spoofiecus wants to merge 2 commits into
Open
Spoofiecus wants to merge 2 commits into
Spoofiecus wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The cookbook tmux runner now explicitly resets any lingering
MLX_ROOT/MLX_CACHEenvironment variables before each MLX serve run, preventing stale configuration from
leaking into a fresh serve and causing confusing "model not found" errors.
This branch is built on the slice-4 commit (
4b1e38ff, submitted separately asPR #6311), so the GitHub diff versus
devalso contains that PR's platform-awareHuggingFace cache-root fix (macOS
Library/Cachesroot +huggingface_hub.constants.HF_HUB_CACHE).The commit added here (
af4a998b) — the env-reset — is 9 lines emitted intoroutes/cookbook_routes.py's runner script. Once #6311 merges, this PR's effectivediff shrinks to those 9 lines with the test file already in
dev.Target branch
**dev**, notmain. All PRs land indev.Type of Change
Linked Issue
Part of #5978
Checklist
devuvicorn app:app, native venv) and verified the change works; details in How to Test.How to Test
The env-reset is a shell loop emitted into the generated tmux runner script. Verify
emission correctness:
./venv/bin/python -m pytest tests/test_cookbook_mlx_cache_roots.py— 5 passed (validatesthe cache-root resolution this branch carries forward from PR #6311; run after #6311 merges).
./venv/bin/python -m compileall -q app.py core routes src services scripts tests— clean.Live: dev
:7001healthy (env-reset is emitted in the generated runner per launch, no runtimechange); original
:7000untouched.Pre-existing 4-test baseline failures are the workspace baseline (rule 30), unrelated to this diff.
Scope
Diff versus
devshows 21 lines changed inroutes/cookbook_routes.py(12 cache-root linescarried from PR #6311's commit
4b1e38ff+ 9 env-reset lines from this commitaf4a998b)and
tests/test_cookbook_mlx_cache_roots.py(113 lines, also carried from #6311). Bothchanges are within the #5978 MLX-serve-path fix scope. No API, arg-parsing, UI, or
mobile-sheet change.