fix: persist Daemon.UpdateChannel in install scripts and wizard#1377
Merged
Aaronontheweb merged 6 commits intoJun 10, 2026
Merged
Conversation
…law-dev#1371) Install scripts accept --channel beta but never wrote the channel preference to config, causing the daemon's self-update to silently default to stable. Now both install.sh and install.ps1 patch Daemon.UpdateChannel into netclaw.json after binary extraction. The init wizard also preserves an existing beta channel from config so running `netclaw init` after a beta install doesn't lose the preference. DaemonConfigSection gains an UpdateChannel? property and BuildConfigDictionary emits it when set.
- Guard config patch with CHANNEL_EXPLICIT / PSBoundParameters so plain upgrades don't silently overwrite an existing beta channel to stable - Seed a minimal config on fresh --channel beta installs so netclaw init can discover the channel preference - Fix Windows config path: use $env:USERPROFILE\.netclaw to match NetclawPaths (was incorrectly using $env:LOCALAPPDATA) - Fix install.sh success echo printing after jq failure by replacing the && chain with an if/then/else that cleans up the .tmp file - Convert DaemonConfigSection from class to record so PreserveExistingUpdateChannel can use `with` expression instead of a manual property copy that would silently drop future properties
Extract TryReadExistingUpdateChannel with typed catch clauses (JsonException, IOException, ArgumentException) instead of a bare catch block that slopwatch flags.
Replace hand-rolled JsonNode parsing with the existing Microsoft.Extensions.Configuration pipeline and DaemonConfig.BindFromConfiguration, matching how the rest of the codebase reads netclaw.json.
Aaronontheweb
commented
Jun 10, 2026
Cover all four config-patching scenarios (fresh seed, patch existing, preserve on plain upgrade, overwrite on channel change) in both bash and PowerShell smoke harnesses. Also fix install.ps1 config path to match NetclawPaths ($USERPROFILE\.netclaw\config) and add NETCLAW_CONFIG_DIR env var override for testability.
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.
Summary
Fixes #1371 — install scripts accept
--channel betabut never persisted the channel preference intonetclaw.json, causing the daemon's self-update mechanism to silently default to stable.install.sh,install.ps1): when--channelis explicitly passed, patch or seedDaemon.UpdateChannelinto the config. Guarded withCHANNEL_EXPLICIT/PSBoundParametersso plain upgrades don't silently overwrite an existing beta preference.--channel betais passed and no config exists yet, a minimal seed config is written sonetclaw initcan discover the channel preference.WizardConfigBuilder):PreserveExistingUpdateChannel()reads an existing beta channel from the config before the wizard overwrites it, soinstall --channel beta+netclaw initdoesn't lose the preference.DaemonConfigSection: newUpdateChannel?property; converted fromclasstorecordso property copies usewithexpressions.install.ps1now uses$env:USERPROFILE\.netclawto matchNetclawPaths(was incorrectly using$env:LOCALAPPDATA).Test plan
WizardConfigBuilderTests— 7 new tests covering: beta channel emission, combined channel + exposure mode, null channel omission, preservation through wizard rewrite, stable not preserved (it's the default), explicit builder channel takes precedenceExposureModeStepViewModelTests— all 54 existing tests passbash -n scripts/install.sh— syntax valid