The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
ci(windows-e2e): retire the AHK-only axis - superseded by desktop-windows-e2e.yml
ethernet1f81c63dd0f7
diff --git a/.github/workflows/install-e2e-windows-run.yml b/.github/workflows/install-e2e-windows-run.ymldeleted file mode 100644index 962878f9b1f..00000000000--- a/.github/workflows/install-e2e-windows-run.yml+++ /dev/null@@ -1,117 +0,0 @@-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: ${{ runner.temp }}\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.- # Everything lands under RUNNER_TEMP: an untracked dir inside the- # checkout makes the tree dirty, and the driver refuses a dirty tree- # (the update target must be a reviewable commit).- - name: Install AutoHotkey v2 and ffmpeg- if: steps.test-tools-cache.outputs.cache-hit != 'true'- shell: pwsh- run: |- $bins = "$env:RUNNER_TEMP\test-bins"- New-Item -ItemType Directory -Path $bins\autohotkey, $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 $bins\autohotkey -Recurse -Force-- winget install -e --id Gyan.FFmpeg --silent --accept-source-agreements --accept-package-agreements --disable-interactivity --location "$env:RUNNER_TEMP\ffmpeg_dir"- Copy-Item -Path "$env:RUNNER_TEMP\ffmpeg_dir\*\*" -Destination $bins\ffmpeg -Recurse -Force-- - name: Add test tools to PATH- shell: pwsh- run: |- Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\test-bins\autohotkey"- Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\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 98b5edc8a05..ecce5c51718 100644--- a/.github/workflows/install-e2e.yml+++ b/.github/workflows/install-e2e.yml@@ -12,10 +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.+# A separate Windows workflow (desktop-windows-e2e.yml) covers the Windows+# desktop surfaces: a headless desktop-update.ps1 contract job and a real+# user-flow GUI job (website installer, clicked Install/Launch/Update now).+# No tag matrix there — 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)@@ -32,11 +33,11 @@ on:workflow_dispatch:inputs:route:- description: 'Which update route to exercise. all/both include the Windows desktop leg.'+ description: 'Which update route to exercise.'required: falsetype: choicedefault: all- options: [all, both, update, installer, windows-desktop]+ options: [all, both, update, installer]tag-count:description: 'How many release tags to sample (newest, oldest, and a spread between).'required: false@@ -114,13 +115,9 @@ jobs: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: desktop+ # Windows desktop coverage moved to desktop-windows-e2e.yml: two jobs —+ # a headless desktop-update.ps1 contract job (BASE -> CURRENT -> NEXT)+ # and a REAL user-flow GUI job (website Hermes-Setup.exe, AutoHotkey+ # Install/Launch clicks, Playwright-driven Settings -> About -> Update+ # now, relaunched-window assert). Triggered on push-to-main + nightly ++ # release tags + dispatch there, so no leg here.diff --git a/tests/install/windows/install-button.png b/tests/install/windows/install-button.pngdeleted file mode 100644index 19c478dc810..00000000000Binary files a/tests/install/windows/install-button.png and /dev/null differdiff --git a/tests/install/windows/install-hermes-desktop.ahk b/tests/install/windows/install-hermes-desktop.ahkdeleted file mode 100644index 46efd2b9f7c..00000000000--- a/tests/install/windows/install-hermes-desktop.ahk+++ /dev/null@@ -1,222 +0,0 @@-#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-; bootstrap-complete marker file (the installer writes it after every stage-; has finished, before the Launch screen renders), 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)-; 2: bootstrap-complete marker path to poll for (required)-;-; The Install button image lives next to this script. It is a literal crop-; of the published installer's "[ INSTALL ]" button, cut from the LOSSLESS-; welcome-screen.png the driver captures in CI (run 31449192962) -- never-; from the ffmpeg recording, whose H.264/yuv420p chroma subsampling shifts-; glyph pixels enough that a video-sourced crop misses the live screen.-; Completion deliberately does NOT use a second button image: the marker-; file is the installer's own completion signal and cannot go stale with a-; UI restyle.--logPath := A_Args.Length >= 1 ? A_Args[1] : "ahk.log"-markerPath := A_Args.Length >= 2 ? A_Args[2] : ""--Log(text) {- msg := Format("[autohotkey] {}`n", text)- ToolTip(text)- ; stdout only exists when the launcher attached a console (Start-Process- ; -NoNewWindow). AutoHotkey64 is a GUI-subsystem exe, so a bare spawn has- ; an invalid stdout handle and FileAppend('*') throws "(6) The handle is- ; invalid" -- recursively, from inside OnError's own Log call, which- ; wedges the script instead of exiting. The log FILE is the record;- ; stdout is best-effort.- try 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))- ; *20: the reference is a lossless screen crop, so only minor rendering- ; drift (ClearType phase, sub-shade rounding) needs absorbing.- searchImage := Format("*20 {}", 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))--if (markerPath = "") {- throw Error("marker path argument is required")-}--; Find the Install button via ImageSearch against the lossless screen crop.-; No PixelSearch fallback: color-hunting matched the blue HERMES AGENT title-; (run 31446691812) and the progress view's blue stage text (run 31447405319)-; before it ever matched the button.-FindInstallClickPoint(winTitle, &outX, &outY) {- try {- FindImageInWindow(winTitle, A_ScriptDir "\install-button.png", &outX, &outY, 3000, 250)- Log("Install button located via ImageSearch")- return true- } catch {- return false- }-}--; Did the click land? The button vanishes when the UI flips to the progress-; view, so finding it again means the click did not take.-InstallButtonStillVisible(winTitle) {- x := 0- y := 0- return FindInstallClickPoint(winTitle, &x, &y)-}--; Best-effort clicking: NEVER throw here. The authoritative signals are-; owned elsewhere -- the driver aborts on "bootstrap FAILED" in the-; installer log, and the marker wait below caps the run. Run 31447405319-; killed a healthy mid-install run because this loop threw on its own-; flawed UI heuristic; that class of failure must stay impossible.-attempts := 0-everClicked := false-while (attempts < 10) {- attempts += 1- ; ImageSearch/PixelSearch read SCREEN pixels: anything covering the- ; installer (the runner session keeps a maximized console in front)- ; hides the button even though WinWait's title match succeeded. Force- ; the installer to the foreground before every attempt.- WinActivate(winTitle)- WinMoveTop(winTitle)- Sleep(500)- x := 0- y := 0- if (!FindInstallClickPoint(winTitle, &x, &y)) {- if (everClicked) {- ; Click already landed and this is the progress view.- Log(Format("Attempt {}: button gone after click; proceeding to marker wait", attempts))- break- }- ; Welcome screen may still be rendering.- Log(Format("Attempt {}: no Install button in scan band yet; waiting", attempts))- Sleep(2000)- continue- }- ClickWithMarker(x, y)- everClicked := true- Sleep(3000)- if (!InstallButtonStillVisible(winTitle)) {- Log("Install click landed (button no longer on screen)")- break- }- Log(Format("Install click attempt {}: button still visible; retrying", attempts))-}--; Wait for the installer's own completion signal: the bootstrap-complete-; marker is written after the last stage succeeds. A real install takes many-; minutes (git, uv, Python, Node, venv, desktop build).-Log(Format("Waiting for bootstrap-complete marker: {}", markerPath))-deadline := A_TickCount + 1000 * 60 * 25-while (A_TickCount < deadline) {- if FileExist(markerPath) {- Log("Marker found -- install complete")- ; 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.- try WinClose(winTitle)- Sleep(2000)- ExitApp(0)- }- Sleep(5000)-}-throw Error("bootstrap-complete marker never appeared within 25 minutes")diff --git a/tests/install/windows/install-update-e2e.ps1 b/tests/install/windows/install-update-e2e.ps1deleted file mode 100644index 6a7b56cf4b3..00000000000--- a/tests/install/windows/install-update-e2e.ps1+++ /dev/null@@ -1,512 +0,0 @@-# 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")--# Pre-seed the managed uv. install.ps1's Install-Uv runs astral's installer-# with UV_INSTALL_DIR pointing into HERMES_HOME\bin and discards its output ---# but when an astral install RECEIPT exists (GitHub runners ship uv-# preinstalled with one), the cargo-dist installer updates the receipt's-# location in place and ignores UV_INSTALL_DIR, so the managed path stays-# empty and the stage fails blind ("uv installed but not found", run-# 31447045981). Install-Uv short-circuits on an existing managed uv, so-# seeding it is a legitimate user state, not a bypass.-$managedBin = Join-Path $env:HERMES_HOME "bin"-New-Item -ItemType Directory -Force -Path $managedBin | Out-Null-$uvOnRunner = Get-Command uv.exe -ErrorAction SilentlyContinue-if ($uvOnRunner) {- Copy-Item $uvOnRunner.Source (Join-Path $managedBin "uv.exe") -Force- Ok "seeded managed uv from runner: $($uvOnRunner.Source)"-} else {- # No preinstalled uv means no receipt, so the plain astral path works --- # with output visible, unlike Install-Uv's.- $env:UV_INSTALL_DIR = $managedBin- Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression- Remove-Item Env:\UV_INSTALL_DIR- if (-not (Test-Path (Join-Path $managedBin "uv.exe"))) {- Fail "could not seed managed uv into $managedBin"- }- Ok "seeded managed uv via astral installer"-}--# --- 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-- # Lossless PNG of the welcome screen, taken BEFORE the AHK helper starts- # so no tooltip or click marker contaminates it. This is the artifact the- # ImageSearch reference crop is made from: the ffmpeg recording is- # H.264/yuv420p, whose chroma subsampling shifts glyph pixels enough that- # a crop from video never matches the live screen.- #- # Poll instead of a fixed sleep: WebView2's cold start left the window- # pure white past 17s on a runner (run 31448964917's capture was blank).- # "Rendered" = colored (non-grayscale) pixels in the window content area,- # which the blue HERMES AGENT title guarantees.- Add-Type -AssemblyName System.Windows.Forms, System.Drawing- $bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds- $shotPath = Join-Path $LogDir "welcome-screen.png"- $renderDeadline = (Get-Date).AddSeconds(120)- $rendered = $false- while ((Get-Date) -lt $renderDeadline) {- Start-Sleep -Seconds 5- $bmp = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height- $gfx = [System.Drawing.Graphics]::FromImage($bmp)- $gfx.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)- $gfx.Dispose()- $colored = 0- for ($y = 100; $y -lt 600; $y += 7) {- for ($x = 100; $x -lt 900; $x += 7) {- $p = $bmp.GetPixel($x, $y)- $mx = [Math]::Max($p.R, [Math]::Max($p.G, $p.B))- $mn = [Math]::Min($p.R, [Math]::Min($p.G, $p.B))- if (($mx - $mn) -gt 60) { $colored++ }- }- }- $bmp.Save($shotPath, [System.Drawing.Imaging.ImageFormat]::Png)- $bmp.Dispose()- Write-Host " screen poll: $colored colored samples"- if ($colored -gt 20) { $rendered = $true; break }- }- if (-not $rendered) {- Stop-Recording- Fail "installer UI never rendered within 120s (last capture saved to welcome-screen.png)"- }- Ok "welcome screen captured (lossless) to welcome-screen.png"-- $ahkLog = Join-Path $LogDir "ahk.log"- # The helper polls for the installer's own completion signal instead of a- # second button screenshot (see paths.rs likely_bootstrap_marker).- $bootstrapMarker = Join-Path $InstallRoot ".hermes-bootstrap-complete"- # -NoNewWindow attaches our console as the GUI-subsystem exe's stdout so- # the helper's live lines land in the job log as they happen.- $ahkProc = Start-Process -FilePath "AutoHotkey64.exe" -NoNewWindow `- -ArgumentList "`"$PSScriptRoot\install-hermes-desktop.ahk`"", "`"$ahkLog`"", "`"$bootstrapMarker`"" -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"- # The installer's failure screen waits for a human (Retry- # button); the AHK helper would idle out its full marker- # deadline. Abort as soon as the log says the run is dead.- if ($line -match "bootstrap FAILED") {- Stop-Process -Id $ahkProc.Id -Force -ErrorAction SilentlyContinue- Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue- Fail "installer reported: $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"- $handoffErrLog = Join-Path $LogDir "desktop-update.err.log"- # Run 31449642122 hung 65 minutes inside "Updating Python- # dependencies" with zero output from uv, and the job-level- # timeout killed the run before anything could say why. So the- # hand-off runs under a driver-owned deadline (same 45 minutes- # the staged-exe branch gets): THIS script outlives a hang and- # dumps the live process table before GitHub cancels the job.- # Do NOT set RUST_LOG here: the installed base's Python pipes- # uv's stderr without draining it (the very bug this axis- # exposed), so debug tracing FLOODS that pipe and manufactures- # the deadlock it was meant to diagnose (run 31457301901).- $hp = Start-Process -FilePath "powershell" -ArgumentList @(- "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", $handoff,- "-InstallRoot", $InstallRoot, "-Branch", "main",- "-DesktopPid", "0", "-NoUi"- ) -RedirectStandardOutput $handoffLog -RedirectStandardError $handoffErrLog `- -PassThru -NoNewWindow- $handoffDeadline = (Get-Date).AddMinutes(45)- $tailPos = 0- # Poll-tail the log into the job console so progress stays live.- while (-not $hp.HasExited -and (Get-Date) -lt $handoffDeadline) {- Start-Sleep -Seconds 15- if (Test-Path $handoffLog) {- $content = Get-Content $handoffLog -Raw -ErrorAction SilentlyContinue- if ($content -and $content.Length -gt $tailPos) {- Write-Host ($content.Substring($tailPos)) -NoNewline- $tailPos = $content.Length- }- }- }- if (-not $hp.HasExited) {- Write-Host "--- handoff still running at the 45-minute deadline ---"- Write-Host "--- live processes (who is actually stuck): ---"- Get-CimInstance Win32_Process |- Where-Object { $_.Name -match "uv|python|git|node|hermes|powershell|pip" } |- Select-Object ProcessId, ParentProcessId, CreationDate, Name, CommandLine |- Format-Table -AutoSize -Wrap | Out-String -Width 4096 | Write-Host- if (Test-Path $handoffErrLog) {- Write-Host "--- desktop-update.err.log (last 100 lines) ---"- Get-Content $handoffErrLog -Tail 100 | ForEach-Object { Write-Host $_ }- }- taskkill /PID $hp.Id /T /F 2>$null | Out-Null- Fail "desktop-update.ps1 hung past 45 minutes -- process table above, full logs in artifacts"- }- # Flush whatever the poll loop had not printed yet.- if (Test-Path $handoffLog) {- $content = Get-Content $handoffLog -Raw -ErrorAction SilentlyContinue- if ($content -and $content.Length -gt $tailPos) {- Write-Host ($content.Substring($tailPos)) -NoNewline- }- }- $handoffExit = $hp.ExitCode-- $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 0