Skip to content

fleet: serve <broker-role> silently ignores all trailing arguments — a typo'd flag starts the daemon instead of erroring #5568

Closed

Description

@dezren39

Problem

fleet serve <broker-role> <anything> silently discards every argument after the role and starts the daemon anyway. The broker entry points take no arguments at all, so there is nothing for a stray argument to bind to — a typo'd flag or an extra word does not produce an error, it produces a running queue-broker / secrets-broker.

This is the un-fixed remainder of #5488: that fix intercepted a help flag in the one position after the role (wants_domain_help), but any non-help argument in the same position — and any argument at all through the argv0 aliases — still flows straight into the daemon entry point.

Evidence (verified this run, laptop primary at e844ed1)

Code:

  • pkgs/fleet/crates/fleet/src/main.rs — run_domain: for serve + queue-broker it calls fleet_queue::queue_broker::run() and for secrets-broker fleet_queue::secrets_broker::run(), never inspecting args[1..]. The argv0-alias route (queue-broker / secrets-broker as argv0) lands in the same run_domain after the implied role arg is prepended, so it has the same hole.
  • pkgs/fleet/crates/fleet-queue/src/queue_broker.rs:589 — pub fn run() -> i32 (no args).
  • pkgs/fleet/crates/fleet-queue/src/secrets_broker.rs:189 — pub fn run() -> i32 (no args).

Probe (fleet binary rebuilt on the laptop from e844ed1, Source rev: e844ed152dd1; HOME pointed at an empty dir so the daemon dies at its first startup step — the token-file read — proving which path was entered):

invocation result
fleet serve queue-broker --help domain help, exit 0 (control — #5488 fix works)
fleet serve queue-broker queue-broker: cannot read token file …, exit 3 (daemon startup)
fleet serve queue-broker --bogus-junk identical token-file error, exit 3
fleet serve queue-broker frobnicate identical token-file error, exit 3
fleet serve secrets-broker --bogus-junk secrets-broker: cannot read token file …, exit 3
queue-broker --bogus-junk (argv0 alias) identical token-file error, exit 3

With the real token files present the same invocations proceed past the token read to binding the broker port (observed with the pre-fix binary: cannot bind 100.99.113.103:4801: Address already in use — it had entered run() far enough to attempt the bind).

Why it matters

These brokers hold the queue's service-role credentials path and the secrets resolver. A systemd unit, wrapper script, or operator invocation with a typo'd or stale flag (e.g. a removed --bind option, exactly the shape #5488's test comment worries about) silently starts a daemon with default bind/token settings instead of failing loudly — the same fail-open shape the fleet has been stamping out in #5560 (dispatch status), #5460 (fleet-config) and the deploy-script series (#3287/#3297/#3296).

Acceptance criteria

  • fleet serve queue-broker <any extra arg> and fleet serve secrets-broker <any extra arg> exit 2 with a usage error naming the unexpected argument, before any daemon startup (no token-file read, no bind attempt).
  • The argv0 aliases behave identically: queue-broker <extra> / secrets-broker <extra> exit 2.
  • fleet serve <role> --help / -h / help still prints domain help with exit 0 (fleet: serve <role> --help (and the queue-broker/secrets-broker argv0 aliases) starts the daemon instead of printing help #5488 behavior preserved), and a bare fleet serve <role> still starts the daemon.
  • A pinning unit test covers the rejection (in the style of the existing wants_domain_help tests in crates/fleet/src/main.rs).
  • cargo test -p fleet passes on the laptop or in CI.

Activity

  1. developing-today commented on Nov 4, 2026

    @developing-today
    Contributor
  2. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 4, 2026
  3. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run 2026-11-04T15:35Z
    • Found via: self-assigned during new-issue-creator-code-a run (guarded self-solve, lifecycle protocol §4 — filed this run, trivial, no safety labels)
    • Task: reject trailing args after the queue-broker/secrets-broker roles in run_domain (exit 2 usage error) + pinning test; branch creator-a/5568-serve-broker-args; queue task 9662 cancelled as self-assigned in the same pass.
    • Expectation: effort/xs — done = PR merged with cargo test -p fleet green on the laptop and the fixed binary re-probed (junk → exit 2, --help → exit 0, bare role → daemon path).
    • Links: task 9662 (cancelled, self-assigned)
  5. added
    work/self-assignedAn agent grabbed this item directly, outside the queue
    and removed on Nov 4, 2026
  6. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run 2026-11-04T15:35Z
    • Found via: filed this run
    • Task: Stand-down correction to my "picked up" note above: the guarded self-solve takeover raced a queue claim — task 9662 was already claimed by the queue worker when the cancel ran (cancel_repo_task: task 9662 is not queued or parked). Per lifecycle protocol §6 Duty 4, the first holder keeps the item: the queue worker holds task 9662; I am NOT self-solving. Labels reset to the claimed state (queue/claimed + work/assigned + status/in-progress).
    • Expectation: effort/xs — the claiming worker implements the acceptance criteria in the issue body.
    • Links: task 9662 (claimed, repo-health-code-pilot)
  7. 48 remaining items

  8. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 5, 2026
  9. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-w — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-w posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-w: verified: PR #6323 implements fix, Codex clean, but branch diverged/conflicted vs current main; resolving conflict on laptop, re-running cargo test -p fleet, then merge

  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-w: implementation_complete: PR #6323 conflict resolved (merge 375b717, both helpers kept), cargo test -p fleet 15 unit + 7 integration passed on laptop, rustfmt clean, PR mergeable; checking Codex/checks on new head then merge

  12. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (fixed_merged)

  13. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-w (outcome: done). fixed_merged: PR #6323 merged 5edd83a (conflict vs main resolved in merge 375b717 keeping both helpers; cargo test -p fleet 15 unit + 7 integration passed on laptop, rustfmt clean, Codex re-review of new head clean); issue #5568 closed by merge; note #5568 (comment) heartbeat chain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/fleetpkgs/fleet multicall binary + platform crateskind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions