From 60bb2bb719fca2f6a6a090310f6a7c1fdf83dfd5 Mon Sep 17 00:00:00 2001 From: jeremyrandria-debug Date: Wed, 12 Aug 2026 16:14:58 +0300 Subject: [PATCH] fix(update): auto-close desktop-update shim window after error/manual outcomes On error/manual outcomes stop_ui('leave-window') kept the browser shim window open indefinitely, so an aborted update left a Chrome window on screen until the user closed it by hand; repeated update attempts piled up more windows. stop_ui now always closes the shim. leave-window paths keep it up for a short grace period (HERMES_UPDATE_SHIM_GRACE_SECONDS, default 15) so a watching user can read the message, then close it. The success path is unchanged. The error/manual outcome is durably written to .hermes-update-result.json and surfaced in a dialog on the next Desktop boot, so closing the shim loses no information. --- scripts/desktop-update/posix.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/desktop-update/posix.sh b/scripts/desktop-update/posix.sh index 687701a3dc..df519a7b6a 100755 --- a/scripts/desktop-update/posix.sh +++ b/scripts/desktop-update/posix.sh @@ -229,12 +229,20 @@ start_ui() { log "shim: app window on 127.0.0.1:$port" } -stop_ui() { # error state leaves the window up for the user to read +stop_ui() { # error/manual outcomes keep the window up briefly so a watching + # user can read the message, then close it. The outcome is also durably + # written to the result file and surfaced in a dialog on the next Desktop + # boot (handoff-result.ts), so the shim window never lingers indefinitely — + # before this, each aborted update left another orphan browser window on + # screen until the user closed it by hand. + if [ "${1:-}" = "leave-window" ]; then + sleep "${HERMES_UPDATE_SHIM_GRACE_SECONDS:-15}" + fi if [ -n "$UI_SERVER_PID" ]; then # The server ignores TERM/HUP (see start_ui) — KILL is its off switch. { kill -9 "$UI_SERVER_PID" && wait "$UI_SERVER_PID"; } 2>/dev/null fi - if [ "${1:-}" != "leave-window" ] && [ -n "$UI_BROWSER_PID" ]; then + if [ -n "$UI_BROWSER_PID" ]; then { kill "$UI_BROWSER_PID" && wait "$UI_BROWSER_PID"; } 2>/dev/null fi UI_SERVER_PID="" UI_BROWSER_PID=""