fix(task): auto-install tools from mise.toml for file tasks#8030
Conversation
When running file tasks (scripts in .mise-tasks/), tools defined in mise.toml were not auto-installed before execution because file tasks have no associated config file (t.cf() returns None). This adds a fallback that uses the task's config_root to discover and install tools from the project's config hierarchy, matching what the execution-time toolset build already does. Closes #8014 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes auto-installation of tools for file-based tasks (scripts in .mise-tasks/) by ensuring tools defined in mise.toml are discovered and installed before task execution. Previously, file tasks would fail to auto-install tools because they don't have a config file reference.
Changes:
- Added fallback logic to use
config_rootfor discovering tools when file tasks lack a config file reference - Refactored
collect_tools_from_config_fileto extract directory-based tool collection into a reusablecollect_tools_from_dirmethod - Added documentation explaining the fallback behavior for file tasks
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 resolves a critical bug preventing file-based tasks from correctly auto-installing tools defined in 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 correctly fixes an issue where tools defined in mise.toml were not being auto-installed for file-based tasks. The change introduces a fallback mechanism to use the task's config_root to discover tools, which is the correct approach. Additionally, the refactoring of collect_tools_from_config_file into a more generic collect_tools_from_dir function is a great improvement for code reuse and clarity. I have one minor suggestion to further improve code readability by using an existing abstraction.
src/task/task_tool_installer.rs
Outdated
| let task_dir = task_cf.get_path().parent().unwrap_or(task_cf.get_path()); | ||
| self.collect_tools_from_dir(task_dir, task_name).await |
There was a problem hiding this comment.
Using task_cf.config_root() is more idiomatic and concise for getting the directory of the config file. It achieves the same result as the current implementation but improves readability by using the existing abstraction for this purpose.
| let task_dir = task_cf.get_path().parent().unwrap_or(task_cf.get_path()); | |
| self.collect_tools_from_dir(task_dir, task_name).await | |
| let task_dir = task_cf.config_root(); | |
| self.collect_tools_from_dir(&task_dir, task_name).await |
Verifies that tools defined in mise.toml are auto-installed before running file tasks in mise-tasks/. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.5 x -- echo |
21.1 ± 0.5 | 20.1 | 23.8 | 1.00 |
mise x -- echo |
21.6 ± 0.8 | 20.1 | 28.5 | 1.02 ± 0.05 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.5 env |
20.6 ± 0.6 | 19.5 | 26.4 | 1.00 |
mise env |
21.1 ± 1.3 | 19.5 | 36.2 | 1.03 ± 0.07 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.5 hook-env |
21.1 ± 0.4 | 20.3 | 22.9 | 1.00 |
mise hook-env |
21.4 ± 0.6 | 20.3 | 24.6 | 1.01 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.5 ls |
19.2 ± 0.5 | 18.4 | 20.7 | 1.00 |
mise ls |
19.4 ± 0.7 | 18.4 | 25.7 | 1.01 ± 0.05 |
xtasks/test/perf
| Command | mise-2026.2.5 | mise | Variance |
|---|---|---|---|
| install (cached) | 115ms | 116ms | +0% |
| ls (cached) | 73ms | 72ms | +1% |
| bin-paths (cached) | 77ms | 78ms | -1% |
| task-ls (cached) | 538ms | 547ms | -1% |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
### 🚀 Features - **(env)** add shell-style variable expansion in env values by @jdx in [#8029](#8029) - **(list)** add --all-sources flag to list command by @TylerHillery in [#8019](#8019) ### 🐛 Bug Fixes - **(gem)** Windows support for gem backend by @my1e5 in [#8031](#8031) - **(gem)** revert gem.rs script newline change by @my1e5 in [#8034](#8034) - **(lock)** write tools to lockfile matching their source config by @jdx in [#8012](#8012) - **(ls)** sort sources deterministically in --all-sources output by @jdx in [#8037](#8037) - **(task)** auto-install tools from mise.toml for file tasks by @jdx in [#8030](#8030) ### 📚 Documentation - fix wrong positions of `mise run` flags by @muzimuzhi in [#8036](#8036) ### 📦️ Dependency Updates - update ghcr.io/jdx/mise:copr docker digest to 3e00d7d by @renovate[bot] in [#8023](#8023) - update ghcr.io/jdx/mise:alpine docker digest to 0ced1b3 by @renovate[bot] in [#8022](#8022) ### 📦 Registry - add tirith ([github:sheeki03/tirith](https://github.com/sheeki03/tirith)) by @sheeki03 in [#8024](#8024) - add mas by @TyceHerrman in [#8032](#8032) ### Security - **(deps)** update time crate to 0.3.47 to fix RUSTSEC-2026-0009 by @jdx in [#8026](#8026) ### New Contributors - @sheeki03 made their first contribution in [#8024](#8024) - @TylerHillery made their first contribution in [#8019](#8019) ## 📦 Aqua Registry Updates #### New Packages (1) - [`kubernetes-sigs/kubectl-validate`](https://github.com/kubernetes-sigs/kubectl-validate) #### Updated Packages (6) - [`flux-iac/tofu-controller/tfctl`](https://github.com/flux-iac/tofu-controller/tfctl) - [`gogs/gogs`](https://github.com/gogs/gogs) - [`j178/prek`](https://github.com/j178/prek) - [`syncthing/syncthing`](https://github.com/syncthing/syncthing) - [`tuist/tuist`](https://github.com/tuist/tuist) - [`yaml/yamlscript`](https://github.com/yaml/yamlscript)
## Summary - When running file tasks (scripts in `.mise-tasks/`), tools defined in `mise.toml` were not auto-installed before execution because `t.cf(config)` returns `None` for file tasks - Adds a fallback that uses the task's `config_root` to discover and install tools from the project's config hierarchy, matching what the execution-time toolset build already does - Refactors `collect_tools_from_config_file` to delegate to a new `collect_tools_from_dir` method for reuse Closes jdx#8014 ## Test plan - [x] `mise run build` compiles successfully - [x] `mise run lint-fix` passes all linting - [x] `mise run test:unit` — all 446 tests pass - [ ] Manual test: create a file task in `.mise-tasks/` that uses a tool declared only in `mise.toml`, verify `mise run` auto-installs the tool before execution 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes task tool resolution behavior by expanding when project config hierarchy is consulted, which could affect tool selection/precedence for some task setups; covered by a new E2E regression test. > > **Overview** > Fixes `task_run_auto_install` for *file tasks* (scripts in `mise-tasks/`) by falling back to the task’s `config_root` to load the project config hierarchy when `t.cf(config)` is `None`, ensuring tools in `mise.toml` are discovered and installed before execution. > > Refactors tool discovery by extracting shared logic into `collect_tools_from_dir`, and adds an E2E test (`e2e/tasks/test_task_file_auto_install`) that runs a file task requiring `tiny` and asserts it gets auto-installed. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7fce78f. 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 - **(env)** add shell-style variable expansion in env values by @jdx in [jdx#8029](jdx#8029) - **(list)** add --all-sources flag to list command by @TylerHillery in [jdx#8019](jdx#8019) ### 🐛 Bug Fixes - **(gem)** Windows support for gem backend by @my1e5 in [jdx#8031](jdx#8031) - **(gem)** revert gem.rs script newline change by @my1e5 in [jdx#8034](jdx#8034) - **(lock)** write tools to lockfile matching their source config by @jdx in [jdx#8012](jdx#8012) - **(ls)** sort sources deterministically in --all-sources output by @jdx in [jdx#8037](jdx#8037) - **(task)** auto-install tools from mise.toml for file tasks by @jdx in [jdx#8030](jdx#8030) ### 📚 Documentation - fix wrong positions of `mise run` flags by @muzimuzhi in [jdx#8036](jdx#8036) ### 📦️ Dependency Updates - update ghcr.io/jdx/mise:copr docker digest to 3e00d7d by @renovate[bot] in [jdx#8023](jdx#8023) - update ghcr.io/jdx/mise:alpine docker digest to 0ced1b3 by @renovate[bot] in [jdx#8022](jdx#8022) ### 📦 Registry - add tirith ([github:sheeki03/tirith](https://github.com/sheeki03/tirith)) by @sheeki03 in [jdx#8024](jdx#8024) - add mas by @TyceHerrman in [jdx#8032](jdx#8032) ### Security - **(deps)** update time crate to 0.3.47 to fix RUSTSEC-2026-0009 by @jdx in [jdx#8026](jdx#8026) ### New Contributors - @sheeki03 made their first contribution in [jdx#8024](jdx#8024) - @TylerHillery made their first contribution in [jdx#8019](jdx#8019) ## 📦 Aqua Registry Updates #### New Packages (1) - [`kubernetes-sigs/kubectl-validate`](https://github.com/kubernetes-sigs/kubectl-validate) #### Updated Packages (6) - [`flux-iac/tofu-controller/tfctl`](https://github.com/flux-iac/tofu-controller/tfctl) - [`gogs/gogs`](https://github.com/gogs/gogs) - [`j178/prek`](https://github.com/j178/prek) - [`syncthing/syncthing`](https://github.com/syncthing/syncthing) - [`tuist/tuist`](https://github.com/tuist/tuist) - [`yaml/yamlscript`](https://github.com/yaml/yamlscript)
Summary
.mise-tasks/), tools defined inmise.tomlwere not auto-installed before execution becauset.cf(config)returnsNonefor file tasksconfig_rootto discover and install tools from the project's config hierarchy, matching what the execution-time toolset build already doescollect_tools_from_config_fileto delegate to a newcollect_tools_from_dirmethod for reuseCloses #8014
Test plan
mise run buildcompiles successfullymise run lint-fixpasses all lintingmise run test:unit— all 446 tests pass.mise-tasks/that uses a tool declared only inmise.toml, verifymise runauto-installs the tool before execution🤖 Generated with Claude Code
Note
Medium Risk
Changes task tool resolution behavior by expanding when project config hierarchy is consulted, which could affect tool selection/precedence for some task setups; covered by a new E2E regression test.
Overview
Fixes
task_run_auto_installfor file tasks (scripts inmise-tasks/) by falling back to the task’sconfig_rootto load the project config hierarchy whent.cf(config)isNone, ensuring tools inmise.tomlare discovered and installed before execution.Refactors tool discovery by extracting shared logic into
collect_tools_from_dir, and adds an E2E test (e2e/tasks/test_task_file_auto_install) that runs a file task requiringtinyand asserts it gets auto-installed.Written by Cursor Bugbot for commit 7fce78f. This will update automatically on new commits. Configure here.