Repository navigation
fix(task): avoid remote resolution during task startup - #10571
Conversation
📝 WalkthroughWalkthroughAdds prefer-offline early-return fast paths to ChangesOffline Tool Resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit c4deba3. Configure here.
Greptile SummaryThis PR prevents
Confidence Score: 5/5Safe to merge; the offline fast paths are logically correct and auto-install retains its online fallback for missing tools. The core mechanism — forcing offline:true for the initial toolset build in hook-env and mise run, then letting install_missing_versions re-resolve online — is sound. The ToolSource::Argument carve-out correctly preserves online resolution for explicit CLI tool specs. No wrong-data or broken-contract issues were found. No files require special attention; the tool_version.rs redundancies are cosmetic and carry no correctness risk. Important Files Changed
Reviews (4): Last reviewed commit: "fix(toolset): satisfy prefer-offline cli..." | Re-trigger Greptile |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.12 x -- echo |
20.6 ± 1.1 | 18.1 | 26.0 | 1.00 |
mise x -- echo |
21.1 ± 1.6 | 18.5 | 38.8 | 1.03 ± 0.09 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.12 env |
20.3 ± 1.0 | 17.9 | 24.2 | 1.00 |
mise env |
20.9 ± 1.4 | 18.2 | 26.5 | 1.03 ± 0.09 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.12 hook-env |
21.0 ± 1.3 | 18.3 | 25.8 | 1.00 |
mise hook-env |
21.8 ± 1.4 | 19.1 | 26.8 | 1.04 ± 0.09 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.12 ls |
17.7 ± 1.1 | 15.2 | 22.1 | 1.00 |
mise ls |
18.7 ± 0.8 | 16.6 | 21.8 | 1.06 ± 0.08 |
xtasks/test/perf
| Command | mise-2026.6.12 | mise | Variance |
|---|---|---|---|
| install (cached) | 145ms | 147ms | -1% |
| ls (cached) | 66ms | 67ms | -1% |
| bin-paths (cached) | 74ms | 76ms | -2% |
| task-ls (cached) | 131ms | 133ms | -1% |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/toolset/tool_version.rs (1)
378-420: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winClose the no-installed-version fallthrough before remote resolution.
These fast paths only return when a local match exists. If nothing is installed,
prefer_offline && !opts.latest_versionsstill falls through to remote metadata calls forlatest, rolling channels, npm semver ranges, and prefixes;resolve_prefixalso ignores global offline because it checksopts.offlineinstead ofis_offline. Return the raw spec for these local-only modes after the installed-version check.Suggested shape
- let prefer_offline_without_offline = prefer_offline && !is_offline; let should_filter_installed_versions = opts.filters_installed_versions() && !is_offline && !prefer_offline; if v == "latest" { - if prefer_offline_without_offline - && !opts.latest_versions - && let Some(v) = backend.latest_installed_version(None)? - { - return build(v); + if prefer_offline && !opts.latest_versions { + if let Some(v) = backend.latest_installed_version(None)? { + return build(v); + } + return build(v); }if prefer_offline && !opts.latest_versions && let Some(installed) = backend.latest_installed_channel_version(&v) { return build(installed); } + if prefer_offline && !opts.latest_versions { + return build(v); + }if prefer_offline && !opts.latest_versions { let installed_versions = backend.list_installed_versions(); if let Some(matches) = crate::semver::npm_semver_range_filter(&installed_versions, &v) && let Some(v) = matches.last() { return build(v.clone()); } + return build(v); }if prefer_offline && !opts.latest_versions && let Some(v) = backend.list_installed_versions_matching(prefix).last() { return Ok(Self::new(request, v.to_string())); } + if prefer_offline && !opts.latest_versions { + return Ok(Self::new(request, prefix.to_string())); + } ... - if opts.offline { + if is_offline { return Ok(Self::new(request, prefix.to_string())); }Also applies to: 432-457, 473-516, 612-625
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/toolset/tool_version.rs` around lines 378 - 420, The "latest" version resolution block is falling through to remote metadata calls even when in local-only mode (prefer_offline_without_offline && !opts.latest_versions). After the installed-version checks using backend.latest_installed_version(None)?, add an early return of the raw spec value (v, which is "latest") if prefer_offline_without_offline && !opts.latest_versions conditions are met but no installed version was found. This prevents unnecessary remote resolution attempts for local-only modes and should be applied similarly in the other affected sections mentioned in the comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/toolset/tool_version.rs`:
- Around line 378-420: The "latest" version resolution block is falling through
to remote metadata calls even when in local-only mode
(prefer_offline_without_offline && !opts.latest_versions). After the
installed-version checks using backend.latest_installed_version(None)?, add an
early return of the raw spec value (v, which is "latest") if
prefer_offline_without_offline && !opts.latest_versions conditions are met but
no installed version was found. This prevents unnecessary remote resolution
attempts for local-only modes and should be applied similarly in the other
affected sections mentioned in the comment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 98fef5a3-428f-4b8e-88cc-dced771b6e96
📒 Files selected for processing (2)
src/cli/hook_env.rssrc/toolset/tool_version.rs

Summary
latest, rolling channels, npm semver ranges, and prefixes instead of falling through to remote metadatamise runbuild its initial task toolset in offline resolution mode; auto-install still re-resolves missing tools online when installation is actually neededhook-env,mise run --skip-tools, and task startup with auto-install disabled do not invokegithub.credential_commandfor agithub:latesttool withminimum_release_ageTests
cargo fmt --checkcargo check --bin misemise run test:e2e e2e/cli/test_hook_env_prefer_offline_no_remote_versions e2e/tasks/test_task_skip_toolsNote
Medium Risk
Changes core version resolution and shell/task startup paths; wrong offline behavior could pin wrong versions or skip needed installs, but auto-install still re-resolves online when installation is required.
Overview
Shell activation and task runs no longer hit the network to resolve tool versions during startup.
hook-envbuilds its toolset withResolveOptions { offline: true }, andmise rundoes the same for the initial toolset after tasks resolve; missing tools can still be installed online when auto-install actually runs.Prefer-offline resolution is tightened in
tool_version.rs: CLIToolSource::Argumentrequests are excluded from prefer-offline shortcuts, and when prefer-offline applies (without full offline), resolution stops at installed versions forlatest, rolling channels, npm semver ranges inpackage.json, and prefix specs—avoiding fall-through to remote metadata (e.g. GitHub releases that would rungithub.credential_command).E2E tests assert
hook-envandmise run(with--skip-toolsorauto_install = false) do not invoke a fake credential command forgithub:cli/cli@latestwithminimum_release_ageset.Reviewed by Cursor Bugbot for commit 9c81ce2. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
mise runto resolve tool versions with offline-first behavior to avoid remote version metadata lookups and prevent credential command invocations during task startup.mise hook-envto build its toolset using offline resolve, reducing network dependence during hook activation.latest, rolling channels, and semver-range handling.