fix(aqua): restore bin_paths disk cache with fresh_file invalidation#8398
fix(aqua): restore bin_paths disk cache with fresh_file invalidation#8398
Conversation
PR #8383 removed the aqua bin_paths disk cache to fix staleness bugs, but this caused ~8-17% regression on mise env/x/hook-env. Restore the cache using with_fresh_file(tv.install_path()) so it automatically invalidates when a tool is installed (install_path mtime changes), avoiding the original race condition without sacrificing performance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, 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 addresses a significant performance regression introduced by the removal of 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
This pull request restores the disk cache for aqua list_bin_paths to address a performance regression. It introduces cache invalidation based on file modification times using with_fresh_file to prevent staleness issues. The implementation stores relative paths in the cache and reconstructs absolute paths upon retrieval, for which PathExt::mount and PathExt::is_empty helpers have been re-introduced. My review did not find any issues of medium severity or higher.
Greptile SummaryReinstates the aqua backend's Key changes:
Important note: There's still a narrow race window where concurrent Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[list_bin_paths called] --> B{Cache exists?}
B -->|No| E[Compute paths]
B -->|Yes| C{Cache fresh?}
C -->|Yes| D[Return cached paths]
C -->|No| E
E --> F[Get package from registry]
F --> G[Compute srcs]
G --> H[Filter existing paths]
H --> I[Strip install_path prefix]
I --> J[Store relative paths in cache]
J --> K[Mount paths back to absolute]
K --> L[Return paths]
M[Installation starts] --> N[remove install_path]
N --> O[install_path mtime changes]
O --> P[Next list_bin_paths call]
P --> Q{Cache older than install_path?}
Q -->|Yes| R[Cache stale - recompute]
Q -->|No| S[Cache fresh - use it]
Last reviewed commit: 8019d04 |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.23 x -- echo |
25.0 ± 0.7 | 24.1 | 34.1 | 1.00 |
mise x -- echo |
25.0 ± 0.4 | 24.4 | 28.6 | 1.00 ± 0.03 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.23 env |
24.4 ± 0.8 | 23.3 | 32.3 | 1.00 |
mise env |
24.5 ± 0.6 | 23.7 | 31.7 | 1.00 ± 0.04 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.23 hook-env |
24.9 ± 0.3 | 24.3 | 28.3 | 1.00 |
mise hook-env |
25.2 ± 0.6 | 24.4 | 34.1 | 1.01 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.23 ls |
22.8 ± 0.4 | 22.1 | 24.8 | 1.00 |
mise ls |
23.0 ± 0.6 | 22.2 | 29.7 | 1.01 ± 0.03 |
xtasks/test/perf
| Command | mise-2026.2.23 | mise | Variance |
|---|---|---|---|
| install (cached) | 157ms | 157ms | +0% |
| ls (cached) | 88ms | 88ms | +0% |
| bin-paths (cached) | 93ms | 93ms | +0% |
| task-ls (cached) | 825ms | 836ms | -1% |
### 🚀 Features - **(hooks)** add task references to hooks and watch_files by @jdx in [#8400](#8400) - **(prepare)** add git-submodule built-in provider by @jdx in [#8407](#8407) - **(prepare)** add human-readable stale reasons to prepare output by @jdx in [#8408](#8408) - **(prepare)** add dependency ordering to prepare steps by @jdx in [#8401](#8401) - **(prepare)** add --explain flag for provider diagnostics by @jdx in [#8409](#8409) - **(prepare)** add per-provider timeout support by @jdx in [#8405](#8405) - **(prepare)** add blake3 content-hash freshness checking by @jdx in [#8404](#8404) - **(tasks)** monorepo vars and per-task vars by @halms in [#8248](#8248) ### 🐛 Bug Fixes - **(aqua)** restore bin_paths disk cache with fresh_file invalidation by @jdx in [#8398](#8398) - **(idiomatic)** use generic parser for idiomatic files by @risu729 in [#8171](#8171) - **(install)** apply precompiled options to all platforms in lockfile by @jdx in [#8396](#8396) - **(install)** normalize "v" prefix when matching lockfile versions by @jdx in [#8413](#8413) - **(prepare)** improve git submodule parser and fix check_staleness error handling by @jdx in [#8412](#8412) - **(python)** respect precompiled settings in lock file generation by @jdx in [#8399](#8399) - **(python)** clarify uv_venv_auto docs + prevent uv shim recursion in venv creation by @halms in [#8402](#8402) - **(task)** remove deprecated `# mise` task header syntax by @jdx in [#8403](#8403) - **(vfox)** avoid eager metadata loading during config file detection by @jdx in [#8397](#8397) - clarify GitHub attestations to be artifact ones by @scop in [#8394](#8394) - ignore comments in idiomatic version files by @iloveitaly in [#7682](#7682) ### 🚜 Refactor - unify archive detection by @risu729 in [#8137](#8137) ### 📚 Documentation - remove duplicated docs for npm.package_manager by @risu729 in [#8414](#8414)
Summary
bin_paths.msgpack.zdisk cache that was removed in fix(aqua): remove unnecessary bin_paths disk cache #8383with_fresh_file(tv.install_path())for automatic cache invalidation when a tool is installed/updatedPathExt::mountandPathExt::is_emptyhelpers needed for relative path handlingContext
PR #8383 removed the aqua bin_paths disk cache to fix staleness bugs (#8372) where concurrent
mise hook-envduring install could cache incomplete paths. However, this caused a ~8-17% performance regression onmise env,mise x -- echo, andmise hook-env(confirmed in CI hyperfine benchmarks on the 2026.2.24 release PR #8387).The root cause of the regression: each mise command is a separate process, so in-memory caches provide no benefit. The disk cache was what persisted across invocations.
The original cache lacked
fresh_fileinvalidation. This fix useswith_fresh_file(tv.install_path())— the same pattern used byExternalPluginCachefor asdf backends — so the cache automatically invalidates when the install directory's mtime changes (i.e., after tool installation). This avoids the race condition from #8372 without sacrificing performance.Local benchmark results (hyperfine, 100 runs)
mise envmise x -- echoTest plan
cargo checkpassesmise run lint-fix)mise run test:unit)🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it changes
list_bin_pathsbehavior and caching semantics for the aqua backend; incorrect invalidation or path mounting could lead to missing/incorrect PATH entries after installs/updates.Overview
Restores a persistent disk cache for aqua
list_bin_paths(bin_paths.msgpack.z) to avoid recomputing bin directories on each invocation.The cache now uses
with_fresh_file(tv.install_path())(plus an existing freshness duration) so it automatically invalidates when the install directory changes, and it stores paths relative toinstall_paththen re-mounts them via newly reintroducedPathExt::mount/PathExt::is_emptyhelpers.Written by Cursor Bugbot for commit 8019d04. This will update automatically on new commits. Configure here.