Skip to content

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

Description

@petabridge-netclaw

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

Problem

When users opt into the beta release channel via --channel beta, the install script downloads the correct beta binary but does not persist Daemon.UpdateChannel: "beta" into netclaw.json. This causes the daemon's self-update mechanism to default to stable channel (the default) and compare against the latest stable release instead of the latest prerelease.

Symptoms

  • User runs curl ... | bash -s -- --channel beta (or the equivalent on Windows/Docker)
  • The correct beta binary is installed
  • netclaw update --check reports up to date even when a newer beta is available
  • The daemon's background update check also reports no updates

Root Cause

The install scripts (install.sh, install.ps1) accept --channel beta and use it to resolve the version from the manifest's latestPrerelease pointer, but they never write Daemon.UpdateChannel: "beta" to the config file.

Meanwhile, DaemonConfig defaults UpdateChannel to UpdateChannel.Stable when the config key is missing:

// DaemonConfig.cs line 54
public UpdateChannel UpdateChannel { get; init; } = UpdateChannel.Stable;

And the update checker only uses LatestPrerelease when the channel is explicitly beta:

// UpdateCheckService.cs line 258
var targetVersion = channel == UpdateChannel.Beta && !string.IsNullOrEmpty(manifest.LatestPrerelease)
    ? manifest.LatestPrerelease
    : manifest.Latest;

Steps to Reproduce

  1. Install a beta version via install script with --channel beta
  2. Run netclaw update --check
  3. Observe: reports up to date even when a newer beta is available
  4. Fix (manual): jq '.Daemon.UpdateChannel = "beta"' ~/.netclaw/config/netclaw.json

Proposed Fix

Both install.sh and install.ps1 should auto-write Daemon.UpdateChannel: "beta" into the config when --channel beta is passed and an existing config file is present.

For install.sh, a jq-based patch would look like:

if [ "$CHANNEL" = "beta" ] && [ "$DRY_RUN" = false ]; then
    CONFIG_FILE="$HOME/.netclaw/config/netclaw.json"
    if [ -f "$CONFIG_FILE" ] && command -v jq >/dev/null 2>&1; then
        jq '.Daemon.UpdateChannel = "beta"' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && \
            mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
        echo "  Updated UpdateChannel to 'beta' in $CONFIG_FILE"
    fi
fi

The Windows installer should do the equivalent with PowerShell's ConvertFrom-Json / ConvertTo-Json, and Docker instructions should explicitly call out this config requirement.

Affected Files

  • scripts/install.sh
  • scripts/install.ps1
  • docs/getting-started/installation.md (ensure config requirement is prominent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions