#1539·OpenAlice

Windows update/install host: keep in-box PowerShell 5.1 or require pwsh 7?

Author: 2233adminCreated Sep 18, 2026Updated Sep 18, 2026

Context

PR #1538 fixes a hard failure in the Windows update path (openalice update aborted with [System.Byte] does not contain a method named 'Trim' before downloading anything). That fix decodes byte[] response bodies inside Download-Text, which keeps the installer working on any PowerShell host.

While diagnosing it, the obvious alternative came up: why not require PowerShell 7 (pwsh) and run the installer there? This issue is that separate product decision. It is not needed for #1538.

What was measured

Same Windows host, same URL (.../openalice-cli-0.93.1-beta.2-win32-x64.tar.gz.sha256), Invoke-WebRequest -UseBasicParsing, under Set-StrictMode -Version 2:

host version .Content type .Trim()
pwsh 7.6.6 System.Byte[] fails: [System.Byte] ... does not contain a method named 'Trim'
powershell 5.1.26100.9444 System.Byte[] same failure

Invoke-WebRequest returns byte[] for binary content types (GitHub release assets are served as application/octet-stream) on both hosts, so requiring pwsh would not have prevented the bug.

Today's host choice is deliberate

  • packages/cli/src/update.mjs runs the installer with %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe - hard-coded, no PATH lookup, no pwsh.
  • packages/cli/src/uninstall.mjs uses the same host for the deferred uninstall bootstrap, and uninstall.spec.mjs asserts that command shape.
  • scripts/windows-cli-preview-smoke.ts runs the Windows acceptance smoke through 5.1 on purpose: "GitHub starts this script from PowerShell 7. Do not leak its module search path into Windows PowerShell 5.1: the latter must discover its own Utility module (Get-FileHash, ConvertFrom-Json), just as on an ordinary user host." - i.e. the ordinary user host is the intended target.
  • install.ps1 already carries 5.1-specific compatibility handling (for example the null-string coercion comment in Write-Atomic) and keeps -UseBasicParsing (a no-op on 7.x) for 5.1 compatibility.

Cost of requiring pwsh 7

  • Windows PowerShell 5.1 is in-box on every Windows 10/11; pwsh is an optional install. openalice update is itself a bootstrap entry point (the documented one-liner is pasted into whatever shell the user has, typically 5.1/cmd), so requiring pwsh means "install PowerShell 7 first, then update", plus a documented prerequisite and a failure mode when it is missing.
  • It would change three paths (update, install, deferred uninstall/rollback), their specs, and the acceptance harness - and it sits awkwardly against the zero-external-dependency story the product already advertises (openalice doctor: "Bun 1.4.0 is embedded in the OpenAlice executable / No system Node.js or Bun installation is required").
  • It does not remove the need for the decode fix in #1538.

Options

  1. Keep in-box 5.1 as the supported host (status quo + the #1538 fix). Lowest risk; the script stays host-agnostic and keeps working on 7.x for anyone who runs it there.
  2. Prefer pwsh when present, fall back to 5.1. Middle ground, but doubles the host matrix to test, and byte[] decoding is still required on both.
  3. Require pwsh 7. Explicit prerequisite, auto-install consideration, doc/UX changes, changed uninstall/rollback path; must degrade predictably on machines without pwsh.

Recommendation: option 1 - the failure was never about the host version, and the in-box host is what ordinary users have. If maintainers prefer 2 or 3, I am happy to implement it in a follow-up PR.

Related: #1538