Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(windows): cover legacy uninstaller process matches
enesab6a3399d1e1
diff --git a/build/installer.nsh b/build/installer.nshindex 185cabda7..f26658784 100644--- a/build/installer.nsh+++ b/build/installer.nsh@@ -13,7 +13,7 @@SetErrorLevel 2IfSilent nodeterm_preflight_cancel${If} $R0 == 10- MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "nodeterm or its background session host is still running.$\r$\n$\r$\nClosing the app keeps terminal and agent sessions alive. Updating requires those sessions to end.$\r$\n$\r$\nCancel to keep working. When ready, save your work, reopen nodeterm, and end local sessions in every project (Sessions sidebar: End session). Quit nodeterm, wait at least 30 seconds for the host to exit, then retry.$\r$\n$\r$\nThis installer will not stop your sessions for you." /SD IDCANCEL IDRETRY nodeterm_preflight_retry+ MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "nodeterm, a background session host, or a process using the installation path is still running.$\r$\n$\r$\nClosing the app keeps terminal and agent sessions alive. Updating requires those sessions to end.$\r$\n$\r$\nCancel to keep working. When ready, save your work, reopen nodeterm, and end local sessions in every project (Sessions sidebar: End session). Quit nodeterm, wait at least 30 seconds for the host to exit, then retry.$\r$\n$\r$\nOther nodeterm installations and Windows users must also finish their sessions. Run this installer from Downloads, outside the install directory. This installer will not stop your sessions for you." /SD IDCANCEL IDRETRY nodeterm_preflight_retry${Else}MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "nodeterm could not verify whether the app or its background session host is running. No sessions have been stopped.$\r$\n$\r$\nCancel and check that Windows PowerShell and process queries are available. If another Windows user is running nodeterm, ask them to save and end their sessions before retrying." /SD IDCANCEL IDRETRY nodeterm_preflight_retry${EndIf}diff --git a/build/windows-update-preflight.ps1 b/build/windows-update-preflight.ps1index 3e3b74a26..c63925ce8 100644--- a/build/windows-update-preflight.ps1+++ b/build/windows-update-preflight.ps1@@ -1,17 +1,21 @@# Read-only installer gate. No process is terminated, including on query failure.-# Exit 0 = clear, 10 = app/host running, 20 = could not prove it is safe to proceed.+# Exit 0 = clear, 10 = potentially affected process running, 20 = could not prove it is safe to proceed.param([Parameter(Mandatory = $true)][string]$InstallDirectory)$ErrorActionPreference = 'Stop'try {if ($InstallDirectory -notmatch '^(?:[A-Za-z]:\\|\\\\)') { exit 20 }- $directory = $InstallDirectory.TrimEnd('\') + '\'+ $directory = $InstallDirectory.TrimEnd('\')$processes = @(Get-CimInstance -ClassName Win32_Process -ErrorAction Stop)foreach ($process in $processes) {- if ($process.Name -ine 'nodeterm.exe' -and $process.Name -ine 'nodeterm-session-host.exe') { continue }- # An inaccessible process might be another user's host in an all-users installation.- # Absence of a path is not proof that it belongs to a different installation.- if ([string]::IsNullOrWhiteSpace($process.ExecutablePath)) { exit 20 }- if ($process.ExecutablePath.StartsWith($directory, [StringComparison]::OrdinalIgnoreCase)) { exit 10 }+ # Old uninstallers can use a machine-wide NAME match, or a PATH PREFIX match without a+ # directory boundary. We must cover both before handing control to that old executable.+ # This deliberately blocks another installation too; it never terminates its processes.+ if ($process.Name -ieq 'nodeterm.exe' -or $process.Name -ieq 'nodeterm-session-host.exe') {+ if ([string]::IsNullOrWhiteSpace($process.ExecutablePath)) { exit 20 }+ exit 10+ }+ if (-not [string]::IsNullOrWhiteSpace($process.ExecutablePath) -and+ $process.ExecutablePath.StartsWith($directory, [StringComparison]::OrdinalIgnoreCase)) { exit 10 }}exit 0} catch {diff --git a/docs/windows-session-host.md b/docs/windows-session-host.mdindex 1d68b5453..8097159a3 100644--- a/docs/windows-session-host.md+++ b/docs/windows-session-host.md@@ -353,13 +353,19 @@ makes it identifiable; it does **not** make the install directory safe to replacalone deliberately leaves the host and its sessions running (#829).The NSIS install/uninstall preflight now refuses to proceed while the app or host is running from-the target installation. It replaces electron-builder's automatic process termination, including+any installation, or a process runs under the installation path prefix. It replaces electron-builder's+automatic process termination, includingits silent/`--updated` path. Cancel leaves sessions alone. Retry performs a fresh, read-only processquery. A failed query (including an inaccessible nodeterm process with no executable path) blocksinstead of guessing. Silent installation returns a nonzero exit code, without a dialog or kill.The query uses Windows PowerShell with a child-process-only execution policy; no persistent policyor trust setting is changed. Group Policy restrictions still cause a safe refusal.+This is deliberately conservative: an old uninstaller may use a machine-wide name match or a+path prefix without a directory boundary. Another installation (even a sibling directory whose+name begins with this installation's name) can therefore block an update. The new preflight must+cover those legacy targets before invoking the old executable; it never stops them on your behalf.+To update when you are ready to end sessions:1. Cancel the installer and reopen nodeterm if you already quit it. Save work in local terminals@@ -367,8 +373,9 @@ To update when you are ready to end sessions:2. Use **End session** in the Sessions sidebar for each local session. This ends its process andremoves its node; do not mistake closing a project or quitting the app for ending a session.Shells may also be exited normally once their work is saved.-3. Quit nodeterm, wait at least 30 seconds after the last session ends, and run the installer again.- Do not reopen the app or start sessions while installation is in progress.+3. Quit nodeterm, wait at least 30 seconds after the last session ends, and run the installer again+ from Downloads, outside the installation directory. Other installations/users must finish their+ sessions too. Do not reopen the app or start sessions while installation is in progress.4. If the host remains, keep the installer cancelled and inspect Windows Task Manager's Detailsview. Verify the executable path belongs to this installation. Ending that exact host manuallyis a last resort **only if you accept losing every terminal/agent process it owns**; never usediff --git a/scripts/windows-update-preflight.test.ts b/scripts/windows-update-preflight.test.tsindex 215f7d8f2..b0c9c7dad 100644--- a/scripts/windows-update-preflight.test.ts+++ b/scripts/windows-update-preflight.test.ts@@ -38,11 +38,13 @@ describe.skipIf(!available)('installer preflight with disposable process-query f['app live / no host', [app], 10],['app closed / host exited', [], 0],['host fallback to original executable', [app], 10],- ['host in another installation', [{ ...host, ExecutablePath: 'C:\\Apps\\nodeterm-other\\nodeterm-session-host.exe' }], 0],+ ['host in another installation still blocks the old uninstaller', [{ ...host, ExecutablePath: 'D:\\Other\\nodeterm-session-host.exe' }], 10],['case-insensitive Windows path', [{ ...host, ExecutablePath: host.ExecutablePath!.toUpperCase() }], 10],['unknown host owner/path', [{ ...host, ExecutablePath: null }], 20],['unknown app owner/path', [{ ...app, ExecutablePath: '' }], 20],- ['uninstaller is not the app', [{ Name: 'Uninstall nodeterm.exe', ExecutablePath: 'C:\\Apps\\nodeterm\\Uninstall nodeterm.exe' }], 0]+ ['uninstaller copied to temp is clear', [{ Name: 'Uninstall nodeterm.exe', ExecutablePath: 'C:\\Temp\\Uninstall nodeterm.exe' }], 0],+ ['legacy prefix-matched process blocks', [{ Name: 'helper.exe', ExecutablePath: 'C:\\Apps\\nodeterm-other\\helper.exe' }], 10],+ ['unrelated process outside installation is clear', [{ Name: 'helper.exe', ExecutablePath: 'C:\\Other\\helper.exe' }], 0]] as const)('%s', (_name, processes, result) => {expect(probe([...processes])).toBe(result)})