fix(conda): preserve conda_packages on locked install and fix temp file race#8335
fix(conda): preserve conda_packages on locked install and fix temp file race#8335
Conversation
…le race Two bugs in the conda backend: 1. install_from_locked took an immutable &ToolVersion, so tv.conda_packages was never populated. If the lockfile is re-saved after a locked install, [conda-packages] entries would be lost. Fix: take &mut ToolVersion and repopulate conda_packages from the lockfile data after install. 2. download_to created temp files with a fixed .tmp extension, so concurrent mise processes downloading the same package would write to the same temp file, risking data corruption before the atomic rename. Fix: append PID to the temp extension (.tmp.<pid>). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 addresses two critical issues related to Conda package management within 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 addresses two key issues in the conda backend: a data loss problem during locked installs and a potential race condition in temporary file creation. The changes include modifying the install_from_locked function to correctly preserve conda_packages data and updating the temporary file naming scheme to prevent concurrent processes from interfering with each other. The changes look correct and address the issues described in the pull request.
There was a problem hiding this comment.
Pull request overview
This pull request fixes two distinct issues in the Conda backend: data loss during locked installs and a race condition in concurrent downloads.
Changes:
- Modified
install_from_lockedto accept mutableToolVersionreference and repopulateconda_packagesfrom the lockfile after installation, preventing data loss when lockfiles are re-saved - Changed temp file naming from fixed
.tmpextension to PID-suffixed.tmp.{pid}to prevent concurrent processes from corrupting each other's downloads
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.19 x -- echo |
24.4 ± 0.4 | 23.1 | 27.2 | 1.00 |
mise x -- echo |
26.1 ± 3.9 | 24.0 | 108.9 | 1.07 ± 0.16 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.19 env |
23.4 ± 1.1 | 21.9 | 39.1 | 1.00 |
mise env |
24.9 ± 0.5 | 23.3 | 26.2 | 1.07 ± 0.05 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.19 hook-env |
24.1 ± 0.4 | 23.0 | 27.3 | 1.00 |
mise hook-env |
25.7 ± 0.7 | 23.6 | 37.3 | 1.07 ± 0.04 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.19 ls |
21.8 ± 1.2 | 20.8 | 38.8 | 1.00 |
mise ls |
23.4 ± 1.1 | 22.0 | 36.2 | 1.07 ± 0.08 |
xtasks/test/perf
| Command | mise-2026.2.19 | mise | Variance |
|---|---|---|---|
| install (cached) | 130ms | -15% | |
| ls (cached) | 78ms | 86ms | -9% |
| bin-paths (cached) | 84ms | 91ms | -7% |
| task-ls (cached) | 819ms | 825ms | +0% |
### 🚀 Features - **(conda)** replace custom backend with rattler crates by @jdx in [#8325](#8325) - **(task)** enforce per-task timeout configuration by @tvararu in [#8250](#8250) - **(vsix)** added vsix archives to http backend by @sosumappu in [#8306](#8306) - add core dotnet plugin for .NET SDK management by @jdx in [#8326](#8326) ### 🐛 Bug Fixes - **(conda)** preserve conda_packages on locked install and fix temp file race by @jdx in [#8335](#8335) - **(conda)** deduplicate repodata records to fix solver error on Linux by @jdx in [#8337](#8337) - **(env)** include watch_files in fast-path early exit check by @jdx in [#8317](#8317) - **(env)** clear fish completions when setting/unsetting shell aliases by @jdx in [#8324](#8324) - **(lockfile)** prevent lockfile writes when --locked is set by @jdx in [#8308](#8308) - **(lockfile)** prune orphan tool entries on mise lock by @mackwic in [#8265](#8265) - **(lockfile)** error on contradictory locked=true + lockfile=false config by @jdx in [#8329](#8329) - **(regal)** Update package location by @charlieegan3 in [#8315](#8315) - **(release)** strip markdown heading prefix from communique release title by @jdx in [#8303](#8303) - **(schema)** enforce additionalProperties constraint for env by @adamliang0 in [#8328](#8328) ### 📚 Documentation - Remove incorrect oh-my-zsh plugin ordering comment by @bvosk in [#8323](#8323) - require AI disclosure on GitHub comments by @jdx in [#8330](#8330) ### 📦 Registry - add `oxfmt` by @taoufik07 in [#8316](#8316) ### New Contributors - @adamliang0 made their first contribution in [#8328](#8328) - @tvararu made their first contribution in [#8250](#8250) - @bvosk made their first contribution in [#8323](#8323) - @taoufik07 made their first contribution in [#8316](#8316) - @charlieegan3 made their first contribution in [#8315](#8315) - @sosumappu made their first contribution in [#8306](#8306) ## 📦 Aqua Registry Updates #### New Packages (3) - [`Tyrrrz/FFmpegBin`](https://github.com/Tyrrrz/FFmpegBin) - [`elixir-lang/expert`](https://github.com/elixir-lang/expert) - [`erikjuhani/basalt`](https://github.com/erikjuhani/basalt) #### Updated Packages (5) - [`caarlos0/fork-cleaner`](https://github.com/caarlos0/fork-cleaner) - [`firecow/gitlab-ci-local`](https://github.com/firecow/gitlab-ci-local) - [`jackchuka/mdschema`](https://github.com/jackchuka/mdschema) - [`kunobi-ninja/kunobi-releases`](https://github.com/kunobi-ninja/kunobi-releases) - [`peco/peco`](https://github.com/peco/peco)
…le race (jdx#8335) ## Summary - **Fix locked install dropping `conda_packages` data**: `install_from_locked` took an immutable `&ToolVersion`, so `tv.conda_packages` was never populated during the locked path. If the lockfile is re-saved after a locked install, the `[conda-packages]` entries would be lost. Changed to `&mut ToolVersion` and repopulate `conda_packages` from the lockfile after install. - **Fix temp file race in `download_to`**: The temp file used a fixed `.tmp` extension, so concurrent mise processes downloading the same package would write to the same temp file, risking data corruption before the atomic rename. Now appends PID to the extension (`.tmp.<pid>`). ## Test plan - [x] `mise run build` — compiles successfully - [x] `mise run lint` — all checks pass - [x] `mise run test:unit` — 491 tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Scoped to conda backend install/download logic; behavior changes are straightforward but touch concurrent download and lockfile preservation paths. > > **Overview** > Fixes two conda backend issues affecting reproducibility and concurrent installs. > > Locked installs now take `&mut ToolVersion` and repopulate `tv.conda_packages` from the lockfile after installation so subsequent lockfile writes don’t drop `[conda-packages]` entries. Package downloads now use a PID-suffixed temp filename (`.tmp.<pid>`) instead of a shared `.tmp`, reducing cross-process clobbering before the atomic rename. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c45b506. 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>
### 🚀 Features - **(conda)** replace custom backend with rattler crates by @jdx in [jdx#8325](jdx#8325) - **(task)** enforce per-task timeout configuration by @tvararu in [jdx#8250](jdx#8250) - **(vsix)** added vsix archives to http backend by @sosumappu in [jdx#8306](jdx#8306) - add core dotnet plugin for .NET SDK management by @jdx in [jdx#8326](jdx#8326) ### 🐛 Bug Fixes - **(conda)** preserve conda_packages on locked install and fix temp file race by @jdx in [jdx#8335](jdx#8335) - **(conda)** deduplicate repodata records to fix solver error on Linux by @jdx in [jdx#8337](jdx#8337) - **(env)** include watch_files in fast-path early exit check by @jdx in [jdx#8317](jdx#8317) - **(env)** clear fish completions when setting/unsetting shell aliases by @jdx in [jdx#8324](jdx#8324) - **(lockfile)** prevent lockfile writes when --locked is set by @jdx in [jdx#8308](jdx#8308) - **(lockfile)** prune orphan tool entries on mise lock by @mackwic in [jdx#8265](jdx#8265) - **(lockfile)** error on contradictory locked=true + lockfile=false config by @jdx in [jdx#8329](jdx#8329) - **(regal)** Update package location by @charlieegan3 in [jdx#8315](jdx#8315) - **(release)** strip markdown heading prefix from communique release title by @jdx in [jdx#8303](jdx#8303) - **(schema)** enforce additionalProperties constraint for env by @adamliang0 in [jdx#8328](jdx#8328) ### 📚 Documentation - Remove incorrect oh-my-zsh plugin ordering comment by @bvosk in [jdx#8323](jdx#8323) - require AI disclosure on GitHub comments by @jdx in [jdx#8330](jdx#8330) ### 📦 Registry - add `oxfmt` by @taoufik07 in [jdx#8316](jdx#8316) ### New Contributors - @adamliang0 made their first contribution in [jdx#8328](jdx#8328) - @tvararu made their first contribution in [jdx#8250](jdx#8250) - @bvosk made their first contribution in [jdx#8323](jdx#8323) - @taoufik07 made their first contribution in [jdx#8316](jdx#8316) - @charlieegan3 made their first contribution in [jdx#8315](jdx#8315) - @sosumappu made their first contribution in [jdx#8306](jdx#8306) ## 📦 Aqua Registry Updates #### New Packages (3) - [`Tyrrrz/FFmpegBin`](https://github.com/Tyrrrz/FFmpegBin) - [`elixir-lang/expert`](https://github.com/elixir-lang/expert) - [`erikjuhani/basalt`](https://github.com/erikjuhani/basalt) #### Updated Packages (5) - [`caarlos0/fork-cleaner`](https://github.com/caarlos0/fork-cleaner) - [`firecow/gitlab-ci-local`](https://github.com/firecow/gitlab-ci-local) - [`jackchuka/mdschema`](https://github.com/jackchuka/mdschema) - [`kunobi-ninja/kunobi-releases`](https://github.com/kunobi-ninja/kunobi-releases) - [`peco/peco`](https://github.com/peco/peco)
Summary
conda_packagesdata:install_from_lockedtook an immutable&ToolVersion, sotv.conda_packageswas never populated during the locked path. If the lockfile is re-saved after a locked install, the[conda-packages]entries would be lost. Changed to&mut ToolVersionand repopulateconda_packagesfrom the lockfile after install.download_to: The temp file used a fixed.tmpextension, so concurrent mise processes downloading the same package would write to the same temp file, risking data corruption before the atomic rename. Now appends PID to the extension (.tmp.<pid>).Test plan
mise run build— compiles successfullymise run lint— all checks passmise run test:unit— 491 tests pass🤖 Generated with Claude Code
Note
Low Risk
Scoped to conda backend install/download logic; behavior changes are straightforward but touch concurrent download and lockfile preservation paths.
Overview
Fixes two conda backend issues affecting reproducibility and concurrent installs.
Locked installs now take
&mut ToolVersionand repopulatetv.conda_packagesfrom the lockfile after installation so subsequent lockfile writes don’t drop[conda-packages]entries. Package downloads now use a PID-suffixed temp filename (.tmp.<pid>) instead of a shared.tmp, reducing cross-process clobbering before the atomic rename.Written by Cursor Bugbot for commit c45b506. This will update automatically on new commits. Configure here.