Skip to content

fleet-config: zero numeric values are never validated — egress_proxy_port=0 and dispatch port=0 dial port 0, and idle_exit_secs=0 makes the broker exit within seconds #6412

Closed

Description

@dezren39

fleet-config: zero numeric values are never validated — egress_proxy_port=0 and dispatch port=0 dial port 0, and idle_exit_secs=0 makes the broker exit within seconds

Summary

fleet-config's numeric accessors only substitute a default when the value is absent — a configured 0 passes through verbatim for all three numeric settings, and 0 is a broken value for every one of them:

  • [proxy] egress_proxy_port = 0 — the egress CONNECT dial targets port 0, which no proxy can listen on; every tunnel attempt fails with a connection error that names the connection, not the config.
  • [dispatch] port = 0 — the dispatch client probes, dials directly, and tunnels to port 0 (fleet-dispatch's pick_transport uses this one port for all three transports); pm-dispatch is unreachable and the errors again point at the network.
  • [proxy] idle_exit_secs = 0 — the broker's keepalive loop compares elapsed idle time against 0, so the session broker exits (code 0, "success") on its first idle ticks regardless of activity. 0 is also the spelling an operator would naturally choose to mean "never idle-exit" — it currently means the exact opposite: exit almost immediately.

This breaks the crate's stated config policy (crate docs, lib.rs:14-17): a malformed config is a loud error, never a silent fallback. A zero port / zero timeout in a templated fleet.toml is a misspelling-class error, and the crate already validates the neighbouring shapes (#6397 covers the [[proxy.services]] rows' port 0; the scalar numeric fields here are the unvalidated remainder). Distinct from #2758 (pm-dispatch's own Bun-side env parsing) and #2835 (env-number parsing design) — these values arrive as typed TOML integers, so nothing ever parses or range-checks them.

Evidence (file:line, origin/main @ 2871969)

  • pkgs/fleet/crates/fleet-config/src/lib.rs:332-336 — egress_proxy_port(): self.proxy.egress_proxy_port.unwrap_or(DEFAULT_EGRESS_PROXY_PORT) — Some(0) wins over the default (3130). Field at :121.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:405-408 — dispatch_port(): same shape against PORT_DISPATCH (4879). Field at :179.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:319-321 — idle_exit_secs(): same shape against DEFAULT_IDLE_EXIT_SECS (3600). Field at :115.
  • Consumer, port 0 dialled: pkgs/fleet/crates/fleet-dispatch/src/lib.rs:152-175 — pick_transport takes config.dispatch_port() and uses it for the loopback probe, the direct authority (127.0.0.1:{port} / {target_host}:{port}), and the tunnel; :206 hands config.egress_proxy_port() to egress_from_env. The broker path does the same at pkgs/fleet/crates/fleet-proxy/src/serve.rs:589 and pkgs/fleet/crates/fleet-proxy/src/stdio.rs:55.
  • Consumer, idle 0 exits: pkgs/fleet/crates/fleet-proxy/src/serve.rs:526-543 — keepalive_loop reads idle_exit_secs() once, then every IDLE_TICK_S (5s, :51) exits the process when now - last_used > idle; with idle = 0 that condition is true at the first tick where a second has elapsed since the last request — the broker cannot stay up.

Verification (this run, laptop, real fleet-config crate @ origin/main 2871969)

Probe ~/git/fleet/probe-fleet-config-zero (extracted pkgs/fleet tree at origin/main; an example bin added to the copy drives the real fleet-config crate's Config::load_from on written temp fleet.toml files):

egress_zero:   load Ok, egress_proxy_port()=0
dispatch_zero: load Ok, dispatch_port()=0
idle_zero:     load Ok, idle_exit_secs()=0
control_default: egress=3130 dispatch=4879 idle=3600
control_set:     egress=3131 dispatch=4880 idle=60
dial_port0:    Err kind=ConnectionRefused msg=Connection refused (os error 111)

Every zero case loads with no error and surfaces 0; defaults and valid values resolve exactly as documented; a dial to port 0 is refused — the failure the dispatch/egress paths will report, with no mention of the config value that caused it.

Why it matters

  • A generated or templated fleet.toml that renders a port or timeout as 0 (an unset template variable's classic output) does not fail at load: dispatch and egress fail later as opaque connection refusals, and the broker flaps — starting, exiting 0 within seconds, being restarted — with every log line pointing away from the one-line config mistake.
  • idle_exit_secs = 0 is worse than a typo: "0 disables the timeout" is the common convention for this exact knob shape, so the value most likely to be written deliberately produces the most destructive reading of it.

Acceptance criteria

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. added
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 6, 2026
  6. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

  7. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triage)

  8. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up (correction)

  9. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    Zero rule shipped: [proxy] egress_proxy_port = 0, [dispatch] port = 0, and [proxy] idle_exit_secs = 0 each fail Config::load_from with a ConfigError::Parse naming the field. Verification: cargo test -p fleet-config on the laptop worktree — 15 passed, 0 failed, including the new pinning test zero_scalar_numerics_are_a_loud_error (oracle: issue #6412's acceptance criteria); Codex review completed with no findings; CodeRabbit check SUCCESS.

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

Metadata

Metadata

Assignees

No one assigned

    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/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions