Skip to content

fix(cookbook): reset MLX env vars before each serve run - #6317

Open
Spoofiecus wants to merge 2 commits into
odysseus-dev:devfrom
Spoofiecus:p4_slice5-mlnx-reset
Open

Spoofiecus wants to merge 2 commits into
odysseus-dev:devfrom
Spoofiecus:p4_slice5-mlnx-reset

Conversation

@Spoofiecus

@Spoofiecus Spoofiecus commented Sep 16, 2026

Copy link
Copy Markdown

Summary

The cookbook tmux runner now explicitly resets any lingering MLX_ROOT/MLX_CACHE
environment 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 as
PR #6311), so the GitHub diff versus dev also contains that PR's platform-aware
HuggingFace cache-root fix (macOS Library/Caches root + huggingface_hub.constants.HF_HUB_CACHE).
The commit added here (af4a998b) — the env-reset — is 9 lines emitted into
routes/cookbook_routes.py's runner script. Once #6311 merges, this PR's effective
diff shrinks to those 9 lines with the test file already in dev.

Target branch

  • This PR targets **dev**, not main. All PRs land in dev.

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)

Linked Issue

Part of #5978

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (uvicorn 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:

grep -n 'Begin MLX env reset' routes/cookbook_routes.py   # the unset loop is present

./venv/bin/python -m pytest tests/test_cookbook_mlx_cache_roots.py — 5 passed (validates
the 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 :7001 healthy (env-reset is emitted in the generated runner per launch, no runtime
change); original :7000 untouched.
Pre-existing 4-test baseline failures are the workspace baseline (rule 30), unrelated to this diff.

Scope

Diff versus dev shows 21 lines changed in routes/cookbook_routes.py (12 cache-root lines
carried from PR #6311's commit 4b1e38ff + 9 env-reset lines from this commit af4a998b)
and tests/test_cookbook_mlx_cache_roots.py (113 lines, also carried from #6311). Both
changes are within the #5978 MLX-serve-path fix scope. No API, arg-parsing, UI, or
mobile-sheet change.

@github-actions github-actions Bot added needs work PR description incomplete — please update before review needs runtime validation Runtime validation not attested — tick the app-run box after running it, or state the gap ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review needs runtime validation Runtime validation not attested — tick the app-run box after running it, or state the gap labels Sep 16, 2026
@Spoofiecus Spoofiecus changed the title P4 slice5 mlnx reset fix(cookbook): reset MLX env vars before each serve run Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant