fix(task): only include args in task prefix when disambiguating duplicates#8536
Conversation
Summary of ChangesHello, 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 enhances the 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
|
c001344 to
6dd4eef
Compare
Greptile SummaryThis PR improves Key changes:
Correctness notes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["mise run greet alice ::: greet bob"] --> B["prepare_tasks()"]
B --> C["Deps::new(config, tasks)"]
C --> D["Build DiGraph<Task>"]
D --> E["mark_ambiguous_prefixes()"]
E --> F{{"Group nodes by display_name"}}
F --> G["greet alice\ngreet bob → count = 2"]
G --> H["Set show_args_in_prefix = true\nfor both nodes"]
H --> I["is_linear()"]
I --> J["subscribe() → emit leaves"]
J --> K["Task cloned from graph\n(carries show_args_in_prefix)"]
K --> L["task.prefix()"]
L --> M{{"show_args_in_prefix\n&& args not empty?"}}
M -- Yes --> N["[greet alice]\n[greet bob]"]
M -- No --> O["[greet]\n(single run or different tasks)"]
style N fill:#d4edda,stroke:#28a745
style O fill:#cce5ff,stroke:#007bff
|
There was a problem hiding this comment.
Code Review
This pull request introduces a useful feature for disambiguating task output prefixes when the same task is run multiple times with different arguments. The implementation is logical and the addition of an E2E test is great for ensuring correctness. I have a couple of suggestions to improve the implementation slightly.
Note: Security Review is unavailable for this PR.
| let mut name_counts: HashMap<String, usize> = HashMap::new(); | ||
| for idx in self.graph.node_indices() { | ||
| *name_counts | ||
| .entry(self.graph[idx].display_name.clone()) | ||
| .or_default() += 1; | ||
| } | ||
| let ambiguous: HashSet<String> = name_counts | ||
| .into_iter() | ||
| .filter(|(_, count)| *count > 1) | ||
| .map(|(name, _)| name) | ||
| .collect(); | ||
| if ambiguous.is_empty() { | ||
| return; | ||
| } | ||
| for idx in self.graph.node_indices() { | ||
| if ambiguous.contains(&self.graph[idx].display_name) { | ||
| self.graph[idx].show_args_in_prefix = true; | ||
| } | ||
| } |
There was a problem hiding this comment.
This implementation iterates over the graph nodes twice. You can make this more efficient and arguably clearer by iterating once to group task indices by name, and then iterating over the groups to mark the ambiguous ones.
let mut name_to_indices: HashMap<String, Vec<petgraph::graph::NodeIndex>> = HashMap::new();
for idx in self.graph.node_indices() {
name_to_indices
.entry(self.graph[idx].display_name.clone())
.or_default()
.push(idx);
}
for indices in name_to_indices.values() {
if indices.len() > 1 {
for &idx in indices {
self.graph[idx].show_args_in_prefix = true;
}
}
}| let inner = format!("{} {}", self.display_name, self.args.join(" ")); | ||
| let inner = inner.trim(); | ||
| format!("[{}]", console::truncate_str(inner, max_width, "…")) | ||
| let inner = if self.show_args_in_prefix && !self.args.is_empty() { |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 x -- echo |
23.1 ± 0.4 | 22.3 | 28.3 | 1.00 |
mise x -- echo |
23.2 ± 0.4 | 22.6 | 27.2 | 1.01 ± 0.02 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 env |
23.7 ± 1.6 | 21.9 | 43.5 | 1.00 |
mise env |
24.0 ± 0.6 | 22.7 | 26.5 | 1.01 ± 0.07 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 hook-env |
24.7 ± 0.7 | 23.4 | 31.1 | 1.00 |
mise hook-env |
24.9 ± 0.5 | 23.7 | 26.7 | 1.00 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 ls |
23.6 ± 0.4 | 22.6 | 24.9 | 1.00 |
mise ls |
24.2 ± 0.4 | 23.0 | 25.9 | 1.02 ± 0.03 |
xtasks/test/perf
| Command | mise-2026.3.5 | mise | Variance |
|---|---|---|---|
| install (cached) | 157ms | 158ms | +0% |
| ls (cached) | 86ms | 87ms | -1% |
| bin-paths (cached) | 89ms | 89ms | +0% |
| task-ls (cached) | 865ms | 851ms | +1% |
…cates When the same task runs multiple times with different arguments (e.g. as dependencies in a test matrix), all output was prefixed with just the task name, making it impossible to distinguish runs. Now args are included in the prefix (e.g. `[test-docker 4.1]`) only when multiple instances of the same task are in the execution graph. Single-instance tasks keep the clean `[task]` prefix without args. Closes #8531 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6dd4eef to
38889a9
Compare
### 🐛 Bug Fixes - **(activate)** reorder shims to front of PATH on re-source in fish by @jdx in [#8534](#8534) - **(backend)** strip mise shims from dependency_env PATH to prevent fork bomb by @pose in [#8475](#8475) - **(github)** resolve "latest" version correctly via GitHub API by @jdx in [#8532](#8532) - **(lock)** set env tags and clarify lockfile docs by @jdx in [#8519](#8519) - **(lock)** use separate mise.<env>.lock files instead of env tags by @jdx in [#8523](#8523) - **(task)** include args in task output prefix and truncate long prefixes by @jdx in [#8533](#8533) - **(task)** only include args in task prefix when disambiguating duplicates by @jdx in [#8536](#8536) - **(test)** pin goreleaser version in attestation e2e test by @jdx in [#8518](#8518) - **(windows)** env._.source needs to run bash.exe on Windows (fix #6513) by @pjeby in [#8520](#8520) - handle locked .exe shims on Windows during reshim by @davireis in [#8517](#8517) ### 🚜 Refactor - **(prepare)** remove touch_outputs and update docs to reflect blake3 hashing by @jdx in [#8535](#8535) ### 📚 Documentation - **(docker)** replace jdxcode/mise image with curl install, update to debian:13-slim by @jdx in [#8526](#8526) - fix "gzip: stdin is encrypted" error in shell tricks cookbook by @pjeby in [#8512](#8512) ### 📦 Registry - add tigerbeetle ([github:tigerbeetle/tigerbeetle](https://github.com/tigerbeetle/tigerbeetle)) by @risu729 in [#8514](#8514) ### New Contributors - @pjeby made their first contribution in [#8520](#8520) - @davireis made their first contribution in [#8517](#8517) - @Aurorxa made their first contribution in [#8511](#8511) ## 📦 Aqua Registry Updates #### New Packages (6) - [`betterleaks/betterleaks`](https://github.com/betterleaks/betterleaks) - [`majorcontext/moat`](https://github.com/majorcontext/moat) - [`princjef/gomarkdoc`](https://github.com/princjef/gomarkdoc) - [`remko/age-plugin-se`](https://github.com/remko/age-plugin-se) - [`sudorandom/fauxrpc`](https://github.com/sudorandom/fauxrpc) - [`swanysimon/mdlint`](https://github.com/swanysimon/mdlint) #### Updated Packages (1) - [`moonrepo/moon`](https://github.com/moonrepo/moon)
Summary
When the same task runs multiple times with different arguments (e.g.
mise run greet alice ::: greet bob), all output was prefixed with just the task name ([greet]), making it impossible to distinguish which run produced which output.Now args are included in the prefix only when needed:
[greet alice]and[greet bob][greet](no args, clean prefix)[greet]and[build](no disambiguation needed)Long prefixes are truncated to 40 characters.
How it works: After building the dependency graph,
mark_ambiguous_prefixes()counts tasks bydisplay_name. Tasks that share a name getshow_args_in_prefix = true, whichprefix()checks before formatting.Closes #8531
Test plan
test_task_prefix_args_disambiguationvalidates all three scenarios (duplicate task with args, single task, different tasks)test_task_help_with_cdpasses (no regression on--arg passthrough)test_task_delegation_deduppasses (no regression on shared deps)🤖 Generated with Claude Code
Note
Low Risk
Behavior change is limited to task output prefix formatting and is guarded by targeted E2E coverage; minimal risk outside of tooling/log-parsing expectations.
Overview
Improves task output labeling by including args in the prefix only when needed to disambiguate multiple executions of the same
display_name(e.g. parallelgreet alicevsgreet bob), while keeping single-run prefixes clean.This introduces a per-task
show_args_in_prefixflag set during dependency graph preparation (Deps::mark_ambiguous_prefixes, invoked afterDeps::newandDeps::new_pruned), and updatesTask::prefix()to conditionally append args and still truncate to 40 chars.Adds an E2E test for prefix disambiguation and updates an existing double-dash/usage-spec test expectation to match the new prefix behavior.
Written by Cursor Bugbot for commit 38889a9. This will update automatically on new commits. Configure here.