Repository navigation
fix(selfupdate): save the update channel on first boot - #1899
Merged
Merged
Conversation
A box installed from a beta tag stored no channel, so Core inferred it from the running version. After the box installed the promoted stable, the version had no beta suffix and the box moved to the stable channel without being asked. Save the inferred channel the first time a release build boots with none stored. Dev builds save nothing; SetChannel and the edge migration are unchanged. Item G1-fix of the stable plan. 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 G1-fix of the stable plan.
Problem
Core picks the update channel from
update.channelin state.db. OnlySetChanneland the old edge migration write that key. A box installed withinstall.sh --tag v0.X.Y-beta.Nnever stores one, so Core infers the channel from the running version (selfupdate.go:228,inferChannelat:874).The beta channel offers promoted stables on purpose. So:
v0.158.0-beta.3with no stored channel. It infers beta and is offeredv0.158.0.v0.158.0and restarts.inferChannel("v0.158.0")returns stable.v0.159.0-beta.1publishes. The box reportsupdate_available=falseand never sees another beta.Every validation site installed by tag would leave beta at the first stable promotion. The plan's gate G7 needs this fix in a beta that those sites run first, so each saves
betawhile it still runs a beta build.Change
In
New, when no channel is stored and the running version is a beta or stable tag, save the inferred channel. Dev builds (Version = "dev") save nothing.SetChannel, the edge migration and a stored channel all behave as before.The plan also says to store the channel when an update is accepted. I left that out: an update runs on a release build, which has already saved its channel at boot, so a second write would change nothing.
Tests
TestNew_BetaBoxStaysOnBetaAfterStablePromotion: the audit's repro (caa-69), renamed. It fails on master withchannel flipped to "stable" only because the version string changedand passes here.TestNew_DevBuildSavesNoChannel: new.cd go && go test -race -count=1 ./internal/selfupdate/... ./internal/api/... ./internal/ftwcli/...: ok.go test -race -count=1 ./cmd/ftw/ -run 'Native|Fleet|Update|Version': ok.go vet ./...andgo build ./...: clean.Risk
Low. It touches only the selfupdate KV, not control or dispatch. One change in behaviour: a box that stores
stableand is later pinned to a beta tag (for example to test a hotfix) stays on stable afterwards. Today it would flip to beta. The owner can still change the channel withftw update --channel beta.🤖 Generated with Claude Code