Skip to content

fix(task): include args in task output prefix and truncate long prefixes#8533

Merged
jdx merged 2 commits into
mainfrom
fix/task-prefix-with-args
Mar 9, 2026
Merged

fix(task): include args in task output prefix and truncate long prefixes#8533
jdx merged 2 commits into
mainfrom
fix/task-prefix-with-args

Conversation

@jdx

@jdx jdx commented Mar 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Include task arguments in the [prefix] output so parallel runs of the same task with different args are distinguishable (e.g. [test-docker 4.1] vs [test-docker 3.2])
  • Truncate long prefixes to 40 characters to prevent them from consuming too much terminal width

Closes #8531

Test plan

  • Run a task with args as a dependency and verify prefix includes the args
  • Run a task with very long args and verify prefix is truncated with
  • Run tasks without args and verify behavior is unchanged

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to log/prefix formatting and corresponding test expectations, with no impact on task execution semantics or security-sensitive code.

Overview
Task output prefixes now include the task’s CLI args (e.g. [build a]) so concurrent/dep runs of the same task are distinguishable, and long prefixes are truncated to 40 characters with an ellipsis.

E2E task tests were updated to assert the new prefix format for usage-spec tasks and dependency-invoked tasks with args.

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

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]`) and long prefixes are truncated to
40 chars.

Closes #8531

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

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 readability and utility of task output by modifying how task prefixes are generated. It ensures that tasks run with different arguments are clearly distinguishable in logs and prevents overly long prefixes from cluttering the terminal display, thereby improving the user experience for complex task workflows.

Highlights

  • Task Output Prefix: Included task arguments in the output prefix to differentiate parallel runs of the same task with varying arguments (e.g., [test-docker 4.1] vs [test-docker 3.2]).
  • Prefix Truncation: Implemented truncation for long prefixes, limiting them to 40 characters to prevent excessive terminal width consumption, using an ellipsis (…) for shortened parts.
Changelog
  • src/task/mod.rs
    • Modified the prefix method to incorporate task arguments into the generated prefix string.
    • Added logic to truncate the task prefix to a maximum of 40 characters, appending an ellipsis if truncated.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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.

@greptile-apps

greptile-apps Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes a small, UI-only enhancement to the Task::prefix() method: task runtime arguments are now appended to the display name inside the […] prefix (e.g. [build a] instead of [build]), and the inner content is truncated to 40 display columns with a ellipsis to prevent very long task names or arg lists from dominating terminal width.

  • src/task/mod.rs (prefix): Builds inner by joining display_name and args, trims trailing whitespace (handles the no-args case cleanly), then calls console::truncate_str(inner, 40, "…") before wrapping in brackets. Total prefix width is at most 42 terminal columns.
  • e2e/tasks/test_task_run_depends: Updates expected output so parallel build a / b / c invocations each carry their distinguishing arg in the prefix.
  • e2e/tasks/test_task_double_dash_behavior: Updates the with_usage assertion to include the parsed flags/args in the prefix.
  • No changes to execution logic, scheduling, or data handling — purely cosmetic output formatting.

Confidence Score: 5/5

  • This PR is safe to merge — changes are isolated to a single display-formatting function with no impact on execution logic.
  • The change is three lines inside prefix(), which is a pure formatting helper. The trim() correctly handles the empty-args case, truncate_str correctly operates on display width (Unicode-safe), and both e2e tests are updated to match the new expected output. No execution paths, scheduling, or data structures are affected.
  • No files require special attention.

Important Files Changed

Filename Overview
src/task/mod.rs Adds args to prefix output and truncates the inner content to 40 display columns; logic is sound, though console::truncate_str is called via full module path while already directly imported (previously flagged).
e2e/tasks/test_task_run_depends Correctly updates expected prefixes from [build] to [build a/b/c] to match the new args-inclusive prefix format.
e2e/tasks/test_task_double_dash_behavior Correctly updates expected prefix from [with_usage] to [with_usage -x myfile] to reflect the new args-inclusive prefix format.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["prefix() called"] --> B["format!('{} {}', display_name, args.join(' '))"]
    B --> C["inner.trim()"]
    C --> D{"display_width(inner) > 40?"}
    D -- "No" --> E["Use inner as-is"]
    D -- "Yes" --> F["truncate_str(inner, 40, '…')\n→ 39 chars + '…'"]
    E --> G["format!('[{}]', inner)"]
    F --> G
    G --> H["Return prefix string\n(max 42 display cols)"]
Loading

Last reviewed commit: f72a6e7

Comment thread src/task/mod.rs
let max_width = 40;
let inner = format!("{} {}", self.display_name, self.args.join(" "));
let inner = inner.trim();
format!("[{}]", console::truncate_str(inner, max_width, "…"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Redundant module path prefix on imported function

truncate_str is already directly imported on line 10 via use console::{Color, measure_text_width, truncate_str};, and the existing usage at line 1290 calls it without the module prefix. Using the full path console::truncate_str is inconsistent with both.

Suggested change
format!("[{}]", console::truncate_str(inner, max_width, "…"))
format!("[{}]", truncate_str(inner, max_width, "…"))

Fix in Claude Code

@jdx jdx enabled auto-merge (squash) March 9, 2026 13:01

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

Copy link
Copy Markdown
Contributor

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 enhances task output by including arguments in the task prefix, making it easier to differentiate between parallel runs of the same task. It also introduces truncation for long prefixes, limiting them to 40 characters to maintain a clean terminal interface. The implementation is clear and correctly handles various cases, such as tasks with no arguments. The changes are well-contained and achieve the intended improvements.

Note: Security Review did not run due to the size of the PR.

@jdx jdx disabled auto-merge March 9, 2026 13:26
@jdx jdx merged commit 62f3383 into main Mar 9, 2026
34 of 36 checks passed
@jdx jdx deleted the fix/task-prefix-with-args branch March 9, 2026 13:26
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.3.5 x -- echo 25.1 ± 1.1 22.8 31.7 1.00
mise x -- echo 25.3 ± 1.1 23.1 29.6 1.01 ± 0.06

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.3.5 env 24.9 ± 0.7 22.7 27.1 1.00
mise env 25.5 ± 1.0 23.0 37.0 1.02 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.3.5 hook-env 25.5 ± 0.8 23.5 27.8 1.00
mise hook-env 26.1 ± 0.7 24.4 29.3 1.02 ± 0.04

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.3.5 ls 24.1 ± 1.0 22.1 26.9 1.00 ± 0.07
mise ls 24.1 ± 1.4 22.4 40.0 1.00

xtasks/test/perf

Command mise-2026.3.5 mise Variance
install (cached) 155ms 153ms +1%
ls (cached) 85ms 84ms +1%
bin-paths (cached) 88ms 86ms +2%
task-ls (cached) 844ms 826ms +2%

jdx pushed a commit that referenced this pull request Mar 9, 2026
### 🐛 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)
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