Skip to content

fix(completions): stop -- from hijacking task argument completion - #11711

Merged
jdx merged 2 commits into
mainfrom
claude/usage-v5
Aug 4, 2026
Merged

fix(completions): stop -- from hijacking task argument completion#11711
jdx merged 2 commits into
mainfrom
claude/usage-v5

Conversation

@jdx

@jdx jdx commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Problem

The release branch is red on a single e2e test, tasks/test_task_completion_global_cd, in both the test and release workflows. It is not a mise regression — jdx/usage v5.0.0 published today at 14:15Z, and that test pins usage = "latest" with MISE_MINIMUM_RELEASE_AGE=0s specifically so it picks up new releases immediately. The same release commit passed at 13:34 and failed at 14:33.

expected 'alpha  beta  gamma' but got 'mise.toml  mise.usage.kdl'

Cause

mise tasks --usage (the spec mounted for task completion) appended a hidden [-- ARGS_LAST] catch-all, so words forwarded past -- would complete instead of erroring with unexpected word.

jdx/usage#762 made an explicit -- route the positional cursor onto whichever arg declared the separator, past earlier args. That catch-all then swallowed the word being completed, so mise run <task> -- <TAB> fell back to filenames instead of offering the task's own choices — on the run, tasks run, and naked paths alike.

Fix

Spell the overflow arg as a plain trailing variadic ([ARGS]…) rather than a ---gated one. It still absorbs forwarded words, but no longer claims --, so completion descends into the task's declared args.

Simply deleting the catch-all was not enough — that fixed the choices but regressed the other direction, making mise tasks run build -- -c <TAB> fail with unexpected word: -c (covered by tasks/test_task_completion). The plain variadic satisfies both.

Verified byte-identical behavior on usage 4.1.0 and 5.0.0 across every path:

completion 4.1.0 5.0.0
mise run sample:run -- <TAB> choices choices
mise tasks run sample:run -- <TAB> choices choices
mise sample:run -- <TAB> (naked) choices choices
mise -C . run sample:run -- <TAB> choices choices
mise run -r/--force sample:run -- <TAB> choices choices
mise tasks run build -- -c <TAB> files files
task flags / flag choices unchanged unchanged

Because the fix is version-agnostic, min_usage_version stays at 4.0 and users on usage 4 are unaffected.

v5 bump

Second commit moves usage-lib to 5 and the pinned usage dev tool in mise.lock to 5.0.0. Regenerated mise.usage.kdl and docs/cli are byte-identical, so no spec or docs churn. clap_usage (via aube) still pulls usage-lib 4.1.0 transitively.

This supersedes #11707, which bumps only Cargo.toml/Cargo.lock — its green checks predate the 5.0.0 CLI existing, so they do not cover this failure.

Testing

  • cargo clippy --workspace --all-features --all-targets -- -D warnings — clean
  • mise run test:unit — 2464 passed
  • mise run test:e2e over 25 tests covering task completion, usage specs, double-dash, and arg/flag parsing — all pass, with the harness resolving usage@latest to 5.0.0

Ordered fix-then-bump so neither commit is red in isolation.

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.220.


Note

Low Risk
Targeted completion-spec and dependency bump with broad e2e coverage; behavior is intended to match usage 4 and 5.

