fix(env): drop stale mise install dirs from mise x/run child PATH#10422
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughCentralizes install-path detection into ChangesStale install dir PATH fix
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Greptile SummaryThis PR fixes a split-brain version resolution issue where a stale mise-managed install dir carried in via a frozen env snapshot (IDE terminal, CI wrapper) stayed ahead of the bin dir
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to filtering mise-managed dirs before PATH construction and all existing PATH-building paths are updated consistently. Every PATH-building site in toolset_env.rs (cached and non-cached) now strips stale install dirs before adding the current toolset bins. The shared helper is a clean extraction with broader coverage, and the regression test directly exercises the broken child-process PATH lookup. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(env): drop stale mise install dirs f..." | Re-trigger Greptile |
`mise x tool@X` / `run` / `env` correctly remap the direct command, but a stale mise-managed install dir left earlier on PATH (e.g. from a frozen env snapshot of a previously activated shell) stayed ahead of the bin dir mise injects, so PATH lookups inside the process tree (subshells, env shebangs, package-manager workers) still resolved the other version -- a split-brain where `node --version` says 22 while the tests actually run on 24. Filter mise-managed install dirs out of the inherited PATH when Toolset composes the child env, so the requested version wins for the whole process tree. Mirrors the hook-env reactivation fix (jdx#10162): share its is_mise_install_path helper (moved to path_env) and extend it to also cover shared/system install dirs (MISE_SHARED_INSTALL_DIRS + the system installs dir) that find_in_shared_installs resolves into. Addresses discussion jdx#10345. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1b2bcd8 to
c9a30a5
Compare
What
mise x tool@X/run/envcorrectly remap the direct command, but a stale mise-managed install dir left earlier on PATH — e.g. carried in from a frozen env snapshot of a previously activated shell (IDE terminals, CI wrappers, AI-agent harnesses) — stayed ahead of the bin dir mise injects. So PATH lookups inside the process tree (subshells,#!/usr/bin/envshebangs, package managers spawning workers) still resolved the other version: a split-brain wherenode --versionsays 22 while the tests actually run on 24.Reported in #10345 (repro with two node versions).
Fix
When
Toolsetcomposes the child environment, filter mise-managed install dirs out of the inherited PATH (mise re-adds the current toolset's bin dirs, so the requested version wins for the whole process tree). Mirrors the hook-env reactivation fix (#10162): itsis_mise_install_pathhelper is moved topath_env, shared, and extended to also cover shared/system install dirs (MISE_SHARED_INSTALL_DIRS+ the system installs dir) thatfind_in_shared_installsresolves into. The install-dir list is computed once per PATH-composition pass to keep the per-entry check cheap (hook-env runs on every prompt).Tests
e2e/cli/test_exec_stale_install_path: withinstalls/dummy/2.0.0/binprepended to PATH,mise x dummy@1.0.0 -- sh -c 'command -v dummy'resolves intoinstalls/dummy/1.0.0, not the stale 2.0.0 dir.Addresses discussion #10345.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
PATH, ensuringmise xselects the requested version instead of being influenced by older remnants.Tests