Skip to content

fix(tasks): restore tool loading from idiomatic version files#6559

Merged
jdx merged 4 commits intomainfrom
fix/task-idiomatic-version-file
Oct 6, 2025
Merged

fix(tasks): restore tool loading from idiomatic version files#6559
jdx merged 4 commits intomainfrom
fix/task-idiomatic-version-file

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Oct 6, 2025

Summary

Fixes regression where tasks were unable to access tools from idiomatic version files (e.g., .node-version) when idiomatic_version_file_enable_tools was configured.

Issue

Since v2025.10.3, the monorepo task support changes caused tasks to only use tools from their defining config file instead of all config files in the hierarchy. This meant that tools from idiomatic version files like .node-version were no longer available in task PATH.

Root Cause

The issue was in build_toolset_for_task() in src/cli/run.rs. When a task had a config file reference (task_cf), the code would build a toolset from ONLY that config file using task_cf.to_toolset(). This excluded tools from other config files in the same directory, such as .node-version files.

The monorepo logic was intended to use subdirectory config files for monorepo tasks, but it incorrectly applied this logic to ALL tasks that had a config_source, not just monorepo tasks.

Solution

The fix distinguishes between:

  1. Monorepo tasks (those with task.cf set) - use the monorepo-specific toolset building logic
  2. Regular tasks - use the standard toolset build that includes ALL config files in the hierarchy

This is done by checking task.cf.is_some() before applying the monorepo logic.

Test Plan

  • Added new e2e test test_task_idiomatic_version_file that verifies tasks can use tools from .node-version files
  • Verified existing monorepo tests still pass
  • Manually tested that tasks now correctly use tools from idiomatic version files

🤖 Generated with Claude Code


Note

Restores task tool resolution from idiomatic version files and corrects monorepo inheritance by merging global and subdirectory toolsets; adds e2e tests covering both cases.

  • Tasks/Tool Resolution:
    • Only use task-specific config context for monorepo tasks (task.cf present).
    • Build toolset from all global configs, then merge the subdirectory config (task_cf) so parent tools are inherited and idiomatic version files (e.g., .node-version) are honored.
    • Keep caching behavior; standard toolset path continues to include all configs.
  • E2E Tests:
    • e2e/tasks/test_task_idiomatic_version_file: verifies tasks use tools from .node-version when idiomatic_version_file_enable_tools is set.
    • e2e/tasks/test_task_monorepo_tool_inheritance: validates root inheritance, overrides, and multi-level inheritance for Node versions in monorepo tasks.

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

Fixes regression where tasks were unable to access tools from idiomatic
version files (e.g., .node-version) when idiomatic_version_file_enable_tools
was configured.

The issue was introduced in the monorepo task support where tasks would
only use tools from their defining config file instead of all config files
in the hierarchy. This change ensures:

1. Non-monorepo tasks use the standard toolset build that includes ALL
   config files (including idiomatic version files)
2. Monorepo tasks (those with task.cf set) continue to use their specific
   config file context as intended

The fix checks task.cf.is_some() to determine if a task is truly a monorepo
task before using monorepo-specific toolset building logic.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 6, 2025 12:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a regression introduced in v2025.10.3 where tasks could no longer access tools from idiomatic version files (like .node-version) when idiomatic_version_file_enable_tools was configured. The issue occurred because the monorepo task logic was incorrectly applied to all tasks with a config source, not just actual monorepo tasks.

  • Modified the toolset building logic to distinguish between monorepo tasks and regular tasks
  • Added proper condition check to only apply monorepo-specific toolset building for actual monorepo tasks
  • Added comprehensive e2e test to verify tasks can use tools from idiomatic version files

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/cli/run.rs Updated build_toolset_for_task() to only use task-specific config context for actual monorepo tasks by checking both task_cf.is_some() and task.cf.is_some()
e2e/tasks/test_task_idiomatic_version_file Added new e2e test that verifies tasks can access tools from .node-version files with idiomatic_version_file_enable_tools enabled

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

