Repository navigation
fix(config): a zero control interval or watchdog means unset - #1903
Merged
Merged
Conversation
A settings POST that omits control_interval_s stored 0, and the next boot panicked in time.NewTicker. Fill the two site timings that have no meaning at zero on every decoded document (YAML, stored settings and a plain settings POST), and give boot the tick's <=0 -> 2 s guard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item F5 of the stable plan.
Problem
POST /api/config never fills defaults, Validate accepts 0 for
site.control_interval_s, and a stored-settings load fills no defaults either. A save that leaves out the control interval, or sends 0, returns 200 and stores 0. The running loop goes on at 2 s, so nobody notices. On the next restart or self-update,time.NewTicker(0)panics at main.go:2854 and Core restarts in a loop.The on-box UI can do this with no script: emptying the "Control interval (s)" field sends
parseFloat(""), which becomes 0.A stored
watchdog_timeout_s: 0is broken the same way: several watchdog paths (main.go:2964 and others) would treat every driver as stale.Repro on master: a POST with only
site.nameandsite.smoothing_alpha(plus fuse, api and drivers) returns 200. The reload then readsinterval=0 watchdog=0, and the boot ticker panics with "non-positive interval for NewTicker".Change
config.Site.FillUnsetTimings()treats 0 as unset forcontrol_interval_s(2 s) andwatchdog_timeout_s(60 s).applyDefaultsnow calls it, so the YAML path keeps the same defaults from one place.decodeStoredcalls it, so a box that already stored a 0 starts again.<=0 -> 2 sguard, anddtScomes from the guarded interval.Other site fields keep their stored zeros on purpose. Zero slew means "no limit" (dispatch.go:2186-2193), zero tolerance means no dead band, zero holdoff means no holdoff, and the runtime already ignores zero gain.
Tests
TestPartialConfigPostSurvivesRestart(go/cmd/ftw, from audit worktree caa-109): fails on master with the NewTicker panic, passes here. It now also asserts the reloaded interval is 2 and the watchdog 60.TestStoredZeroTimingsLoadAsDefaults(go/internal/config): a stored 0 loads as 2 s and 60 s, and a stored zero slew stays 0.go test -race -count=1 ./cmd/ftw/... ./internal/api/... ./internal/config/...: ok.go vet ./...andgo build ./...: ok.Risk
Low. A box that stored 0 for either field now runs with the default instead of crashing, or instead of treating every driver as stale. No other stored value changes.
🤖 Generated with Claude Code