Skip to content

fix(install): clear aqua bin_paths cache after install to prevent stale PATH#8374

Merged
jdx merged 1 commit intomainfrom
fix/aqua-clear-bin-paths-cache-after-install
Feb 27, 2026
Merged

fix(install): clear aqua bin_paths cache after install to prevent stale PATH#8374
jdx merged 1 commit intomainfrom
fix/aqua-clear-bin-paths-cache-after-install

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Feb 27, 2026

Summary

  • Clear both in-memory and disk bin_paths cache after an aqua tool install completes
  • Prevents stale cache entries (computed before extraction finished or by a concurrent process) from persisting and causing the tool's PATH entry to be missing

Fixes #8372

Context

The list_bin_paths() method caches its results to bin_paths.msgpack.z. If this cache gets populated with empty data before the install directory is fully set up (e.g., by a concurrent mise hook-env call or during shim rebuilding within the same mise use invocation), the stale empty result persists and the tool's PATH entry disappears.

This was reported for uv 0.10.6 on macOS where upgrading caused the PATH entry to vanish, but reinstalling (uninstall + use) fixed it — because uninstalling clears the cache directory.

Test plan

  • Verify build passes
  • Verify existing e2e tests pass
  • Manual test: install an aqua tool and verify PATH entry appears in mise doctor

🤖 Generated with Claude Code


Note

Low Risk
Low risk change limited to aqua install caching: it invalidates in-memory and on-disk bin_paths cache after install, which may slightly increase post-install bin path recomputation but avoids stale PATH entries.

Overview
Prevents missing PATH entries after aqua installs by clearing list_bin_paths() cache state once installation completes.

After install_version_() finishes, it now evicts the in-memory bin_path_caches entry for the installed version and deletes the on-disk bin_paths.msgpack.z cache file so bin paths are recomputed from the newly-installed files.

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

…le PATH

After installing an aqua tool, clear both the in-memory and disk caches
for bin_paths. Without this, a stale cache (computed before the install
completed or by a concurrent process) could persist and cause the tool's
PATH entry to be missing from the shell environment.

Fixes #8372

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 enhances the aqua backend by ensuring that the bin_paths cache is cleared after a tool is installed. This prevents issues where stale cache data leads to missing PATH entries, particularly after upgrades or when concurrent processes interfere with the installation.

Highlights

  • Cache Clearing: This PR clears both the in-memory and on-disk bin_paths cache after an aqua tool installation.
  • Stale PATH Prevention: It prevents stale cache entries, which could be computed before the extraction is complete or by a concurrent process, from persisting and causing the tool's PATH entry to be missing.
  • Issue Fix: This PR addresses and fixes issue uv 0.10.6 does not set path on macOS #8372, where the PATH entry vanished after upgrading uv on macOS.
Changelog
  • src/backend/aqua.rs
    • Cleared in-memory and on-disk bin_paths cache after aqua tool installation to prevent stale PATH entries.
Activity
  • The PR includes a fix for issue uv 0.10.6 does not set path on macOS #8372.
  • The PR description details the context of the issue, explaining how stale cache entries can lead to missing PATH entries.
  • The test plan includes verifying the build, existing e2e tests, and a manual test to confirm the PATH entry appears in mise doctor after installing an aqua tool.
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.

@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR fixes a cache staleness bug where aqua tool installations could have missing PATH entries. The fix clears both the in-memory DashMap cache and the on-disk bin_paths.msgpack.z cache file immediately after installation completes.

Key changes:

  • Added cache clearing logic after self.install() completes in install_version_impl
  • Removes the in-memory cache entry from bin_path_caches DashMap
  • Deletes the disk cache file if it exists
  • Prevents race conditions where concurrent processes (e.g., mise hook-env or shim rebuilding) compute and cache empty bin paths before installation finishes

