Skip to content

fix(upgrade): don't force-reinstall already installed versions#8282

Merged
jdx merged 3 commits intomainfrom
fix/upgrade-no-force-reinstall
Feb 21, 2026
Merged

fix(upgrade): don't force-reinstall already installed versions#8282
jdx merged 3 commits intomainfrom
fix/upgrade-no-force-reinstall

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Feb 21, 2026

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 #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

  • mise run test:e2e test_upgrade passes (includes new test case)
  • mise run test:e2e test_upgrade_parallel_failure passes
  • mise run test:e2e cli/test_use passes
  • mise run test:e2e tools/test_runtime_symlinks passes
  • mise run test:unit passes (481 tests)
  • mise run lint passes

🤖 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 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).

Written by Cursor Bugbot for commit 7bb818d. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings February 21, 2026 16:31
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 mise upgrade command's behavior to be more efficient and accurate. It addresses an issue where mise upgrade would unnecessarily re-download already installed tool versions and fixes a subtle bug in version detection for prefix-based requests. The changes ensure that mise correctly identifies installed versions and avoids redundant operations, leading to a smoother user experience.

Highlights

  • mise upgrade behavior: Modified mise upgrade to no longer force-reinstall already installed versions by setting force: false in its install options, preventing unnecessary re-downloads.
  • is_version_installed logic: Corrected a bug in is_version_installed where it incorrectly reported prefix-requested versions (e.g., dummy@1) as installed even if the resolved version (e.g., 1.1.0) didn't match the found install path (e.g., 1.0.0), which previously masked issues due to force: true.
  • End-to-end testing: Added a new end-to-end test to verify that mise upgrade correctly skips re-downloading tools that are already installed, confirming the fix for the discussed issue.
Changelog
  • e2e/cli/test_upgrade
    • Added a new e2e test case to verify that mise upgrade does not re-download already installed versions.
  • src/backend/mod.rs
    • Modified the is_version_installed function to include a version check for ToolRequest::Prefix types, ensuring that the found install path's version matches the resolved ToolVersion to prevent false positives.
  • src/cli/upgrade.rs
    • Changed the force option in InstallOptions for the Upgrade command from true to false, stopping mise upgrade from force-reinstalling tools.
Activity
  • Verified mise run test:e2e test_upgrade passes, including the new test case.
  • Verified mise run test:e2e test_upgrade_parallel_failure passes.
  • Verified mise run test:e2e cli/test_use passes.
  • Verified mise run test:e2e tools/test_runtime_symlinks passes.
  • Verified mise run test:unit passes (481 tests).
  • Verified mise run lint passes.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

if let ToolRequest::Prefix { .. } = &tv.request {
if install_path
.file_name()
.map_or(false, |f| f.to_string_lossy() != tv.version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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>.

Suggested change
.map_or(false, |f| f.to_string_lossy() != tv.version)
.map_or(false, |f| f != tv.version.as_str())

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: true from upgrade install options to prevent unnecessary reinstalls
  • Added version verification in is_version_installed for 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.

Comment on lines +570 to +573
if let ToolRequest::Prefix { .. } = &tv.request
&& install_path
.file_name()
.is_some_and(|f| f.to_string_lossy() != tv.version)
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
`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>
@jdx jdx force-pushed the fix/upgrade-no-force-reinstall branch from 88b1a78 to 2ebaabf Compare February 21, 2026 16:38
@jdx
Copy link
Owner Author

jdx commented Feb 21, 2026

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@jdx jdx merged commit 0497cf1 into main Feb 21, 2026
33 checks passed
@jdx jdx deleted the fix/upgrade-no-force-reinstall branch February 21, 2026 17:05
@github-actions
Copy link

Hyperfine Performance

mise x -- echo

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%

jdx pushed a commit that referenced this pull request Feb 21, 2026
### 🚀 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)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Feb 22, 2026
## [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)
risu729 pushed a commit to risu729/mise that referenced this pull request Feb 27, 2026
)

## 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>
risu729 pushed a commit to risu729/mise that referenced this pull request Feb 27, 2026
### 🚀 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)
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.

2 participants