Skip to content

fix: persist Daemon.UpdateChannel in install scripts and wizard#1377

Merged
Aaronontheweb merged 6 commits into
netclaw-dev:devfrom
Aaronontheweb:fix/install-script-update-channel
Jun 10, 2026
Merged

fix: persist Daemon.UpdateChannel in install scripts and wizard#1377
Aaronontheweb merged 6 commits into
netclaw-dev:devfrom
Aaronontheweb:fix/install-script-update-channel

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1371 — install scripts accept --channel beta but never persisted the channel preference into netclaw.json, causing the daemon's self-update mechanism to silently default to stable.

  • Install scripts (install.sh, install.ps1): when --channel is explicitly passed, patch or seed Daemon.UpdateChannel into the config. Guarded with CHANNEL_EXPLICIT / PSBoundParameters so plain upgrades don't silently overwrite an existing beta preference.
  • Fresh installs: when --channel beta is passed and no config exists yet, a minimal seed config is written so netclaw init can discover the channel preference.
  • Init wizard (WizardConfigBuilder): PreserveExistingUpdateChannel() reads an existing beta channel from the config before the wizard overwrites it, so install --channel beta + netclaw init doesn't lose the preference.
  • DaemonConfigSection: new UpdateChannel? property; converted from class to record so property copies use with expressions.
  • Windows path fix: install.ps1 now uses $env:USERPROFILE\.netclaw to match NetclawPaths (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 precedence
  • ExposureModeStepViewModelTests — all 54 existing tests pass
  • bash -n scripts/install.sh — syntax valid
  • PowerShell parser validation — syntax valid
  • Copyright headers verified

…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.
Comment thread src/Netclaw.Cli/Tui/Wizard/WizardConfigBuilder.cs Outdated
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.
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) June 10, 2026 02:20
@Aaronontheweb Aaronontheweb merged commit 3550f61 into netclaw-dev:dev Jun 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install scripts do not auto-set Daemon.UpdateChannel when using --channel beta

1 participant