From aa41ac60e1698dd4a67c43842f00a7b46b85d18e Mon Sep 17 00:00:00 2001 From: Guillermo Date: Fri, 19 Jun 2026 21:00:01 +0200 Subject: [PATCH 1/2] fix(installer): make engram stop script exit 0 on clean Windows install On a clean Windows install with no engram process running, `gentle-ai install` aborts with: Error: execute install pipeline: download engram binary: stop running engram processes before upgrade: powershell Stop-Process engram: exit status 1 (output: ) Root cause: engramStopScript() starts with $procs = Get-Process -Name engram -ErrorAction SilentlyContinue On Windows PowerShell 5.1, when no process matches, the suppressed error still sets `$?` to $false. The `if ($procs)` guard never runs and does not reset `$?`, so the script's final state is failure and `powershell.exe -Command` exits 1. stopEngramProcesses() treats that non-zero exit as fatal, aborting the whole pipeline. This is the same clean-install regression class as #815 / #919: those guarded the Stop-Process pipeline, but the trailing exit code still leaks. Fix: append `exit 0` to the script. The stop step is best-effort (all calls use -ErrorAction SilentlyContinue) and the WARNING surfacing path is unchanged, so forcing a success exit on a clean no-op is correct. Verified on Windows 11 / PowerShell 5.1: built from this branch and `gentle-ai install --agents claude-code` now completes (65/65 checks). Co-Authored-By: Claude Opus 4.8 --- internal/components/engram/download.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/components/engram/download.go b/internal/components/engram/download.go index e1bacca6e..d4f353392 100644 --- a/internal/components/engram/download.go +++ b/internal/components/engram/download.go @@ -605,6 +605,7 @@ if ($procs) { Write-Output "WARNING: $($remaining.Count) engram process(es) could not be stopped (access denied or still running). The upgrade may fail if the file is still locked." } } +exit 0 ` } From bbabb6f87160a773f719f440567303736f2f5dc7 Mon Sep 17 00:00:00 2001 From: Alan Buscaglia Date: Sat, 20 Jun 2026 10:25:08 +0200 Subject: [PATCH 2/2] test(engram): cover clean stop script exit --- internal/components/engram/download_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/components/engram/download_test.go b/internal/components/engram/download_test.go index 8c936a49a..1676d1366 100644 --- a/internal/components/engram/download_test.go +++ b/internal/components/engram/download_test.go @@ -1280,4 +1280,10 @@ func TestEngramStopScriptIsDefensive(t *testing.T) { if strings.Contains(script, "Stop-Process -Force -ErrorAction Stop") { t.Errorf("stop script must not use -ErrorAction Stop on Stop-Process (reintroduces issue #815/#850)\nscript:\n%s", script) } + + // The clean/no-process path must report success explicitly, regardless of any + // PowerShell status left behind by defensive no-op commands. + if !strings.HasSuffix(strings.TrimSpace(script), "exit 0") { + t.Errorf("stop script must explicitly exit 0 on the clean/no-process path\nscript:\n%s", script) + } }