Skip to content

fix(tasks): fix tool inheritance from intermediate parents#7637

Merged
jdx merged 1 commit intojdx:mainfrom
chadxz:chadxz/mise-monorepo-tasks-intermediate-tool-inheritance
Jan 11, 2026
Merged

fix(tasks): fix tool inheritance from intermediate parents#7637
jdx merged 1 commit intojdx:mainfrom
chadxz:chadxz/mise-monorepo-tasks-intermediate-tool-inheritance

Conversation

@chadxz
Copy link
Contributor

@chadxz chadxz commented Jan 11, 2026

Why?

When running a monorepo task like mise run //parent/child:task, tools defined in intermediate parent directories (e.g., parent/mise.toml) were not being inherited by child tasks. Only tools from the monorepo root were inherited.

How?

Created a reproduction at chadxz/mise-monorepo-tasks-tool-inheritance demonstrating the bug, then traced through the code to find where config files are loaded for monorepo tasks.

src/toolset/builder.rs: Added with_config_files() method to ToolsetBuilder, allowing custom config files to be used instead of config.config_files. This enables monorepo tasks to use config files from their directory hierarchy.

src/task/task_context_builder.rs: build_toolset_for_task now loads config files from the task's directory using load_config_hierarchy_from_dir(task_dir) and passes them to ToolsetBuilder via with_config_files(). This ensures tools are inherited from intermediate parents and ensures MISE_*_VERSION environment variable overrides are applied.

src/task/task_tool_installer.rs: collect_tools_from_config_file now loads the full config hierarchy so tools from parent directories are installed. Caching behavior is retained using the existing tool_request_set_cache to avoid re-parsing individual config files when multiple tasks share config files in their hierarchies.

src/config/mod.rs: Made ConfigMap type crate-public for use by ToolsetBuilder.

e2e/tasks/test_task_monorepo_tool_inheritance_intermediate: New test validating intermediate parent tool inheritance.

e2e/tasks/test_task_monorepo_env_version_override: New test validating MISE_*_VERSION env overrides work for monorepo tasks.


Note

Ensures monorepo task execution uses the correct config context and environment overrides.

  • Toolset composition: ToolsetBuilder adds with_config_files() to accept custom config_files; load_config_files uses these when provided.
  • Task context: build_toolset_for_task loads hierarchy via load_config_hierarchy_from_dir(...), builds with with_config_files(...), and retains caching.
  • Tool installation: collect_tools_from_config_file traverses the config hierarchy, de-duplicates tools, and caches per-file tool request sets.
  • Config visibility: makes ConfigMap crate-public for reuse by the builder.
  • Tests: adds e2e/tasks/test_task_monorepo_tool_inheritance_intermediate and e2e/tasks/test_task_monorepo_env_version_override validating inheritance and MISE_*_VERSION behavior.

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

@jdx
Copy link
Owner

jdx commented Jan 11, 2026

Bugbot run

@chadxz chadxz force-pushed the chadxz/mise-monorepo-tasks-intermediate-tool-inheritance branch 4 times, most recently from f2754df to c2f993e Compare January 11, 2026 22:43
@jdx
Copy link
Owner

jdx commented Jan 11, 2026

bugbot run

@chadxz chadxz force-pushed the chadxz/mise-monorepo-tasks-intermediate-tool-inheritance branch from c2f993e to b3365df Compare January 11, 2026 22:52
## Why?

When running a monorepo task like `mise run //parent/child:task`, tools
defined in intermediate parent directories (e.g., `parent/mise.toml`)
were not being inherited by child tasks. Only tools from the monorepo
root were inherited.

## How?

