Repository navigation
Description
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'spick_transportuses 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 against0, so the session broker exits (code 0, "success") on its first idle ticks regardless of activity.0is 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 againstPORT_DISPATCH(4879). Field at :179.pkgs/fleet/crates/fleet-config/src/lib.rs:319-321—idle_exit_secs(): same shape againstDEFAULT_IDLE_EXIT_SECS(3600). Field at :115.- Consumer, port 0 dialled:
pkgs/fleet/crates/fleet-dispatch/src/lib.rs:152-175—pick_transporttakesconfig.dispatch_port()and uses it for the loopback probe, the direct authority (127.0.0.1:{port}/{target_host}:{port}), and the tunnel; :206 handsconfig.egress_proxy_port()toegress_from_env. The broker path does the same atpkgs/fleet/crates/fleet-proxy/src/serve.rs:589andpkgs/fleet/crates/fleet-proxy/src/stdio.rs:55. - Consumer, idle 0 exits:
pkgs/fleet/crates/fleet-proxy/src/serve.rs:526-543—keepalive_loopreadsidle_exit_secs()once, then everyIDLE_TICK_S(5s, :51) exits the process whennow - last_used > idle; withidle = 0that 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.tomlthat renders a port or timeout as0(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 = 0is 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
egress_proxy_port = 0and[dispatch] port = 0are either rejected at load with a loudConfigErrornaming the field, or treated as unset (documented default applies) — one consistent shape, triage's call, matching however fleet-config: [[proxy.services]] is never validated — duplicate ports silently collapse last-wins in the broker's routing map, and port 0 / empty names load #6397 resolves the services-row port 0 so the crate has a single zero-port rule.idle_exit_secs = 0gets an explicit, documented semantics: either rejected at load, treated as unset (3600), or honoured as "never idle-exit" inkeepalive_loop— it must not silently mean "exit at the first tick".- Pinning tests cover the zero spelling for each of the three accessors alongside the existing
proxy_settings_*/dispatch_settings_*tests; absent and valid values resolve exactly as before. - No change to
[[proxy.services]]handling (fleet-config: [[proxy.services]] is never validated — duplicate ports silently collapse last-wins in the broker's routing map, and port 0 / empty names load #6397) or to env-var handling.
Activity
developing-today commentedon Nov 6, 2026
CODE-1917
dezren39 commentedon Nov 6, 2026
🤖 Agent note · state: filed
new-issue-creator-code-a)dezren39 commentedon Nov 6, 2026
🤖 Agent note · triaged
idle_exit_secs(),egress_proxy_port(), anddispatch_port()in pkgs/fleet/crates/fleet-config/src/lib.rs are still unwrap_or-only — Some(0) always wins. No hard-stop labels; issue OPEN.dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · done (triage)
dezren39 commentedon Nov 6, 2026
🤖 Agent note · picked up (correction)
fix(fleet-config): reject zero scalar numerics at load (#6412) (#6416)
dezren39 commentedon Nov 6, 2026
🤖 Agent note · done
Zero rule shipped:
[proxy] egress_proxy_port = 0,[dispatch] port = 0, and[proxy] idle_exit_secs = 0each failConfig::load_fromwith aConfigError::Parsenaming the field. Verification:cargo test -p fleet-configon the laptop worktree — 15 passed, 0 failed, including the new pinning testzero_scalar_numerics_are_a_loud_error(oracle: issue #6412's acceptance criteria); Codex review completed with no findings; CodeRabbit check SUCCESS.