jdx and others added 2 commits October 6, 2025 12:28
Fixes issue where monorepo subdirectory tasks were not inheriting tools
from parent config files, only using tools defined in their own config.

The previous implementation only used `task_cf.to_toolset()` which returns
tools from a single config file. This meant that if a subdirectory's
mise.toml didn't define any tools, the task would have no tools available,
even if parent configs defined them.

The fix:
1. Build a base toolset from all global config files (which includes parent
   configs in the monorepo hierarchy)
2. Merge the subdirectory's config file tools on top, allowing subdirectories
   to override parent tools

This ensures proper tool inheritance while still allowing subdirectories to
override specific tool versions as needed.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Fixes clippy::unnecessary_unwrap warning by using if let pattern
matching instead of checking is_some() and then calling unwrap().

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

Co-Authored-By: Claude <noreply@anthropic.com>
@jdx jdx enabled auto-merge (squash) October 6, 2025 12:39
@jdx jdx merged commit 84523b5 into main Oct 6, 2025
26 checks passed
@jdx jdx deleted the fix/task-idiomatic-version-file branch October 6, 2025 12:40
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 6, 2025

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.3 x -- echo 22.0 ± 0.3 21.4 25.3 1.00
mise x -- echo 22.0 ± 0.2 21.5 23.4 1.00 ± 0.02

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.3 env 21.1 ± 0.6 20.6 27.1 1.00
mise env 21.2 ± 0.2 20.8 22.4 1.00 ± 0.03

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.3 hook-env 20.7 ± 0.3 20.3 24.3 1.00
mise hook-env 21.0 ± 0.9 20.4 30.5 1.01 ± 0.05

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.3 ls 18.2 ± 0.2 17.8 20.6 1.00
mise ls 18.4 ± 0.6 17.9 26.0 1.02 ± 0.03

xtasks/test/perf

Command mise-2025.10.3 mise Variance
install (cached) 238ms ✅ 126ms +88%
ls (cached) 75ms 75ms +0%
bin-paths (cached) 83ms 82ms +1%
task-ls (cached) 589ms 556ms +5%

✅ Performance improvement: install cached is 88%

jdx added a commit that referenced this pull request Oct 6, 2025
## Summary

Creates comprehensive documentation for monorepo tasks in a dedicated
page and updates related documentation to reference it.

## Changes

- **New documentation**: `docs/tasks/monorepo.md` - comprehensive guide
covering:
  - Overview and benefits
  - Configuration and setup
  - Task path syntax (absolute, current directory, wildcards)
  - Tool inheritance from parent configs (new feature documented)
  - Performance tuning
  - Best practices
  - Troubleshooting

- **Updated references**:
- `docs/tasks/task-configuration.md` - replaced full monorepo section
with link to new doc
- `docs/configuration.md` - added mention of tool inheritance feature
and updated link

## Why

The monorepo task information was embedded in the task configuration
page, making it hard to find and navigate. With the recent addition of
tool inheritance support (#6559), this seemed like a good time to:

1. Give monorepo tasks their own dedicated documentation page
2. Make it easier to discover and understand the feature
3. Consolidate all monorepo-related information in one place
4. Document the new tool inheritance behavior

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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds a comprehensive Monorepo Tasks doc and updates existing docs to
point to it, noting tool/env inheritance and simplifying the monorepo
root wording.
> 
> - **Docs**:
> - **New**: `docs/tasks/monorepo.md` — overview, target path syntax
(`//`, `:`), wildcards (`...`, `*`), tool/env inheritance, discovery
rules, listing, performance tuning, best practices.
>   - **Updated**:
> - `docs/tasks/task-configuration.md` — replace detailed monorepo
section with a brief enablement note and link to `Monorepo Tasks`.
> - `docs/configuration.md` — simplify monorepo root wording, add
inheritance note (“Subdirectory tasks inherit tools from parent
configs”), and update link to `Monorepo Tasks`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0a9ca2f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude <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.

2 participants