Overview
Fixes task shell completion after usage v5 changed how an explicit -- routes the positional cursor (jdx/usage#762). The hidden overflow arg on mounted task specs is renamed from [-- ARGS_LAST]… to a plain trailing [ARGS]… in display_usage, so mise run <task> -- <TAB> still offers the task’s declared choices instead of filenames, while extra forwarded args are still absorbed.

Also bumps usage-lib to 5 and the pinned usage dev tool in mise.lock to 5.0.0; bash/fish completions switch type -p to type -P for locating the usage binary. E2e expectations and comments are updated accordingly.

Reviewed by Cursor Bugbot for commit 20fc8a8. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • Improved task argument completion after --, preserving task-defined choices while supporting additional forwarded arguments.
    • Updated task usage displays to consistently show additional arguments as [ARGS]….
    • Improved shell completion detection for the required usage command.
    • Clarified completion behavior for cases where filename fallback may occur.

The mounted task spec carried a hidden `[-- ARGS_LAST]` catch-all so that words
forwarded past `--` would still complete instead of erroring with "unexpected
word". jdx/usage#762 made an explicit `--` route the positional cursor onto
whichever arg declared the separator, past earlier args — so that catch-all
started swallowing the word being completed, and `mise run <task> -- <TAB>`
offered filenames instead of the task's own choices.

Spell the overflow arg as a plain trailing variadic instead. It still absorbs
forwarded words, but no longer claims `--`, so completion reaches the task's
declared args. Verified identical on usage 4.1.0 and 5.0.0 across the `run`,
`tasks run`, and naked paths.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change upgrades usage-lib to version 5, changes task usage completion to use a hidden variadic ARGS parameter, updates end-to-end expectations, and uses type -P for shell executable checks.

Changes

Task completion behavior

Layer / File(s) Summary
Task argument forwarding
Cargo.toml, src/cli/tasks/ls.rs, e2e/tasks/test_task_usage, e2e/tasks/test_task_completion_global_cd
usage-lib is upgraded to version 5. Task completion replaces hidden -- ARGS_LAST with ARGS. Usage expectations and separator-dependent completion comments are updated.
Shell executable lookup
completions/mise.bash, completions/mise.fish
Bash and Fish completion scripts use type -P when checking for the usage executable.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • jdx/mise#11284: Modifies task argument completion and forwarding after --.
  • jdx/mise#11336: Modifies task argument forwarding and variadic argument handling.

Suggested reviewers: mise-en-dev

Poem

A rabbit reviews the ARGS change,
Completion follows its expected range.
Usage output now shows the new form,
Shell checks use a clearer norm.
Version five joins the update.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing task argument completion when -- is used.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​usage-lib@​5.0.0981009310070

View full report

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates task completion specifications so a hidden trailing variadic absorbs forwarded arguments without claiming --, and upgrades the direct usage tooling to version 5.

  • Replaces [-- ARGS_LAST]… with [ARGS]… in mounted task specifications.
  • Adds completion regression coverage and updates task-usage expectations.
  • Upgrades direct usage-lib and the pinned usage CLI while retaining transitive usage-lib 4.1.0 where required.
  • Regenerates Bash and Fish completion scripts.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/cli/tasks/ls.rs Changes the hidden overflow argument to a plain trailing variadic so explicit -- remains available for task-declared positional completion.
e2e/tasks/test_task_completion_global_cd Documents and exercises task-choice completion after -- across run, tasks-run, global-flag, and local-flag paths.
e2e/tasks/test_task_usage Updates expected generated task specifications to the new [ARGS]… overflow shape.
Cargo.toml Upgrades the direct usage-lib dependency from major version 4 to 5.
Cargo.lock Resolves usage-lib 5.0.0 for mise while retaining usage-lib 4.1.0 for clap_usage.
mise.lock Pins the development usage CLI and platform artifacts to version 5.0.0.
completions/mise.bash Regenerates the Bash completion script with the usage v5 executable lookup form.
completions/mise.fish Regenerates the Fish completion script with the usage v5 executable lookup form.

Reviews (2): Last reviewed commit: "chore(deps): update usage-lib and usage-..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ██▂▂▁▁▁ 75,756,139 → 75,738,839 -0.02% 17.48 → 18.11ms +3.65%
hook-env ██▂▂▁▁▁ 77,264,675 → 77,178,219 -0.11% 18.88 → 19.30ms +2.25%
ls ██▂▂▁▁▁ 68,552,212 → 68,494,162 -0.08% 16.06 → 16.77ms +4.44%
registry ▇▇██▃▂▁ 48,756,853 → 48,697,412 -0.12% 12.12 → 13.36ms +10.20%
startup ████▁▁▁ 15,382,342 → 15,374,136 -0.05% 9.25 → 9.37ms +1.33%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

20fc8a8c30a5 vs 0fe8c9bc6841 · measured on the runner, not pushed to the history.

Bumps mise's own spec generation to usage-lib 5 and the pinned `usage` dev tool
in mise.lock to 5.0.0. The generated `mise.usage.kdl` and `docs/cli` output are
byte-identical, so `min_usage_version` stays at 4.0 — the spec makes no use of
anything v5-only, and mise's completions work on both.

Regenerated completions pick up jdx/usage#760: the bash/fish guard now uses
`type -P` instead of `type -p`, so an environment defining a `usage` shell
function (e.g. oh-my-bash) no longer passes the guard and then fails further
down with an unrelated error.

clap_usage (via aube) still pulls usage-lib 4.1.0 transitively.
@jdx
jdx force-pushed the claude/usage-v5 branch from c1c1607 to 20fc8a8 Compare August 4, 2026 19:47

jdx commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Pushed a fix for the failing lint check: mise run render produced uncommitted changes to completions/mise.bash and completions/mise.fish.

That diff is jdx/usage#760 coming along with the v5 bump — the generated completion guard switches from type -p to type -P, so an environment that defines a usage shell function (e.g. oh-my-bash) no longer passes the guard and then fails further down with an unrelated error. Real improvement, just needed regenerating.

Amended into the bump commit rather than added on top, so mise run render stays clean at both commits.

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.220.

@jdx
jdx enabled auto-merge (squash) August 4, 2026 19:56
@jdx
jdx merged commit 80f6b9e into main Aug 4, 2026
31 checks passed
@jdx
jdx deleted the claude/usage-v5 branch August 4, 2026 20:08
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