Skip to content

fix(task): resolve dependencies before prepare to fix monorepo glob deps#8353

Merged
jdx merged 2 commits intomainfrom
fix/prepare-monorepo-deps
Feb 26, 2026
Merged

fix(task): resolve dependencies before prepare to fix monorepo glob deps#8353
jdx merged 2 commits intomainfrom
fix/prepare-monorepo-deps

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Feb 26, 2026

Summary

  • When a root task depends on a monorepo glob pattern like //...:check, the prepare step was only collecting config files from top-level tasks (which have no cf field for subdirectory configs)
  • Fix by calling resolve_depends() before running prepare, so transitive dependencies from monorepo subdirectories are discovered and their prepare providers are included
  • Adds e2e test covering the glob dependency case

Reported by @NfNitLoop in NfNitLoop@4b462b6

Test plan

  • mise run test:e2e test_prepare passes including new test case
  • New test verifies that mise run //:check (root task depending on //...:check) triggers subapp prepare steps

🤖 Generated with Claude Code


Note

Medium Risk
Changes task resolution/execution ordering and dependency handling in mise run, which could affect which tasks run and when; covered by an added e2e regression test.

Overview
Fixes mise run in monorepos where root tasks depending on monorepo glob patterns (e.g. //...:check) could skip subdirectory auto-prepare steps.

run now resolves transitive dependencies once up front and uses that resolved task list both to collect subdirectory config files for PrepareEngine and to drive execution, and prepare_tasks no longer re-resolves dependencies internally. Adds an e2e regression test ensuring subapp prepare runs when the subtask is pulled in via depends = "//...:check".

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

When a root task depends on a monorepo glob pattern like `//...:check`,
the prepare step was only collecting config files from the top-level
tasks returned by `get_task_lists()`. Since the root task has no `cf`
field, subdirectory prepare providers were never discovered.

Fix by calling `resolve_depends()` before running prepare, so transitive
dependencies from monorepo subdirectories are included when collecting
config files for the prepare engine.

Reported-by: NfNitLoop (NfNitLoop@4b462b6)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 a critical bug in how mise handles prepare steps within monorepos, specifically when tasks rely on glob patterns to include sub-project dependencies. By adjusting the order of dependency resolution, it ensures that all necessary prepare providers from subdirectories are correctly identified and executed, thereby preventing missed setup steps for monorepo tasks.

Highlights

  • Monorepo prepare step fix: Resolved an issue where the prepare step failed to collect config files from monorepo subdirectories when a root task depended on a glob pattern (e.g., //...:check).
  • Dependency resolution order: Modified the task execution flow to call resolve_depends() before the prepare step, ensuring that transitive dependencies from monorepo subdirectories are discovered and their prepare providers are included.
  • New e2e test: Added an end-to-end test case to specifically cover and validate the fix for monorepo glob dependencies and their prepare steps.
Changelog
  • e2e/cli/test_prepare
    • Added a new e2e test case to verify that prepare steps run for subtasks reached via monorepo glob dependencies.
  • src/cli/run.rs
    • Modified the Run command's prepare logic to resolve all transitive dependencies before collecting subdirectory config files for prepare providers.
Activity
  • The issue was reported by @NfNitLoop.
  • The author has confirmed that mise run test:e2e test_prepare passes, including the new test case.
  • The new test verifies that mise run //:check correctly triggers subapp prepare steps.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where prepare steps for tasks in monorepo subdirectories were not being executed when those tasks were included via a glob dependency from a root task. The fix involves resolving all transitive dependencies before the prepare step to discover all necessary prepare providers. The change is accompanied by a new end-to-end test that validates the fix.

The implementation is correct and solves the problem. However, it introduces a performance inefficiency by calling resolve_depends twice. I've left a comment with a suggestion for a refactoring to address this, which could be handled in a follow-up.

src/cli/run.rs Outdated
let subdir_configs: Vec<_> = task_list
// Resolve transitive dependencies to discover all tasks (including
// those from monorepo subdirectories referenced via glob patterns)
let all_tasks = resolve_depends(&config, task_list.clone()).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This call to resolve_depends is necessary to fix the issue with monorepo glob dependencies for prepare steps. However, this introduces a performance issue as resolve_depends is called again inside parallelize_tasks (via prepare_tasks), leading to redundant dependency resolution.

To avoid this, consider resolving dependencies once before the prepare step and passing the fully resolved task list to parallelize_tasks. This would require modifying prepare_tasks to not call resolve_depends again.

Example refactoring:

In Run::run:

// ...
let task_list = get_task_lists(&config, &args, true, self.skip_deps).await?;
// ... (handle args_last)

let all_tasks = resolve_depends(&config, task_list).await?;

if !self.no_prepare {
    // ... use all_tasks to get subdir_configs and run prepare engine
}

// ...
self.parallelize_tasks(config, all_tasks).await?

Then, in Run::prepare_tasks, you would remove the resolve_depends call. Since prepare_tasks is not in this diff, this could be a good follow-up refactoring to improve performance.

@greptile-apps
Copy link

greptile-apps bot commented Feb 26, 2026

Greptile Summary

Fixes PrepareEngine to discover transitive task dependencies in monorepo mode by calling resolve_depends before collecting subdirectory config files. When a root task depends on a glob pattern like //...:check, the prepare step now correctly includes config files from matched subdirectory tasks.

Key changes:

  • Calls resolve_depends early to discover all tasks (including those matched by glob patterns)
  • Uses resolved all_tasks instead of task_list when collecting config files for PrepareEngine
  • Adds regression test verifying that //:check with depends = "//...:check" triggers subapp prepare steps

Note: This introduces a second call to resolve_depends (first for PrepareEngine, then later in prepare_tasks at line 524). While this duplicate resolution could impact performance in large monorepos, it appears architecturally necessary since PrepareEngine must run before the main task preparation flow.

Confidence Score: 4/5

  • Safe to merge with minor performance consideration
  • The fix correctly addresses the reported issue and includes proper test coverage. However, it introduces duplicate resolve_depends calls (lines 316 and 524) which could impact performance in large monorepos with complex dependency graphs. The change affects a critical execution path but is well-isolated and necessary for the PrepareEngine to discover transitive dependencies.
  • src/cli/run.rs warrants attention due to the duplicate dependency resolution

Important Files Changed

Filename Overview
src/cli/run.rs Adds early resolve_depends call to discover transitive task dependencies for PrepareEngine; introduces potential performance overhead from duplicate dependency resolution
e2e/cli/test_prepare Adds regression test for glob dependency pattern (//...:check) to ensure subapp prepare steps run correctly

Sequence Diagram

sequenceDiagram
    participant User
    participant Run
    participant TaskList
    participant PrepareEngine
    participant Tasks

    User->>Run: mise run //:check
    Run->>TaskList: get_task_lists (root tasks)
    TaskList-->>Run: [root task with depends="//...:check"]
    
    Note over Run,PrepareEngine: NEW: Early dependency resolution
    Run->>TaskList: resolve_depends (discover transitive deps)
    TaskList-->>Run: all_tasks (includes subapp tasks)
    
    Run->>Run: Extract cf (config files) from all_tasks
    Run->>PrepareEngine: add_config_files (subdir configs)
    Run->>PrepareEngine: run (auto_only=true)
    PrepareEngine-->>Run: Prepare steps executed
    
    Note over Run,Tasks: Existing flow continues
    Run->>Run: parallelize_tasks (with original task_list)
    Run->>TaskList: resolve_depends (again in prepare_tasks)
    TaskList-->>Run: Resolved tasks for execution
    Run->>Tasks: Execute tasks
Loading

Last reviewed commit: b83b833

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.20 x -- echo 28.5 ± 0.5 27.6 32.5 1.03 ± 0.03
mise x -- echo 27.7 ± 0.5 26.8 30.3 1.00

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.20 env 27.0 ± 0.6 26.2 31.3 1.00
mise env 27.0 ± 0.4 26.2 28.9 1.00 ± 0.03

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.20 hook-env 27.8 ± 0.5 26.9 32.5 1.00
mise hook-env 27.9 ± 0.5 27.0 29.9 1.00 ± 0.02

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.20 ls 24.9 ± 0.4 24.1 26.5 1.00
mise ls 25.1 ± 0.5 24.1 30.6 1.01 ± 0.03

xtasks/test/perf

Command mise-2026.2.20 mise Variance
install (cached) 167ms 167ms +0%
ls (cached) 95ms 94ms +1%
bin-paths (cached) 99ms 98ms +1%
task-ls (cached) 838ms 842ms +0%

Move resolve_depends() call before the prepare step and pass the
already-resolved task list to parallelize_tasks/prepare_tasks, avoiding
the duplicate dependency resolution work. Also removes the need to clone
task_list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jdx jdx merged commit 503ecdf into main Feb 26, 2026
35 checks passed
@jdx jdx deleted the fix/prepare-monorepo-deps branch February 26, 2026 01:53
mise-en-dev added a commit that referenced this pull request Feb 26, 2026
### 🐛 Bug Fixes

- **(exec)** respect PATH order for virtualenv resolution in mise x by
@jdx in [#8342](#8342)
- **(task)** revert process group changes that cause hangs with nested
mise tasks by @jdx in [#8347](#8347)
- **(task)** resolve vars from subdirectory configs for monorepo tasks
by @jdx in [#8343](#8343)
- **(task)** resolve dependencies before prepare to fix monorepo glob
deps by @jdx in [#8353](#8353)
- python noarch with Conda backend by @wolfv in
[#8349](#8349)

### New Contributors

- @wolfv made their first contribution in
[#8349](#8349)

## 📦 Aqua Registry Updates

#### New Packages (3)

- [`alexhallam/tv`](https://github.com/alexhallam/tv)
- [`arcanist-sh/hx`](https://github.com/arcanist-sh/hx)
- [`dathere/qsv`](https://github.com/dathere/qsv)

#### Updated Packages (3)

- [`astral-sh/ruff`](https://github.com/astral-sh/ruff)
- [`caarlos0/fork-cleaner`](https://github.com/caarlos0/fork-cleaner)
- [`rhysd/actionlint`](https://github.com/rhysd/actionlint)
risu729 pushed a commit to risu729/mise that referenced this pull request Feb 27, 2026
…eps (jdx#8353)

## Summary
- When a root task depends on a monorepo glob pattern like
`//...:check`, the prepare step was only collecting config files from
top-level tasks (which have no `cf` field for subdirectory configs)
- Fix by calling `resolve_depends()` before running prepare, so
transitive dependencies from monorepo subdirectories are discovered and
their prepare providers are included
- Adds e2e test covering the glob dependency case

Reported by @NfNitLoop in
NfNitLoop@4b462b6

## Test plan
- [x] `mise run test:e2e test_prepare` passes including new test case
- [x] New test verifies that `mise run //:check` (root task depending on
`//...:check`) triggers subapp prepare steps

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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes task resolution/execution ordering and dependency handling in
`mise run`, which could affect which tasks run and when; covered by an
added e2e regression test.
> 
> **Overview**
> Fixes `mise run` in monorepos where root tasks depending on monorepo
glob patterns (e.g. `//...:check`) could skip subdirectory auto-prepare
steps.
> 
> `run` now resolves transitive dependencies once up front and uses that
resolved task list both to collect subdirectory config files for
`PrepareEngine` and to drive execution, and `prepare_tasks` no longer
re-resolves dependencies internally. Adds an e2e regression test
ensuring subapp prepare runs when the subtask is pulled in via `depends
= "//...:check"`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6db4594. 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>
risu729 pushed a commit to risu729/mise that referenced this pull request Feb 27, 2026
### 🐛 Bug Fixes

- **(exec)** respect PATH order for virtualenv resolution in mise x by
@jdx in [jdx#8342](jdx#8342)
- **(task)** revert process group changes that cause hangs with nested
mise tasks by @jdx in [jdx#8347](jdx#8347)
- **(task)** resolve vars from subdirectory configs for monorepo tasks
by @jdx in [jdx#8343](jdx#8343)
- **(task)** resolve dependencies before prepare to fix monorepo glob
deps by @jdx in [jdx#8353](jdx#8353)
- python noarch with Conda backend by @wolfv in
[jdx#8349](jdx#8349)

### New Contributors

- @wolfv made their first contribution in
[jdx#8349](jdx#8349)

## 📦 Aqua Registry Updates

#### New Packages (3)

- [`alexhallam/tv`](https://github.com/alexhallam/tv)
- [`arcanist-sh/hx`](https://github.com/arcanist-sh/hx)
- [`dathere/qsv`](https://github.com/dathere/qsv)

#### Updated Packages (3)

- [`astral-sh/ruff`](https://github.com/astral-sh/ruff)
- [`caarlos0/fork-cleaner`](https://github.com/caarlos0/fork-cleaner)
- [`rhysd/actionlint`](https://github.com/rhysd/actionlint)
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.

1 participant