The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
ci(windows): desktop install/update e2e - published installer to this commit via fake git remote
ethernete74f44d7ae65
diff --git a/.github/workflows/install-e2e-windows-run.yml b/.github/workflows/install-e2e-windows-run.ymlnew file mode 100644index 00000000000..50b731ab2b8--- /dev/null+++ b/.github/workflows/install-e2e-windows-run.yml@@ -0,0 +1,113 @@+name: Install & Update E2E — Windows (reusable)++# Runs ONE Windows desktop update route against ONE starting point, with a+# real install (the published Hermes-Setup.exe: git, uv, a managed Python,+# Node, the venv, the desktop build) behind it.+#+# The Windows sibling of install-e2e-run.yml. There is no bubblewrap here, so+# tests/install/windows/install-update-e2e.ps1 fakes GitHub with git's own+# transport rewrite (an isolated GIT_CONFIG_GLOBAL carrying+# url.<file://fake.git>.insteadOf for both hardcoded repo URLs) instead of a+# MITM proxy — the installer and updater run verbatim against their real URLs+# and land on a local bare repo the driver controls. The bootstrap installer+# itself is a GUI with no headless mode, so AutoHotkey clicks it.+#+# Call it:+#+# jobs:+# windows-desktop:+# uses: ./.github/workflows/install-e2e-windows-run.yml+# with:+# route: desktop++on:+ workflow_call:+ inputs:+ route:+ description: 'Update path to exercise. desktop = the desktop app''s builtin update hand-off (scripts/desktop-update.ps1). TODO: update (hermes update), installer (re-run the bootstrap installer).'+ required: false+ type: string+ default: desktop+ installer-url:+ description: 'Bootstrap installer to install with. Default: the latest published one — what a user downloads today.'+ required: false+ type: string+ default: https://hermes-assets.nousresearch.com/Hermes-Setup.exe+ timeout-minutes:+ description: 'Job timeout. A cold run installs real toolchains and builds the desktop app.'+ required: false+ type: number+ default: 75++permissions:+ contents: read++jobs:+ e2e:+ name: ${{ inputs.route }} from published installer+ runs-on: windows-latest+ timeout-minutes: ${{ inputs.timeout-minutes }}++ steps:+ # Full history + tags: the driver seeds its fake GitHub from this+ # checkout (all origin branches for the installer's commit pin, release+ # tags for the starting base) and promotes HEAD as the update target.+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ fetch-depth: 0++ - name: Restore cached test tools+ id: test-tools-cache+ uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5+ with:+ path: test-bins+ key: test-bins-${{ runner.os }}-v1++ # AutoHotkey drives the installer GUI; ffmpeg records the screen so a+ # failed click is diagnosable from the artifact instead of by guesswork.+ - name: Install AutoHotkey v2 and ffmpeg+ if: steps.test-tools-cache.outputs.cache-hit != 'true'+ shell: pwsh+ run: |+ New-Item -ItemType Directory -Path test-bins\autohotkey, test-bins\ffmpeg -Force | Out-Null++ # AutoHotkey: copy its whole v2 directory so helper exes/dlls come along.+ winget install -e --id AutoHotkey.AutoHotkey --silent --accept-source-agreements --accept-package-agreements --disable-interactivity+ $ahkDir = "$env:ProgramW6432\AutoHotkey\v2"+ if (-not (Test-Path $ahkDir)) {+ throw "AutoHotkey install directory not found: $ahkDir"+ }+ Copy-Item -Path "$ahkDir\*" -Destination test-bins\autohotkey -Recurse -Force++ winget install -e --id Gyan.FFmpeg --silent --accept-source-agreements --accept-package-agreements --disable-interactivity --location ffmpeg_dir+ Copy-Item -Path "ffmpeg_dir\*\*" -Destination test-bins\ffmpeg -Recurse -Force++ - name: Add test tools to PATH+ shell: pwsh+ run: |+ Add-Content -Path $env:GITHUB_PATH -Value "$PWD\test-bins\autohotkey"+ Add-Content -Path $env:GITHUB_PATH -Value "$PWD\test-bins\ffmpeg\bin"++ - name: Run install + update E2E+ shell: pwsh+ run: |+ tests/install/windows/install-update-e2e.ps1 `+ -Route '${{ inputs.route }}' `+ -InstallerUrl '${{ inputs.installer-url }}'+ env:+ # Outside the workspace on purpose: the driver refuses to run on a+ # dirty tree, and logs written into the repo would be what makes it+ # dirty.+ HERMES_E2E_LOG_DIR: ${{ runner.temp }}\e2e-logs++ # The installer's own transcript, the AHK click log, the update hand-off+ # log, and the screen recording say far more than the assertion that+ # tripped when a real install breaks.+ - name: Upload logs and recording+ if: always()+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: install-e2e-windows-${{ inputs.route }}-${{ github.sha }}+ path: ${{ runner.temp }}\e2e-logs+ retention-days: 14+ if-no-files-found: ignorediff --git a/.github/workflows/install-e2e.yml b/.github/workflows/install-e2e.ymlindex 03c9a1d0b81..98b5edc8a05 100644--- a/.github/workflows/install-e2e.yml+++ b/.github/workflows/install-e2e.yml@@ -12,6 +12,11 @@ name: Install & Update E2E# A hardcoded list would stop covering the newest release the day after it# ships, and would pin an "oldest" that nobody still runs.#+# A separate Windows axis (install-e2e-windows-run.yml) installs with the+# latest PUBLISHED bootstrap installer and applies the desktop app's builtin+# update — no tag matrix there, because the published exe's own build pin is+# the starting point users actually have.+## Triggers:# * every 12 hours, so upstream drift (a new uv, a Node bump, a PyPI change)# surfaces on a schedule rather than in someone's review cycle;@@ -27,11 +32,11 @@ on:workflow_dispatch:inputs:route:- description: 'Which update route to exercise.'+ description: 'Which update route to exercise. all/both include the Windows desktop leg.'required: falsetype: choice- default: both- options: [both, update, installer]+ default: all+ options: [all, both, update, installer, windows-desktop]tag-count:description: 'How many release tags to sample (newest, oldest, and a spread between).'required: false@@ -81,7 +86,7 @@ jobs:# `hermes update` -- the route most users take.update:- if: github.event_name != 'workflow_dispatch' || inputs.route != 'installer'+ if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all", "both", "update"]'), inputs.route)needs: pick-releasesstrategy:# One release breaking is worth knowing about even if another already@@ -97,7 +102,7 @@ jobs:# Re-running the curl one-liner over an existing checkout: autostash + pull# rather than the updater's own git handling.installer:- if: github.event_name != 'workflow_dispatch' || inputs.route != 'update'+ if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all", "both", "installer"]'), inputs.route)needs: pick-releasesstrategy:fail-fast: false@@ -108,3 +113,14 @@ jobs:with:route: installerinstall-ref: ${{ matrix.install-ref }}++ # Windows desktop: install with the latest PUBLISHED bootstrap installer+ # (Hermes-Setup.exe — the exact bits a user downloads today), then apply the+ # desktop app's builtin update. No release-tag matrix: the published exe's+ # build pin decides the starting base, which is precisely the "user on the+ # current installer" scenario this axis exists to cover.+ windows-desktop:+ if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all", "windows-desktop"]'), inputs.route)+ uses: ./.github/workflows/install-e2e-windows-run.yml+ with:+ route: desktopdiff --git a/tests/install/windows/install-button.png b/tests/install/windows/install-button.pngnew file mode 100644index 00000000000..feed47bd98fBinary files /dev/null and b/tests/install/windows/install-button.png differdiff --git a/tests/install/windows/install-hermes-desktop.ahk b/tests/install/windows/install-hermes-desktop.ahknew file mode 100644index 00000000000..2cd8338c32c--- /dev/null+++ b/tests/install/windows/install-hermes-desktop.ahk@@ -0,0 +1,137 @@+#Requires AutoHotkey v2.0+#SingleInstance Force++; Drives the Hermes bootstrap installer (Hermes-Setup.exe) through a real+; install: waits for the window, clicks Install, waits for the Launch button+; to appear (install finished), then closes the window WITHOUT launching the+; app -- the E2E driver verifies the install and runs the update route itself.+;+; Args:+; 1: log file path (default ahk.log in the working dir)+;+; Button images live next to this script. They are literal screenshots of the+; installer's buttons; ImageSearch runs with *10 shade tolerance so minor+; rendering differences (ClearType, DPI rounding) still match.++logPath := A_Args.Length >= 1 ? A_Args[1] : "ahk.log"++Log(text) {+ msg := Format("[autohotkey] {}`n", text)+ ToolTip(text)+ FileAppend(msg, '*')+ FileAppend(msg, logPath)+}++OnError(LogError)++LogError(err, mode) {+ Log(Format("Unhandled error: {}", err.Message))+ ExitApp(1)+ return -1 ; suppress the standard error dialog+}++SetWorkingDir(A_ScriptDir)+CoordMode("Pixel", "Screen")+CoordMode("Mouse", "Screen")++ClickWithMarker(x, y, button := "Left") {+ Click(x, y, button)++ Sleep(10)+ MouseMove(30, 30)+ Log(Format("Clicking at {1}, {2}", x, y))+ ; Draw a short-lived red dot where we clicked so the screen recording+ ; shows WHERE the automation acted, not just what happened after.+ size := 20+ g := Gui("-Caption +AlwaysOnTop +ToolWindow")+ g.BackColor := "Red"+ g.Show(Format(+ "x{} y{} w{} h{} NoActivate"+ , x - size // 2+ , y - size // 2+ , size+ , size+ ))+ hRegion := DllCall(+ "CreateEllipticRgn"+ , "Int", 0+ , "Int", 0+ , "Int", size+ , "Int", size+ , "Ptr"+ )+ DllCall("SetWindowRgn", "Ptr", g.Hwnd, "Ptr", hRegion, "Int", true)+ WinSetTransparent(255, g.Hwnd)+ SetTimer(() => g.Destroy(), -500)+}++FindImageInWindow(winTitle, imageFile, &outX, &outY, timeoutMs := 10000, intervalMs := 250)+{+ WinGetPos(&wx, &wy, &ww, &wh, winTitle)++ hBitmap := LoadPicture(imageFile)++ if !hBitmap {+ throw Error("LoadPicture failed: " imageFile)+ }+ bm := Buffer(32, 0) ; BITMAP structure on x64+ DllCall("GetObject", "Ptr", hBitmap, "Int", bm.Size, "Ptr", bm)++ width := NumGet(bm, 4, "Int")+ height := NumGet(bm, 8, "Int")++ startTime := A_TickCount++ timeLeft := 1++ Log(Format("Searching for button file {} in window {}...", imageFile, winTitle))+ searchImage := Format("*10 {}", imageFile)+ while (timeLeft > 0)+ {+ if ImageSearch(&x, &y, wx, wy, wx + ww, wy + wh, searchImage)+ {+ outX := x + Floor(width / 2)+ outY := y + Floor(height / 2)+ Log("Found button!")+ return+ }++ Sleep intervalMs+ timeLeft := timeoutMs - (A_TickCount - startTime)+ ToolTip(Format("Searching for button {} in window {}... {}s left", imageFile, winTitle, Round(timeLeft / 1000, 2)))+ }++ throw Error(Format("Failed to find button {} in window {}", imageFile, winTitle))+}++ClickCenterOfImageInWindow(winTitle, imageFile, timeoutMs := 10000, intervalMs := 250)+{+ FindImageInWindow(winTitle, imageFile, &x, &y, timeoutMs, intervalMs)+ ClickWithMarker(x, y)+}++Log("Waiting for the installer window to appear...")+winTitle := "Hermes"+try {+ WinWait(winTitle, , 30)+} catch {+ throw Error("Hermes installer window did not appear within 30s")+}+WinGetPos(&x, &y, &w, &h, winTitle)+Log(Format("Window found at x={1} y={2} w={3} h={4}", x, y, w, h))++ClickCenterOfImageInWindow(winTitle, A_ScriptDir "\install-button.png")++; Wait for the install to finish. The Launch button only renders when every+; stage (git, uv, Python, Node, venv, desktop build) has completed, so its+; appearance IS the success signal. A real install takes many minutes.+FindImageInWindow(winTitle, A_ScriptDir "\launch-button.png", &launchX, &launchY, 1000 * 60 * 25)++; Close instead of clicking Launch: the E2E driver owns everything after the+; install, and a launched desktop would hold the venv shim open and block the+; update route.+WinClose(winTitle)++Sleep(2000)++ExitApp(0)diff --git a/tests/install/windows/install-update-e2e.ps1 b/tests/install/windows/install-update-e2e.ps1new file mode 100644index 00000000000..e7e2bec60d3--- /dev/null+++ b/tests/install/windows/install-update-e2e.ps1@@ -0,0 +1,383 @@+# Prove a Windows desktop user on the published bootstrap installer can reach+# this commit through the desktop's builtin update.+#+# The Windows analog of tests/install/install-update-e2e.sh. Linux gets its+# fake GitHub from the bubblewrap sandbox's MITM proxy + git-upload-pack shim;+# there is no such sandbox on Windows, so the git proxying here is git's own+# transport rewrite instead: a throwaway GIT_CONFIG_GLOBAL carrying multi-+# valued url.<file://fake.git>.insteadOf entries for BOTH hardcoded repo URL+# forms (SSH and HTTPS). Every git child of this process -- install.ps1's+# clone, `hermes update`'s fetch, the desktop's ls-remote -- resolves+# github.com/NousResearch/hermes-agent to a local bare repo whose `main` this+# driver controls, while the tools themselves run VERBATIM with their real+# URLs. scripts/fake_remote_update_probe.sh (hermes-install-update-testing+# skill) is the verified reference for the mechanism, including why --add is+# load-bearing (a second plain `git config` REPLACES the first rewrite and one+# URL silently reaches real GitHub).+#+# What one run does:+# 1. Seed fake.git from this checkout (all origin branches + tags), then+# force fake `main` to the NEWEST release tag -- so an installer with a+# branch pin lands on a released base, not on the target.+# uploadpack.allowAnySHA1InWant covers installers with a -Commit pin.+# 2. Run the real published Hermes-Setup.exe, driven by AutoHotkey (the+# installer is a GUI with no headless mode). The exe downloads its+# pinned install.ps1 from raw.githubusercontent for real -- the same+# fixture-miss passthrough posture as the Linux sandbox -- and that+# script's git clone rides the rewrite onto fake.git.+# 3. Promote fake `main` to this checkout's HEAD (the --from-main dance).+# 4. Apply ONE update route and require HEAD == target with a working+# `hermes`.+#+# Routes:+# desktop the desktop app's builtin update, minus only the Electron+# process around it, following applyUpdates' own preference+# order (apps/desktop/electron/main.ts): the repo-owned+# scripts/desktop-update.ps1 hand-off when the installed base+# ships it, else the staged hermes-setup.exe --update (which+# auto-runs: update mode is a hand-off, not a click-through).+# Either way the update engine is the installed release's own+# `hermes update`, so old CLIs meet their contemporaneous flags.+# TODO update bare `hermes update` from the installed venv (the route+# the Linux matrix calls `update`).+# TODO installer re-run the bootstrap installer over the existing+# checkout (the Linux `installer` route; needs the AHK+# flow to handle the repair/reinstall UI).+#+# Requires: git, AutoHotkey64.exe on PATH, network (real toolchain download),+# a clean full-history checkout with release tags fetched. ffmpeg on PATH is+# optional -- when present the run is screen-recorded for the artifact.++#Requires -Version 7++param(+ [ValidateSet("desktop")]+ [string]$Route = "desktop",+ # Latest published installer -- "what a user downloads today".+ [string]$InstallerUrl = "https://hermes-assets.nousresearch.com/Hermes-Setup.exe",+ # Local exe override (skips the download; for iterating on this driver).+ [string]$InstallerPath = ""+)++$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 make later verification steps lie about a dirty tree, and RUNNER_TEMP+# is wiped with the runner.+$WorkRoot = Join-Path ($env:RUNNER_TEMP ?? [System.IO.Path]::GetTempPath()) "hermes-install-e2e"+$LogDir = if ($env:HERMES_E2E_LOG_DIR) { $env:HERMES_E2E_LOG_DIR } else { Join-Path $WorkRoot "logs" }+$FakeRepo = Join-Path $WorkRoot "fake.git"++function Step([string]$Message) { Write-Host "`n=== $Message ===" }+function Ok([string]$Message) { Write-Host " OK $Message" }+function Fail([string]$Message) {+ Write-Host "FAIL: $Message" -ForegroundColor Red+ exit 1+}++function Invoke-Git {+ param([string[]]$GitArgs, [string]$Cwd = $RepoRoot)+ $out = & git -C $Cwd @GitArgs 2>&1+ if ($LASTEXITCODE -ne 0) {+ Fail "git $($GitArgs -join ' ') failed (exit $LASTEXITCODE): $out"+ }+ return ($out | Out-String).Trim()+}++# --- preflight ---------------------------------------------------------------++if (-not (Get-Command git -ErrorAction SilentlyContinue)) { Fail "git not on PATH" }+if (-not (Get-Command AutoHotkey64.exe -ErrorAction SilentlyContinue)) {+ Fail "AutoHotkey64.exe not on PATH (winget install AutoHotkey.AutoHotkey)"+}++# The promote step pushes this worktree's HEAD as the update target, so a+# dirty tree means the tested commit is not the commit anyone can review.+$dirty = & git -C $RepoRoot status --porcelain+if ($dirty) {+ Write-Host ($dirty | Out-String)+ Fail "working tree is dirty; the update target must be a real commit"+}++Remove-Item -Recurse -Force $WorkRoot -ErrorAction SilentlyContinue+New-Item -ItemType Directory -Force -Path $WorkRoot, $LogDir | Out-Null++# Isolated HERMES_HOME so the real install never touches the runner's (or a+# developer's) profile. Both install.ps1 and the Tauri installer honor it.+if (-not $env:HERMES_HOME) {+ $env:HERMES_HOME = Join-Path $WorkRoot "hermes-home"+}+$InstallRoot = Join-Path $env:HERMES_HOME "hermes-agent"+$TargetSha = Invoke-Git @("rev-parse", "HEAD")++# --- fake GitHub -------------------------------------------------------------++Step "seeding fake remote at $FakeRepo"+Invoke-Git @("init", "--bare", "--initial-branch=main", $FakeRepo) $WorkRoot | Out-Null+# Published installers carry a -Commit pin and fetch that raw SHA; a bare+# repo refuses SHA wants unless told otherwise.+Invoke-Git @("config", "uploadpack.allowAnySHA1InWant", "true") $FakeRepo | Out-Null++# All origin branches + tags: the installer's build pin may be any commit on+# any branch that existed when the exe was built.+Invoke-Git @("push", "--quiet", $FakeRepo, "refs/remotes/origin/*:refs/heads/*")+Invoke-Git @("push", "--quiet", "--force", $FakeRepo, "refs/tags/*:refs/tags/*")++# Fake main starts at the newest release tag: a released base a real user+# could be installed on, and never the update target itself. Major capped at+# three digits, matching _parse_release_tag (hermes_cli/update_cmd.py) and+# latestReleaseFromLsRemote (apps/desktop/electron/bundled-runtime.ts): the+# repo's historical CalVer tags (v2026.7.20) would otherwise win every+# numeric sort forever.+$releaseTags = @(& git -C $RepoRoot tag --list |+ Where-Object { $_ -match '^v\d{1,3}\.\d+\.\d+(\.\d+)?$' } |+ Sort-Object { [version]($_.Substring(1)) })+if ($releaseTags.Count -eq 0) {+ Fail "no release tags in this checkout -- fetch with tags (fetch-depth: 0 + fetch-tags)"+}+$newestTag = $releaseTags[-1]+$baseMainSha = Invoke-Git @("rev-parse", "$newestTag^{commit}")+Invoke-Git @("push", "--quiet", "--force", $FakeRepo, "${baseMainSha}:refs/heads/main")+Ok "fake main = $newestTag ($($baseMainSha.Substring(0,12))); target is $($TargetSha.Substring(0,12))"++# --- git transport rewrite ---------------------------------------------------++Step "redirecting github.com/NousResearch/hermes-agent to the fake remote"+# Process-scoped global config: every git spawned below this point (installer,+# hermes update, desktop hand-off) inherits it; nothing on the machine does.+$env:GIT_CONFIG_GLOBAL = Join-Path $WorkRoot "gitconfig"+Set-Content -Path $env:GIT_CONFIG_GLOBAL -Value "" -NoNewline+# Fail loudly if anything still reaches a URL that wants credentials.+$env:GIT_TERMINAL_PROMPT = "0"++$fakeUrl = "file:///" + $FakeRepo.Replace("\", "/")+foreach ($url in @($RepoUrlSsh, $RepoUrlHttps)) {+ Invoke-Git @("config", "--global", "--add", "url.$fakeUrl.insteadOf", $url) $WorkRoot+}+$rewrites = @(& git config --global --get-all "url.$fakeUrl.insteadOf")+if ($rewrites.Count -ne 2) {+ Fail "expected 2 insteadOf rewrites, got $($rewrites.Count) -- one URL would reach real GitHub"+}+Ok "both repo URL forms rewritten (SSH clone attempts ride the file transport)"++# --- fetch the installer -----------------------------------------------------++if (-not $InstallerPath) {+ Step "downloading published installer"+ $InstallerPath = Join-Path $WorkRoot "Hermes-Setup.exe"+ Invoke-WebRequest -Uri $InstallerUrl -OutFile $InstallerPath+}+Ok "installer: $InstallerPath ($([math]::Round((Get-Item $InstallerPath).Length / 1MB, 1)) MB)"++# --- screen recording (optional) ----------------------------------------------++# ffmpeg must be started, fed, and stopped from THIS process: the graceful+# stop is the character 'q' on its LIVE stdin pipe, which only+# System.Diagnostics.Process exposes (Start-Process -RedirectStandardInput+# hands it a file handle already at EOF).+$ffmpeg = $null+if (Get-Command ffmpeg -ErrorAction SilentlyContinue) {+ $psi = New-Object System.Diagnostics.ProcessStartInfo+ $psi.FileName = "ffmpeg"+ $psi.Arguments = "-y -f gdigrab -framerate 15 -i desktop " ++ "-hide_banner -loglevel error " ++ "-c:v libx264 -preset ultrafast -pix_fmt yuv420p `"$LogDir\recording.mkv`""+ $psi.RedirectStandardInput = $true+ $psi.UseShellExecute = $false+ $ffmpeg = [System.Diagnostics.Process]::Start($psi)+ Ok "screen recording started (pid $($ffmpeg.Id))"+} else {+ Write-Host " (ffmpeg not on PATH; skipping screen recording)"+}++function Stop-Recording {+ if ($script:ffmpeg -and -not $script:ffmpeg.HasExited) {+ try {+ $script:ffmpeg.StandardInput.Write("q")+ $script:ffmpeg.StandardInput.Close()+ } catch {}+ if (-not $script:ffmpeg.WaitForExit(15000)) { $script:ffmpeg.Kill() }+ }+}++# --- run the real installer under AutoHotkey ----------------------------------++Step "installing via Hermes-Setup.exe (real toolchains: git, uv, Python, Node, venv, desktop)"+$installerOk = $false+try {+ $proc = Start-Process -FilePath $InstallerPath -PassThru+ $ahkLog = Join-Path $LogDir "ahk.log"+ $ahkProc = Start-Process -FilePath "AutoHotkey64.exe" `+ -ArgumentList "`"$PSScriptRoot\install-hermes-desktop.ahk`"", "`"$ahkLog`"" -PassThru++ # Tail the bootstrap log into the job log while we wait: the install IS+ # the substance of this test, and a failure explanation should not need+ # an artifact download. FileShare.ReadWrite because the installer still+ # has the file open for writing.+ $logReader = $null+ $logStream = $null+ $bootstrapLog = Join-Path $env:HERMES_HOME "logs\bootstrap-installer.log"+ $deadline = (Get-Date).AddMinutes(30)+ try {+ while ((Get-Date) -lt $deadline -and -not $ahkProc.HasExited) {+ if (-not $logReader) {+ if (Test-Path $bootstrapLog) {+ $logStream = [System.IO.File]::Open($bootstrapLog, 'Open', 'Read', 'ReadWrite')+ $logReader = New-Object System.IO.StreamReader($logStream)+ }+ } else {+ $line = $logReader.ReadLine()+ while ($null -ne $line) {+ Write-Host "[bootstrap] $line"+ $line = $logReader.ReadLine()+ }+ }+ Start-Sleep -Milliseconds 500+ }+ # Drain what was written in the final tick.+ if ($logReader) {+ $line = $logReader.ReadLine()+ while ($null -ne $line) {+ Write-Host "[bootstrap] $line"+ $line = $logReader.ReadLine()+ }+ }+ } finally {+ if ($logReader) { $logReader.Dispose() }+ if ($logStream) { $logStream.Dispose() }+ }++ if (-not $ahkProc.HasExited) {+ Stop-Process -Id $ahkProc.Id -Force -ErrorAction SilentlyContinue+ Fail "AutoHotkey helper still running at the deadline -- install never finished. See ahk.log + recording."+ }+ if ($ahkProc.ExitCode -ne 0) {+ Fail "AutoHotkey helper failed (exit $($ahkProc.ExitCode)) -- see ahk.log + recording"+ }++ # The AHK helper closes the window after the Launch button appears; a+ # still-running installer means the close did not land.+ if (-not $proc.WaitForExit(30000)) {+ Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue+ Fail "installer process still running after the window was closed"+ }+ $installerOk = $true+} finally {+ Stop-Recording+ if (Test-Path (Join-Path $LogDir "ahk.log")) {+ Write-Host "--- ahk.log ---"+ Get-Content (Join-Path $LogDir "ahk.log") | ForEach-Object { Write-Host $_ }+ Write-Host "--- end ahk.log ---"+ }+ if (-not $installerOk -and (Test-Path (Join-Path $env:HERMES_HOME "logs\bootstrap-installer.log"))) {+ Copy-Item (Join-Path $env:HERMES_HOME "logs\bootstrap-installer.log") $LogDir -Force+ }+}++# --- verify the install ------------------------------------------------------++Step "verifying the installed checkout"+if (-not (Test-Path (Join-Path $InstallRoot ".git"))) {+ Fail "no git checkout at $InstallRoot -- the installer's clone did not ride the rewrite?"+}+$BaseSha = Invoke-Git @("rev-parse", "HEAD") $InstallRoot+if ($BaseSha -eq $TargetSha) {+ Fail "install landed on the update target ($BaseSha); base and target must differ"+}+Ok "installed $($BaseSha.Substring(0,12)); update target is $($TargetSha.Substring(0,12))"++$HermesExe = Join-Path $InstallRoot "venv\Scripts\hermes.exe"+if (-not (Test-Path $HermesExe)) { Fail "venv shim missing: $HermesExe" }++# The real smoke test: goes through the venv launcher and imports the app.+$version = & $HermesExe --version 2>&1+if ($LASTEXITCODE -ne 0) { Fail "hermes --version failed after install: $version" }+Write-Host " $version"+Ok "hermes runs after install"++# --- promote fake main to this checkout --------------------------------------++Step "promoting fake main to this checkout (the state a user sees when an update is waiting)"+Invoke-Git @("push", "--quiet", "--force", $FakeRepo, "HEAD:refs/heads/main")+Ok "fake main advanced to $($TargetSha.Substring(0,12))"++# --- apply exactly one update route -------------------------------------------++switch ($Route) {+ "desktop" {+ Step "ROUTE: desktop builtin update"+ # Mirror the PATH contract the desktop passes the hand-off+ # (pathWithHermesManagedNode in apps/desktop/electron/main.ts):+ # managed node first, then the venv scripts dir.+ $managedNode = Join-Path $env:HERMES_HOME "node"+ $env:PATH = ((@(+ $managedNode,+ (Join-Path $managedNode "bin"),+ (Join-Path $InstallRoot "venv\Scripts")+ ) | Where-Object { Test-Path $_ }) + @($env:PATH)) -join ";"++ # applyUpdates' preference order: the repo-owned hand-off script when+ # the INSTALLED checkout ships it, else the staged Tauri binary. Run+ # whichever the Update button would actually spawn against this base.+ $handoff = Join-Path $InstallRoot "scripts\desktop-update.ps1"+ $stagedExe = Join-Path $env:HERMES_HOME "hermes-setup.exe"++ if (Test-Path $handoff) {+ # powershell.exe (5.1), not pwsh: that is what the desktop spawns.+ # -NoUi is the script's own headless switch; -DesktopPid 0 skips+ # the wait-for-desktop gate (no desktop is running); no+ # -RelaunchExe so nothing is launched afterwards.+ $handoffLog = Join-Path $LogDir "desktop-update.log"+ & powershell -NoProfile -ExecutionPolicy Bypass -File $handoff `+ -InstallRoot $InstallRoot -Branch main -DesktopPid 0 -NoUi 2>&1 |+ Tee-Object -FilePath $handoffLog+ $handoffExit = $LASTEXITCODE++ $handoffInternalLog = Join-Path $env:HERMES_HOME "logs\desktop-update-handoff.log"+ if (Test-Path $handoffInternalLog) { Copy-Item $handoffInternalLog $LogDir -Force }+ if ($handoffExit -ne 0) {+ Fail "desktop-update.ps1 failed (exit $handoffExit) -- see desktop-update.log + desktop-update-handoff.log"+ }+ } elseif (Test-Path $stagedExe) {+ # Update mode is a hand-off, not a click-through: --update jumps+ # straight to progress and start_update runs unattended, exiting+ # when done -- no AHK needed. On success it auto-launches the+ # desktop; kill that below rather than letting it hold the venv.+ Write-Host " installed base predates desktop-update.ps1; using staged hermes-setup.exe --update"+ $upd = Start-Process -FilePath $stagedExe -ArgumentList "--update" -PassThru+ if (-not $upd.WaitForExit(45 * 60 * 1000)) {+ Stop-Process -Id $upd.Id -Force -ErrorAction SilentlyContinue+ Fail "hermes-setup.exe --update still running after 45 minutes"+ }+ $updLog = Join-Path $env:HERMES_HOME "logs\update.log"+ if (Test-Path $updLog) { Copy-Item $updLog $LogDir -Force }+ if ($upd.ExitCode -ne 0) {+ Fail "hermes-setup.exe --update failed (exit $($upd.ExitCode)) -- see update.log"+ }+ # The successful updater relaunches Hermes; a live desktop locks+ # the venv shim and would poison later assertions.+ Get-Process -Name "Hermes" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue+ } else {+ Fail "neither scripts/desktop-update.ps1 (in the installed base) nor a staged hermes-setup.exe exists -- no desktop update path to exercise"+ }++ $After = Invoke-Git @("rev-parse", "HEAD") $InstallRoot+ if ($After -ne $TargetSha) {+ Fail "desktop update left HEAD at $After, wanted $TargetSha"+ }+ Ok "desktop update landed on $($After.Substring(0,12))"++ $version = & $HermesExe --version 2>&1+ if ($LASTEXITCODE -ne 0) { Fail "hermes --version failed after update: $version" }+ Write-Host " $version"+ Ok "hermes runs after desktop update"+ }+}++Write-Host ""+Write-Host "PASS: Windows install/update E2E (route: $Route, base: $($BaseSha.Substring(0,12)) -> $($TargetSha.Substring(0,12)))" -ForegroundColor Green+exit 0diff --git a/tests/install/windows/launch-button.png b/tests/install/windows/launch-button.pngnew file mode 100644index 00000000000..6ab89a75ca3Binary files /dev/null and b/tests/install/windows/launch-button.png differ