Repository navigation
Description
Problem
The fleet binary's root built-in commands silently discard trailing arguments: fleet version <anything>, fleet capabilities <anything>, and fleet --version <anything> all print their normal output and exit 0, whatever follows. The root dispatcher itself is strict everywhere else — an unknown subcommand is a usage error (exit 2) — so a typo'd invocation like fleet version --bogus-flag (or a wrapper passing a stale flag) succeeds silently instead of failing as a usage error.
Same fail-open class as #5560 (fleet-dispatch status, fixed) and #5568 (serve broker roles) — but a different code path: those live in the domain dispatchers; this one is run_root in the top-level binary, whose version / capabilities / --version arms never check args.len().
Evidence (verified this run, laptop primary at e844ed1)
Code — pkgs/fleet/crates/fleet/src/main.rs, run_root:
Some("--version") | Some("-V")arm prints and returnsEXIT_OKunconditionally (the--helparm right above it does guard withargs.len() == 1; these do not).Some("version")→print_version(...)→EXIT_OK, no arity check.Some("capabilities")→print_capabilities(...)→EXIT_OK, no arity check.
Probe (fleet binary rebuilt on the laptop from e844ed1, Source rev: e844ed152dd1):
| invocation | result |
|---|---|
fleet version |
version block, exit 0 (control) |
fleet version --bogus |
identical version block, exit 0 |
fleet capabilities --bogus |
identical JSON, exit 0 |
fleet --version --bogus |
fleet 0.1.0, exit 0 |
fleet versio (control) |
error: unrecognized subcommand 'versio', exit 2 |
Why it matters
These are the exact surfaces scripts and agents parse (fleet version for the census/source rev, fleet capabilities for the capability JSON). A caller passing a misspelled or retired flag gets valid-looking output and a success exit, so version/capability gating in automation silently runs on the wrong assumptions — the fleet has been removing this shape wherever it appears (#5560, #5460, #3287 series) because silent success on a typo is how stale invocations survive migrations.
Acceptance criteria
fleet version <extra>,fleet capabilities <extra>, andfleet --version <extra>/fleet -V <extra>exit 2 with a usage error naming the unexpected argument.- Bare
fleet version,fleet capabilities,fleet --version,fleet -Vare unchanged (same output, exit 0). - The existing
--help-arm arity behavior is unchanged. - A pinning unit test covers the rejection;
cargo test -p fleetpasses on the laptop or in CI.
Activity
developing-today commentedon Nov 4, 2026
CODE-1377
dezren39 commentedon Nov 4, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 4, 2026
🤖 Agent note · picked up
fix(fleet): reject trailing arguments on root built-ins (#5572) (#5574)
dezren39 commentedon Nov 4, 2026
🤖 Agent note · done