Created a reproduction at [chadxz/mise-monorepo-tasks-tool-inheritance](https://github.com/chadxz/mise-monorepo-tasks-tool-inheritance) demonstrating the bug, then traced through the code to find where config files are loaded for monorepo tasks.

**src/toolset/builder.rs**: Added `with_config_files()` method to ToolsetBuilder, allowing custom config files to be used instead of `config.config_files`. This enables monorepo tasks to use config files from their directory hierarchy.

**src/task/task_context_builder.rs**: `build_toolset_for_task` now loads config files from the task's directory using `load_config_hierarchy_from_dir(task_dir)` and passes them to ToolsetBuilder via `with_config_files()`. This ensures tools are inherited from intermediate parents and ensures MISE_*_VERSION environment variable overrides are applied.

**src/task/task_tool_installer.rs**: `collect_tools_from_config_file` now loads the full config hierarchy so tools from parent directories are installed. Caching behavior is retained using the existing `tool_request_set_cache` to avoid re-parsing individual config files when multiple tasks share config files in their hierarchies.

**src/config/mod.rs**: Made `ConfigMap` type crate-public for use by ToolsetBuilder.

**e2e/tasks/test_task_monorepo_tool_inheritance_intermediate**: New test validating intermediate parent tool inheritance.

**e2e/tasks/test_task_monorepo_env_version_override**: New test validating MISE_*_VERSION env overrides work for monorepo tasks.
@chadxz chadxz force-pushed the chadxz/mise-monorepo-tasks-intermediate-tool-inheritance branch from b3365df to e89874f Compare January 11, 2026 22:55
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 bugs!

@chadxz
Copy link
Contributor Author

chadxz commented Jan 11, 2026

I ran Cursor Bugbot on this myself again as well as reviews from Gemini 3 Pro and GPT 5.2-High and Opus 4.5. Happy to do anything further.

@jdx jdx merged commit b83f047 into jdx:main Jan 11, 2026
32 checks passed
jdx pushed a commit that referenced this pull request Jan 13, 2026
### 🐛 Bug Fixes

- **(backend)** filter pre-release versions with latest + install_before
by @koh-sh in [#7631](#7631)
- **(docs)** formatting in configuration hierarchy section by
@jonathanagustin in [#7638](#7638)
- **(npm)** migrate npm publish to OIDC trusted publishing by @jdx in
[#7607](#7607)
- **(registry)** correct checkmake version test pattern by @jdx in
[#7632](#7632)
- **(release)** handle empty grep result in aqua-registry changelog by
@jdx in
[f45b4c6](f45b4c6)
- **(self-update)** self-update fails across year boundary due to semver
mismatch by @jdx in [#7611](#7611)
- **(tasks)** fix tool inheritance from intermediate parents by @chadxz
in [#7637](#7637)
- add `-test` to VERSION_REGEX prerelease filter by @belgio99 in
[#7647](#7647)

### 📚 Documentation

- **(tasks)** remove documentation for unimplemented features by
@turbocrime in [#7599](#7599)
- update `mise aliases` references to `mise tool-alias` by @muzimuzhi in
[#7615](#7615)
- use call operator in PowerShell profile example by @shina1024 in
[#7639](#7639)
- replace ASCII .pub key with binary .gpg for signed-by on Ubuntu/Debian
by @gmalinowski in [#7649](#7649)

### 🛡️ Security

- **(security)** prevent code execution from untrusted fork in
registry-comment workflow by @jdx in
[4a2441e](4a2441e)

### ◀️ Revert

- Revert "fix(release): handle empty grep result in aqua-registry
changelog" by @jdx in
[522ffdc](522ffdc)
- Revert "chore(release): include manually updated aqua-registry entries
in the changelog " by @jdx in
[1ebb943](1ebb943)

### 📦️ Dependency Updates

- update ghcr.io/jdx/mise:alpine docker digest to fbfffcf by
@renovate[bot] in [#7619](#7619)
- lock file maintenance by @renovate[bot] in
[#7646](#7646)

### 📦 Registry

- add hatoo/oha tool by @jylenhof in
[#7633](#7633)

### Chore

- **(registry)** fix registry comment workflow by @risu729 in
[#7554](#7554)
- **(release)** include manually updated aqua-registry entries in the
changelog by @risu729 in [#7603](#7603)

### New Contributors

- @belgio99 made their first contribution in
[#7647](#7647)
- @gmalinowski made their first contribution in
[#7649](#7649)
- @chadxz made their first contribution in
[#7637](#7637)
- @shina1024 made their first contribution in
[#7639](#7639)
- @jonathanagustin made their first contribution in
[#7638](#7638)
- @turbocrime made their first contribution in
[#7599](#7599)

## 📦 Aqua Registry Updates

#### New Packages (3)

- [`ampcode/zvelte-check`](https://github.com/ampcode/zvelte-check)
- [`nickel-lang/nickel`](https://github.com/nickel-lang/nickel)
- [`openshift/rosa`](https://github.com/openshift/rosa)
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