fix(upgrade): don't force-reinstall already installed versions#8282
fix(upgrade): don't force-reinstall already installed versions#8282
Conversation
Summary of ChangesHello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request correctly addresses the issue where mise upgrade was unnecessarily re-downloading already installed tool versions. By setting force: false in the upgrade command's install options, the tool now respects existing installations. Additionally, the fix in is_version_installed for Prefix tool requests ensures that a partial match on disk (e.g., version 1.0.0 for prefix 1) does not falsely prevent the installation of a newer resolved version (e.g., 1.1.0). The added end-to-end test provides solid verification for these changes.
src/backend/mod.rs
Outdated
| if let ToolRequest::Prefix { .. } = &tv.request { | ||
| if install_path | ||
| .file_name() | ||
| .map_or(false, |f| f.to_string_lossy() != tv.version) |
There was a problem hiding this comment.
For a minor efficiency improvement, you can compare the OsStr directly with the String (or &str) to avoid the to_string_lossy() allocation and conversion. OsStr implements PartialEq<String> and PartialEq<str>.
| .map_or(false, |f| f.to_string_lossy() != tv.version) | |
| .map_or(false, |f| f != tv.version.as_str()) |
There was a problem hiding this comment.
Pull request overview
This PR fixes mise upgrade to avoid unnecessarily re-downloading versions that are already installed. Previously, the command used force: true, which caused reinstalls even when the target version existed on disk. Additionally, it corrects a bug in is_version_installed where Prefix tool requests (e.g., prefix:1) would incorrectly report a version as installed when only an older matching prefix was present.
Changes:
- Removed
force: truefrom upgrade install options to prevent unnecessary reinstalls - Added version verification in
is_version_installedfor Prefix requests to ensure the resolved version matches the installed version - Added e2e test case verifying that already-installed versions are not re-downloaded during upgrade
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/cli/upgrade.rs | Changed force: true to force: false to prevent reinstalling already-installed versions |
| src/backend/mod.rs | Added version check for Prefix requests to verify resolved version matches installed version |
| e2e/cli/test_upgrade | Added test case verifying upgrade skips re-downloading already-installed versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if let ToolRequest::Prefix { .. } = &tv.request | ||
| && install_path | ||
| .file_name() | ||
| .is_some_and(|f| f.to_string_lossy() != tv.version) |
There was a problem hiding this comment.
The condition checks if the file name differs from tv.version, but the logic would be clearer if extracted into a helper function or if the comment more explicitly stated what a mismatch indicates (i.e., that the installed version is older/different than the resolved version).
`mise upgrade` was using `force: true` in install options, causing it to uninstall and re-download tool versions even when the target version was already installed. This was a known issue (marked with a TODO comment). The root cause was that `is_version_installed` for Prefix tool requests (e.g., `prefix:1`) would match ANY installed directory with that prefix (finding `1.0.0`) even when the resolved version was different (`1.1.0`). With `force: true` this accidentally worked by uninstalling the found version first, but with `force: false` it caused a false "already installed" early return, skipping the actual install entirely. Fix both issues: - Set `force: false` in upgrade install options to avoid unnecessary re-downloads - Fix `is_version_installed` to verify the exact resolved version for Prefix requests, falling back to the exact version path check when the prefix match doesn't match the resolved version Closes #8260 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
88b1a78 to
2ebaabf
Compare
|
bugbot run |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.17 x -- echo |
21.7 ± 0.2 | 21.2 | 24.3 | 1.00 |
mise x -- echo |
22.6 ± 0.2 | 22.2 | 24.0 | 1.04 ± 0.02 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.17 env |
21.4 ± 0.6 | 20.8 | 27.9 | 1.00 |
mise env |
21.5 ± 0.4 | 21.1 | 26.2 | 1.01 ± 0.03 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.17 hook-env |
21.9 ± 0.3 | 21.5 | 25.7 | 1.00 |
mise hook-env |
22.1 ± 0.2 | 21.6 | 23.2 | 1.01 ± 0.02 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.17 ls |
19.5 ± 0.2 | 19.1 | 22.0 | 1.00 |
mise ls |
19.7 ± 0.2 | 19.3 | 20.8 | 1.01 ± 0.01 |
xtasks/test/perf
| Command | mise-2026.2.17 | mise | Variance |
|---|---|---|---|
| install (cached) | 122ms | 122ms | +0% |
| ls (cached) | 74ms | 74ms | +0% |
| bin-paths (cached) | 79ms | 78ms | +1% |
| task-ls (cached) | 806ms | 804ms | +0% |
### 🚀 Features - **(install)** auto-lock all platforms after tool installation by @jdx in [#8277](#8277) ### 🐛 Bug Fixes - **(config)** respect --yes flag for config trust prompts by @jdx in [#8288](#8288) - **(exec)** strip shims from PATH on Unix to prevent infinite recursion by @jdx in [#8276](#8276) - **(install)** validate --locked before --dry-run short-circuit by @altendky in [#8290](#8290) - **(release)** refresh PATH after mise up in release-plz by @jdx in [#8292](#8292) - **(schema)** replace unevaluatedProperties with additionalProperties by @jdx in [#8285](#8285) - **(task)** avoid duplicated stderr on task failure in replacing mode by @jdx in [#8275](#8275) - **(task)** use process groups to kill child process trees on Unix by @jdx in [#8279](#8279) - **(task)** run depends_post tasks even when parent task fails by @jdx in [#8274](#8274) - **(task)** suggest similar commands when mistyping a CLI subcommand by @jdx in [#8286](#8286) - **(task)** execute monorepo subdirectory prepare steps from root by @jdx in [#8291](#8291) - **(upgrade)** don't force-reinstall already installed versions by @jdx in [#8282](#8282) - **(watch)** restore terminal state after watchexec exits by @jdx in [#8273](#8273) ### 📚 Documentation - clarify that MISE_CEILING_PATHS excludes the ceiling directory itself by @jdx in [#8283](#8283) ### Chore - replace gen-release-notes script with communique by @jdx in [#8289](#8289) ### New Contributors - @altendky made their first contribution in [#8290](#8290) ## 📦 Aqua Registry Updates #### New Packages (4) - [`Skarlso/crd-to-sample-yaml`](https://github.com/Skarlso/crd-to-sample-yaml) - [`kunobi-ninja/kunobi-releases`](https://github.com/kunobi-ninja/kunobi-releases) - [`swanysimon/markdownlint-rs`](https://github.com/swanysimon/markdownlint-rs) - [`tmux/tmux-builds`](https://github.com/tmux/tmux-builds) #### Updated Packages (2) - [`firecow/gitlab-ci-local`](https://github.com/firecow/gitlab-ci-local) - [`k1LoW/runn`](https://github.com/k1LoW/runn)
## [2026.2.18](https://github.com/jdx/mise/compare/v2026.2.17..v2026.2.18) - 2026-02-21 ### 🚀 Features - **(install)** auto-lock all platforms after tool installation by @jdx in [#8277](jdx/mise#8277) ### 🐛 Bug Fixes - **(config)** respect --yes flag for config trust prompts by @jdx in [#8288](jdx/mise#8288) - **(exec)** strip shims from PATH on Unix to prevent infinite recursion by @jdx in [#8276](jdx/mise#8276) - **(install)** validate --locked before --dry-run short-circuit by @altendky in [#8290](jdx/mise#8290) - **(release)** refresh PATH after mise up in release-plz by @jdx in [#8292](jdx/mise#8292) - **(schema)** replace unevaluatedProperties with additionalProperties by @jdx in [#8285](jdx/mise#8285) - **(task)** avoid duplicated stderr on task failure in replacing mode by @jdx in [#8275](jdx/mise#8275) - **(task)** use process groups to kill child process trees on Unix by @jdx in [#8279](jdx/mise#8279) - **(task)** run depends_post tasks even when parent task fails by @jdx in [#8274](jdx/mise#8274) - **(task)** suggest similar commands when mistyping a CLI subcommand by @jdx in [#8286](jdx/mise#8286) - **(task)** execute monorepo subdirectory prepare steps from root by @jdx in [#8291](jdx/mise#8291) - **(upgrade)** don't force-reinstall already installed versions by @jdx in [#8282](jdx/mise#8282) - **(watch)** restore terminal state after watchexec exits by @jdx in [#8273](jdx/mise#8273) ### 📚 Documentation - clarify that MISE_CEILING_PATHS excludes the ceiling directory itself by @jdx in [#8283](jdx/mise#8283) ### Chore - replace gen-release-notes script with communique by @jdx in [#8289](jdx/mise#8289) ### New Contributors - @altendky made their first contribution in [#8290](jdx/mise#8290) ### 📦 Aqua Registry Updates #### New Packages (4) - [`Skarlso/crd-to-sample-yaml`](https://github.com/Skarlso/crd-to-sample-yaml) - [`kunobi-ninja/kunobi-releases`](https://github.com/kunobi-ninja/kunobi-releases) - [`swanysimon/markdownlint-rs`](https://github.com/swanysimon/markdownlint-rs) - [`tmux/tmux-builds`](https://github.com/tmux/tmux-builds) #### Updated Packages (2) - [`firecow/gitlab-ci-local`](https://github.com/firecow/gitlab-ci-local) - [`k1LoW/runn`](https://github.com/k1LoW/runn) ## [2026.2.17](https://github.com/jdx/mise/compare/v2026.2.16..v2026.2.17) - 2026-02-19 ### 🚀 Features - **(prepare)** update mtime of outputs after command is run by @halms in [#8243](jdx/mise#8243) ### 🐛 Bug Fixes - **(install)** use backend bin paths for per-tool postinstall hooks by @jdx in [#8234](jdx/mise#8234) - **(use)** write to config.toml instead of config.local.toml by @jdx in [#8240](jdx/mise#8240) - default legacy .mise.backend installs to non-explicit by @jean-humann in [#8245](jdx/mise#8245) ### 🚜 Refactor - **(config)** consolidate flat task_* settings into nested task.* by @jdx in [#8239](jdx/mise#8239) ### Chore - **(prepare)** refactor common code into ProviderBase by @halms in [#8246](jdx/mise#8246) ### 📦 Aqua Registry Updates #### Updated Packages (1) - [`namespacelabs/foundation/nsc`](https://github.com/namespacelabs/foundation/nsc)
) ## Summary - Remove `force: true` from `mise upgrade` install options so already-installed versions are not unnecessarily re-downloaded - Fix `is_version_installed` to correctly handle Prefix tool requests — previously, a `prefix:1` request finding `1.0.0` on disk would falsely report `1.1.0` as "installed", preventing the actual upgrade from occurring - Add e2e test verifying that `mise upgrade` skips re-downloading already installed versions Closes jdx#8260 ## Details `mise upgrade` was using `force: true` in install options (with a TODO asking if it could be removed). This caused two problems: 1. **Unnecessary re-downloads**: When the target version was already installed, `force: true` would uninstall and re-download it 2. **Masking a bug in `is_version_installed`**: For Prefix tool requests (e.g., `prefix:1`), `request.install_path()` returns the first installed directory matching the prefix (e.g., `1.0.0`), even when the resolved version is different (`1.1.0`). With `force: true` this accidentally worked because it uninstalled the found version first, but with `force: false` it caused a false "already installed" early return The fix addresses both: - Sets `force: false` in upgrade install options - Adds a version check in `is_version_installed` for Prefix requests to verify the found install path matches the resolved version ## Test plan - [x] `mise run test:e2e test_upgrade` passes (includes new test case) - [x] `mise run test:e2e test_upgrade_parallel_failure` passes - [x] `mise run test:e2e cli/test_use` passes - [x] `mise run test:e2e tools/test_runtime_symlinks` passes - [x] `mise run test:unit` passes (481 tests) - [x] `mise run lint` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches core upgrade/installation decision logic; incorrect installed detection could lead to skipped upgrades or extra installs, but changes are small and covered by new e2e tests. > > **Overview** > `mise upgrade` now runs installs with `force: false`, preventing unnecessary uninstall/re-download when the target version is already present. > > Backend install detection is tightened for `prefix:` tool requests so a matching *directory prefix* no longer incorrectly counts as the resolved version being installed (avoiding skipped upgrades). E2E tests add coverage for “already installed, no re-download” and lockfile upgrade behavior (updating `mise.lock` to the new version). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7bb818d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
### 🚀 Features - **(install)** auto-lock all platforms after tool installation by @jdx in [jdx#8277](jdx#8277) ### 🐛 Bug Fixes - **(config)** respect --yes flag for config trust prompts by @jdx in [jdx#8288](jdx#8288) - **(exec)** strip shims from PATH on Unix to prevent infinite recursion by @jdx in [jdx#8276](jdx#8276) - **(install)** validate --locked before --dry-run short-circuit by @altendky in [jdx#8290](jdx#8290) - **(release)** refresh PATH after mise up in release-plz by @jdx in [jdx#8292](jdx#8292) - **(schema)** replace unevaluatedProperties with additionalProperties by @jdx in [jdx#8285](jdx#8285) - **(task)** avoid duplicated stderr on task failure in replacing mode by @jdx in [jdx#8275](jdx#8275) - **(task)** use process groups to kill child process trees on Unix by @jdx in [jdx#8279](jdx#8279) - **(task)** run depends_post tasks even when parent task fails by @jdx in [jdx#8274](jdx#8274) - **(task)** suggest similar commands when mistyping a CLI subcommand by @jdx in [jdx#8286](jdx#8286) - **(task)** execute monorepo subdirectory prepare steps from root by @jdx in [jdx#8291](jdx#8291) - **(upgrade)** don't force-reinstall already installed versions by @jdx in [jdx#8282](jdx#8282) - **(watch)** restore terminal state after watchexec exits by @jdx in [jdx#8273](jdx#8273) ### 📚 Documentation - clarify that MISE_CEILING_PATHS excludes the ceiling directory itself by @jdx in [jdx#8283](jdx#8283) ### Chore - replace gen-release-notes script with communique by @jdx in [jdx#8289](jdx#8289) ### New Contributors - @altendky made their first contribution in [jdx#8290](jdx#8290) ## 📦 Aqua Registry Updates #### New Packages (4) - [`Skarlso/crd-to-sample-yaml`](https://github.com/Skarlso/crd-to-sample-yaml) - [`kunobi-ninja/kunobi-releases`](https://github.com/kunobi-ninja/kunobi-releases) - [`swanysimon/markdownlint-rs`](https://github.com/swanysimon/markdownlint-rs) - [`tmux/tmux-builds`](https://github.com/tmux/tmux-builds) #### Updated Packages (2) - [`firecow/gitlab-ci-local`](https://github.com/firecow/gitlab-ci-local) - [`k1LoW/runn`](https://github.com/k1LoW/runn)
Summary
force: truefrommise upgradeinstall options so already-installed versions are not unnecessarily re-downloadedis_version_installedto correctly handle Prefix tool requests — previously, aprefix:1request finding1.0.0on disk would falsely report1.1.0as "installed", preventing the actual upgrade from occurringmise upgradeskips re-downloading already installed versionsCloses #8260
Details
mise upgradewas usingforce: truein install options (with a TODO asking if it could be removed). This caused two problems:force: truewould uninstall and re-download itis_version_installed: For Prefix tool requests (e.g.,prefix:1),request.install_path()returns the first installed directory matching the prefix (e.g.,1.0.0), even when the resolved version is different (1.1.0). Withforce: truethis accidentally worked because it uninstalled the found version first, but withforce: falseit caused a false "already installed" early returnThe fix addresses both:
force: falsein upgrade install optionsis_version_installedfor Prefix requests to verify the found install path matches the resolved versionTest plan
mise run test:e2e test_upgradepasses (includes new test case)mise run test:e2e test_upgrade_parallel_failurepassesmise run test:e2e cli/test_usepassesmise run test:e2e tools/test_runtime_symlinkspassesmise run test:unitpasses (481 tests)mise run lintpasses🤖 Generated with Claude Code
Note
Medium Risk
Touches core upgrade/installation decision logic; incorrect installed detection could lead to skipped upgrades or extra installs, but changes are small and covered by new e2e tests.
Overview
mise upgradenow runs installs withforce: false, preventing unnecessary uninstall/re-download when the target version is already present.Backend install detection is tightened for
prefix:tool requests so a matching directory prefix no longer incorrectly counts as the resolved version being installed (avoiding skipped upgrades). E2E tests add coverage for “already installed, no re-download” and lockfile upgrade behavior (updatingmise.lockto the new version).Written by Cursor Bugbot for commit 7bb818d. This will update automatically on new commits. Configure here.