How it works:
The list_bin_paths() method uses a two-tier cache (in-memory DashMap + disk file) and filters results by path.exists(). If this cache is populated before installation extracts files, it caches an empty result. The fix ensures the cache is cleared after installation, forcing the next list_bin_paths() call to recompute with the newly installed files present.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a targeted bug fix that adds cache invalidation logic after installation. It only adds new code without modifying existing behavior, clears caches defensively (ignoring errors), and directly addresses a documented issue (uv 0.10.6 does not set path on macOS #8372). The fix is well-commented and follows the pattern of cache clearing already used during uninstall.
  • No files require special attention

Important Files Changed

Filename Overview
src/backend/aqua.rs Added cache clearing after installation to prevent stale bin_paths cache from causing missing PATH entries

Last reviewed commit: dd538d6

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

This pull request addresses an issue where the aqua tool's PATH entry would disappear after upgrading due to a stale cache. The fix involves clearing both the in-memory and on-disk bin_paths cache after an aqua tool install completes. The change appears straightforward and addresses the reported issue. I have added a review comment to suggest a more robust way to handle file removal, including error logging and potential retries.

Comment on lines +469 to +471
if cache_path.exists() {
let _ = file::remove_file(&cache_path);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Instead of directly removing the cache file, consider using a more robust approach that handles potential errors during file removal. For instance, logging the error if the file removal fails can aid in debugging. Additionally, consider retrying the removal a few times with a short delay in case of transient issues.

        self.bin_path_caches.remove(&tv.version);
        let cache_path = tv.cache_path().join(

@github-actions
Copy link

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.21 x -- echo 25.8 ± 1.1 24.2 37.4 1.00
mise x -- echo 26.0 ± 0.8 24.5 28.6 1.01 ± 0.05

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.21 env 25.5 ± 0.9 24.0 29.5 1.01 ± 0.05
mise env 25.3 ± 0.8 23.8 28.8 1.00

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.21 hook-env 26.1 ± 0.7 24.6 28.3 1.00 ± 0.05
mise hook-env 26.1 ± 1.0 24.6 37.7 1.00

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.21 ls 25.3 ± 0.9 23.8 28.3 1.00
mise ls 25.6 ± 0.8 24.0 28.0 1.01 ± 0.05

xtasks/test/perf

Command mise-2026.2.21 mise Variance
install (cached) 162ms 162ms +0%
ls (cached) 92ms 91ms +1%
bin-paths (cached) 94ms 93ms +1%
task-ls (cached) 854ms 830ms +2%

@jdx jdx merged commit b561773 into main Feb 27, 2026
38 checks passed
@jdx jdx deleted the fix/aqua-clear-bin-paths-cache-after-install branch February 27, 2026 20:53
mise-en-dev added a commit that referenced this pull request Feb 28, 2026
### 🚀 Features

- **(backend-plugin)** pass options to vfox backend plugins by
@Attempt3035 in [#8369](#8369)

### 🐛 Bug Fixes

- **(install)** prevent --locked mode from modifying or bypassing
lockfile by @jdx in [#8362](#8362)
- **(install)** clear aqua bin_paths cache after install to prevent
stale PATH by @jdx in [#8374](#8374)
- **(task)** prevent broken pipe panic and race condition in remote git
task cache by @vmaleze in [#8375](#8375)

### 📦️ Dependency Updates

- update docker/build-push-action digest to 10e90e3 by @renovate[bot] in
[#8367](#8367)
- update fedora:43 docker digest to 781b764 by @renovate[bot] in
[#8368](#8368)

### 📦 Registry

- add porter
([github:getporter/porter](https://github.com/getporter/porter)) by
@lbergnehr in [#8380](#8380)
- add entire ([aqua:entireio/cli](https://github.com/entireio/cli)) by
@TyceHerrman in [#8378](#8378)
- add topgrade
([aqua:topgrade-rs/topgrade](https://github.com/topgrade-rs/topgrade))
by @TyceHerrman in [#8377](#8377)

### Chore

- remove pre-commit config and tool dependency by @jdx in
[#8373](#8373)

### New Contributors

- @Attempt3035 made their first contribution in
[#8369](#8369)
- @lbergnehr made their first contribution in
[#8380](#8380)
jdx added a commit that referenced this pull request Feb 28, 2026
The aqua backend cached `list_bin_paths` results to
`bin_paths.msgpack.z`, but this cache provided negligible performance
benefit (reading + decompressing a msgpack file vs reading + parsing a
small YAML registry file) while introducing bugs like #8372 where
stale cached paths caused missing PATH entries after install.

The cache invalidation added in #8374 to address that bug was itself
ineffective — it couldn't prevent a concurrent `mise hook-env` process
from repopulating the cache during install.

Remove the cache entirely along with the now-unused `DashMap`
dependency, `PathExt::mount`, and `PathExt::is_empty`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jdx added a commit that referenced this pull request Feb 28, 2026
## Summary
- Remove `bin_path_caches` (`DashMap` + `bin_paths.msgpack.z` disk
cache) from aqua backend
- Remove now-unused `PathExt::mount` and `PathExt::is_empty`
- `list_bin_paths` now computes directly every call

## Context

The aqua backend cached `list_bin_paths` results to
`bin_paths.msgpack.z`, but this cache provided negligible performance
benefit — reading + decompressing a msgpack file is comparable to
reading + parsing a small YAML registry file (or parsing from the
baked-in registry which doesn't even hit disk).

Meanwhile, the cache was the root cause of #8372 where stale cached
paths caused missing PATH entries after install. The fix attempted in
#8374 was ineffective — it cleared the in-memory `DashMap` (only helps
same process) and deleted the disk cache (immediately raceable by
concurrent `mise hook-env`). The real protection was already in
`create_install_dirs()` which wipes `tv.cache_path()` before install
begins.

Removing the cache entirely eliminates this class of bugs with no
meaningful performance impact.

## Test plan
- [x] `cargo check` passes with no warnings
- [x] All lint checks pass
- [ ] Existing e2e tests pass (CI)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes how `list_bin_paths` is computed by removing both in-memory
and on-disk caching, which can affect PATH resolution behavior and
performance (though intended to reduce stale-path bugs). Scope is
limited to the Aqua backend and removal of unused path helpers.
> 
> **Overview**
> Removes Aqua’s `bin_paths` caching layer (the per-version `DashMap`
and `bin_paths.msgpack.z` file) and stops trying to invalidate it after
installs.
> 
> `list_bin_paths` now recomputes binary directories on each call by
reading the registry package definition and deriving the paths directly,
eliminating stale cached PATH entries.
> 
> Cleans up `PathExt` by deleting the now-unused `mount` and `is_empty`
helpers.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5e5c5db. 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>
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.

1 participant