Skip to content

The agent that grows with you

test(install): windows installer-script e2e - irm | iex arm goes live

ethernet7a562a269e5f
diff --git a/.github/workflows/install-e2e-windows-run.yml b/.github/workflows/install-e2e-windows-run.yml
index 27b75e67df8..40bf49fb349 100644
--- a/.github/workflows/install-e2e-windows-run.yml
+++ b/.github/workflows/install-e2e-windows-run.yml
@@ -1,34 +1,43 @@
name: Install & Update E2E — Windows desktop (reusable)
-# Runs the REAL Windows desktop user flow against ONE update route:
-# install OLD via the website's Hermes-Setup.exe (headed, AutoHotkey clicks
-# Install -> Launch, the real Electron window must appear), then update
-# OLD -> HEAD through the route a user would take.
+# Runs ONE Windows {install-method, update-method} combination: install
+# OLD, then update OLD -> HEAD through the route a user would take.
#
-# The Windows sibling of install-e2e-run.yml. No bubblewrap here — the
-# driver (tests/install/windows-desktop-gui-e2e.ps1) fakes GitHub with
-# git's own transport rewrite: a driver-owned GIT_CONFIG_GLOBAL carrying
-# url.<file://serve.git>.insteadOf for both canonical repo URLs, so the
-# installer and updater run byte-for-byte against their real URLs and land
-# on a local bare repo. Its `main` serves OLD (install-ref, default: the
-# newest release tag) during the install, then advances to HEAD for the
-# update leg — an update becomes available exactly the way it does for a
-# real user.
+# The Windows sibling of install-e2e-run.yml. No bubblewrap anywhere -- the
+# drivers fake GitHub with git's own transport rewrite: a driver-owned
+# GIT_CONFIG_GLOBAL carrying url.<file://serve.git>.insteadOf for both
+# canonical repo URLs, so the installer and updater run byte-for-byte
+# against their real URLs and land on a local bare repo. Its `main` serves
+# OLD (install-ref, default: the newest release tag) during the install,
+# then advances to HEAD for the update leg -- an update becomes available
+# exactly the way it does for a real user.
#
-# Routes (from the update-method input):
-# app-update the app's own Update button: the installed
-# Hermes.exe runs under Playwright's Electron
-# driver, which clicks Settings -> About ->
-# "Update now"; the production hand-off chain runs
-# untouched (marker, app quit, detached updater,
-# hermes update, desktop rebuild, relaunch).
-# hermes-update TODO: `hermes update` from the installed venv.
-# desktop-installer@latest
-# TODO: re-run the bootstrap exe over the install.
-# installer-script TODO: re-run the irm | iex one-liner.
+# Two install arms, two drivers:
+# desktop-installer@latest the REAL desktop user flow
+# (tests/install/windows-desktop-gui-e2e.ps1):
+# the website's published Hermes-Setup.exe runs
+# headed, AutoHotkey clicks Install -> Launch,
+# the real Electron window must appear. Update
+# methods:
+# app-update the app's own Update button:
+# the installed Hermes.exe runs
+# under Playwright's Electron
+# driver, which clicks Settings
+# -> About -> "Update now"; the
+# production hand-off chain runs
+# untouched.
+# (hermes-update, desktop-installer@latest,
+# installer-script re-run: declared TODOs.)
+# installer-script the irm | iex one-liner
+# (tests/install/windows-installer-script-e2e
+# .ps1): runs the install.ps1 shipped AT the
+# OLD ref, headless. Update methods:
+# hermes-update venv hermes.exe update
+# installer-script re-run HEAD's install.ps1
+# (app-update from a script install: TODO.)
#
# Method pairs without a driver yet NATIVELY SKIP (grey check, no runner):
-# the capability knowledge lives here, next to the driver, so the caller
+# the capability knowledge lives here, next to the drivers, so the caller
# can dispatch every declared combination without knowing which ones work.
#
# Call it:
@@ -45,11 +54,11 @@ on:
workflow_call:
inputs:
install-method:
- description: 'How OLD gets installed. Supported: desktop-installer@latest (website exe, AHK-clicked). Declared-but-TODO methods skip.'
+ description: 'How OLD gets installed. Supported: desktop-installer@latest (website exe, AHK-clicked) and installer-script (irm | iex install.ps1). Declared-but-TODO methods skip.'
required: true
type: string
update-method:
- description: 'How the install updates to HEAD. Supported: app-update (Update button under Playwright). Declared-but-TODO methods skip.'
+ description: 'How the install updates to HEAD. Supported: app-update (Update button under Playwright, from a desktop install) and hermes-update / installer-script (from a script install). Declared-but-TODO pairs skip.'
required: true
type: string
install-ref:
@@ -77,6 +86,7 @@ permissions:
contents: read
jobs:
+ # ---- arm 1: install via the website's Hermes-Setup.exe (GUI) -------------
e2e:
# Static name on purpose: the caller's job name already carries the
# method pair, and GitHub renders name expressions UNEXPANDED (literal
@@ -171,3 +181,37 @@ jobs:
path: gui-e2e-proof
retention-days: 14
if-no-files-found: ignore
+
+ # ---- arm 2: install via the irm | iex one-liner (headless) ---------------
+ script-e2e:
+ # Same static-name reasoning as e2e above.
+ name: e2e
+ # The pairs the script driver can run today. app-update from a script
+ # install is a declared TODO (the desktop app also has to be BUILT by
+ # that path first).
+ if: inputs.install-method == 'installer-script' && contains(fromJSON('["hermes-update", "installer-script"]'), inputs.update-method)
+ runs-on: windows-latest
+ timeout-minutes: ${{ inputs.timeout-minutes }}
+
+ steps:
+ # Full history: the driver bare-clones this checkout as the repo the
+ # installer/updater talk to, and both OLD and HEAD must be reachable
+ # in that clone.
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0
+
+ - name: Run install + update E2E
+ shell: powershell
+ run: powershell -NoProfile -ExecutionPolicy Bypass -File tests\install\windows-installer-script-e2e.ps1 -UpdateMethod "${{ inputs.update-method }}" -InstallRef "${{ inputs.install-ref }}"
+ env:
+ HERMES_E2E_LOG_DIR: ${{ runner.temp }}\e2e-logs
+
+ - name: Upload installer logs
+ if: always()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: install-e2e-windows-script-${{ inputs.update-method }}-${{ inputs.install-ref }}-${{ github.sha }}
+ path: ${{ runner.temp }}\e2e-logs
+ retention-days: 14
+ if-no-files-found: ignore
diff --git a/tests/install/windows-installer-script-e2e.ps1 b/tests/install/windows-installer-script-e2e.ps1
new file mode 100644
index 00000000000..f011a5f16e9
--- /dev/null
+++ b/tests/install/windows-installer-script-e2e.ps1
@@ -0,0 +1,194 @@
+# Prove a Windows user who installed OLD via the installer script (irm |
+# iex) can reach HEAD.
+#
+# The install.ps1 sibling of tests/install/installer-script-e2e.sh, sharing
+# its staging trick with the GUI driver (windows-desktop-gui-e2e.ps1):
+# every git process is pointed at a local bare clone with
+# url.<file://serve.git>.insteadOf rewrites for both canonical repo URLs in
+# a driver-owned GIT_CONFIG_GLOBAL. The installer and updater run
+# byte-for-byte against their real URLs and land on serve.git; `main`
+# serves OLD during the install, then advances to HEAD for the update leg.
+# (NOT GIT_CONFIG_COUNT/KEY_n/VALUE_n env config -- install.ps1 SETS those
+# itself and would clobber ours.)
+#
+# install.ps1 itself is not downloaded: the install leg runs the copy
+# shipped AT the OLD ref (what a user who installed then actually
+# executed), and the installer-script update leg runs HEAD's copy (what
+# the website serves at update time).
+#
+# Usage:
+# powershell -File tests\install\windows-installer-script-e2e.ps1 `
+# -UpdateMethod hermes-update -InstallRef v0.20.2
+#
+# -UpdateMethod hermes-update venv\Scripts\hermes.exe update
+# installer-script re-run install.ps1 (HEAD's copy)
+# -InstallRef what to install first; anything git resolves. auto =
+# the newest release tag in the checkout.
+#
+# Requires a clean full-history checkout with release tags fetched.
+# PowerShell 5.1-safe, pure ASCII (OEM codepages explode on fancy dashes).
+
+#Requires -Version 5.1
+
+param(
+ [ValidateSet("hermes-update", "installer-script")]
+ [string]$UpdateMethod = "hermes-update",
+ [string]$InstallRef = "auto"
+)
+
+$ErrorActionPreference = "Stop"
+
+$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
+$RepoUrlSsh = "[email protected]:NousResearch/hermes-agent.git"
+$RepoUrlHttps = "https://github.com/NousResearch/hermes-agent.git"
+
+# Everything lives OUTSIDE the checkout; an untracked dir inside the repo
+# would trip the dirty-tree guard below on the next run.
+$WorkRoot = Join-Path $(if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { $env:TEMP }) "hermes-installer-script-e2e"
+$LogDir = if ($env:HERMES_E2E_LOG_DIR) { $env:HERMES_E2E_LOG_DIR } else { Join-Path $WorkRoot "logs" }
+$ServeRepo = Join-Path $WorkRoot "serve.git"
+
+function Step([string]$Message) { Write-Host "`n=== $Message ===" }
+function Ok([string]$Message) { Write-Host " OK $Message" }
+function Fail([string]$Message) {
+ Write-Host "E2E ASSERTION FAILED: $Message" -ForegroundColor Red
+ exit 1
+}
+
+function Invoke-Git {
+ param([string[]]$GitArgs)
+ $out = & git @GitArgs 2>&1
+ if ($LASTEXITCODE -ne 0) {
+ Fail "git $($GitArgs -join ' ') exited $LASTEXITCODE`: $out"
+ }
+ return $out
+}
+
+if (Test-Path -LiteralPath $WorkRoot) { Remove-Item -Recurse -Force -LiteralPath $WorkRoot }
+New-Item -ItemType Directory -Path $WorkRoot, $LogDir -Force | Out-Null
+
+# --- stage: serve.git with main parked at OLD --------------------------------
+
+Step "staging serve.git (main -> OLD)"
+# Tracked changes only (-uno): untracked files cannot leak into a bare clone.
+$dirty = Invoke-Git @("-C", $RepoRoot, "status", "--porcelain", "-uno")
+if ($dirty) { Fail "checkout has uncommitted tracked changes; the staged clone must be a reviewable commit" }
+
+if ($InstallRef -eq "auto") {
+ $tags = (Invoke-Git @("-C", $RepoRoot, "tag", "--list", "v[0-9]*", "--sort=-creatordate")) -split "`r?`n"
+ $InstallRef = $tags | Select-Object -First 1
+ if (-not $InstallRef) { Fail "no release tags in the checkout to use as OLD" }
+}
+$OldSha = (Invoke-Git @("-C", $RepoRoot, "rev-parse", "$InstallRef^{commit}")).Trim()
+$HeadSha = (Invoke-Git @("-C", $RepoRoot, "rev-parse", "HEAD")).Trim()
+if ($OldSha -eq $HeadSha) { Fail "OLD ($InstallRef) IS HEAD; no update would be available" }
+
+Invoke-Git @("clone", "--bare", "--quiet", $RepoRoot, $ServeRepo) | Out-Null
+Invoke-Git @("-C", $ServeRepo, "update-ref", "refs/heads/main", $OldSha) | Out-Null
+Invoke-Git @("-C", $ServeRepo, "symbolic-ref", "HEAD", "refs/heads/main") | Out-Null
+# The installer may pin a commit that is reachable but not at a ref tip.
+Invoke-Git @("-C", $ServeRepo, "config", "uploadpack.allowAnySHA1InWant", "true") | Out-Null
+Ok "serve.git main = $OldSha ($InstallRef), update target $HeadSha"
+
+# --- the git URL redirect ------------------------------------------------------
+
+$gitCfg = Join-Path $WorkRoot "gitconfig"
+$serveUrl = "file:///" + ($ServeRepo -replace "\\", "/")
+@"
+[url "$serveUrl"]
+ insteadOf = $RepoUrlHttps
+ insteadOf = $RepoUrlSsh
+"@ | Set-Content -LiteralPath $gitCfg -Encoding Ascii
+$env:GIT_CONFIG_GLOBAL = $gitCfg
+Ok "git URL redirect via GIT_CONFIG_GLOBAL=$gitCfg"
+
+# Isolated install target: the runner may carry a preinstalled hermes.
+# -HermesHome/-InstallDir are passed explicitly because the oldest sampled
+# installers predate the HERMES_HOME env override.
+$HermesHome = Join-Path $WorkRoot "hermes-home"
+$InstallDir = Join-Path $HermesHome "hermes-agent"
+New-Item -ItemType Directory -Path $HermesHome -Force | Out-Null
+$env:HERMES_HOME = $HermesHome
+# serve.git's file:// origin looks like a fork to the updater, whose "add
+# the official repo as upstream?" prompt would hang a headless run. This
+# marker is the product's own mechanism for suppressing it.
+Set-Content -LiteralPath (Join-Path $HermesHome ".skip_upstream_prompt") -Value "" -Encoding Ascii
+
+function Invoke-Installer {
+ param([string]$Ref, [string]$Label)
+ $script = Join-Path $WorkRoot "install-$Label.ps1"
+ (Invoke-Git @("-C", $RepoRoot, "show", "$Ref`:scripts/install.ps1")) -join "`n" |
+ Set-Content -LiteralPath $script -Encoding UTF8
+ # Flags must match the installer being run, not this checkout's: older
+ # releases reject parameters added later. -SkipSetup/-HermesHome/
+ # -InstallDir go back further than any tag we sample; -NonInteractive
+ # is probed from the ref's own script text.
+ $flags = @("-SkipSetup", "-HermesHome", $HermesHome, "-InstallDir", $InstallDir)
+ $text = Get-Content -LiteralPath $script -Raw
+ if ($text -match '\$NonInteractive') { $flags += "-NonInteractive" }
+ $log = Join-Path $LogDir "install-$Label.log"
+ & powershell -NoProfile -ExecutionPolicy Bypass -File $script @flags *> $log
+ if ($LASTEXITCODE -ne 0) {
+ Get-Content -LiteralPath $log -Tail 50 | Write-Host
+ Fail "install.ps1 ($Label) exited $LASTEXITCODE; full log in $log"
+ }
+}
+
+function Assert-Checkout {
+ param([string]$ExpectedSha, [string]$Label)
+ $got = (Invoke-Git @("-C", $InstallDir, "rev-parse", "HEAD")).Trim()
+ if ($got -ne $ExpectedSha) { Fail "installed checkout is $got, expected $Label ($ExpectedSha)" }
+ Ok "checkout is $Label ($ExpectedSha)"
+ $hermes = Join-Path $InstallDir "venv\Scripts\hermes.exe"
+ if (-not (Test-Path -LiteralPath $hermes)) { Fail "no hermes console script at $hermes" }
+ $verLog = Join-Path $LogDir "version-$Label.log"
+ & $hermes --version *> $verLog
+ if ($LASTEXITCODE -ne 0) {
+ Get-Content -LiteralPath $verLog | Write-Host
+ Fail "hermes --version failed after $Label; log in $verLog"
+ }
+ Ok "hermes --version works: $((Get-Content -LiteralPath $verLog -First 1))"
+}
+
+# --- install OLD ------------------------------------------------------------------
+
+Step "installing OLD ($InstallRef) via its own scripts/install.ps1"
+Invoke-Installer $OldSha "old"
+Assert-Checkout $OldSha "OLD"
+
+# --- update OLD -> HEAD --------------------------------------------------------------
+
+Step "advancing served main to HEAD"
+Invoke-Git @("-C", $ServeRepo, "update-ref", "refs/heads/main", $HeadSha) | Out-Null
+Ok "serve.git main = $HeadSha"
+
+Step "updating via $UpdateMethod"
+switch ($UpdateMethod) {
+ "hermes-update" {
+ $hermes = Join-Path $InstallDir "venv\Scripts\hermes.exe"
+ # `--yes` reaches the update subcommand only in later releases, and
+ # argparse rejects the whole invocation when it does not exist.
+ $updateArgs = @("update")
+ $helpText = & $hermes update --help 2>&1 | Out-String
+ if ($helpText -match '--yes') { $updateArgs += "--yes" }
+ $log = Join-Path $LogDir "update.log"
+ Push-Location $InstallDir
+ try {
+ & $hermes @updateArgs *> $log
+ $updateExit = $LASTEXITCODE
+ } finally {
+ Pop-Location
+ }
+ if ($updateExit -ne 0) {
+ Get-Content -LiteralPath $log -Tail 50 | Write-Host
+ Fail "hermes update exited $updateExit; full log in $log"
+ }
+ }
+ "installer-script" {
+ # A user re-running the one-liner today gets the CURRENT script.
+ Invoke-Installer $HeadSha "head"
+ }
+}
+Assert-Checkout $HeadSha "HEAD"
+
+Step "PASS: $InstallRef -> HEAD via $UpdateMethod"