From 5fca754ee335f6b99ee59481a242e89f5abe8791 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 3 Jun 2026 04:18:25 -0700 Subject: [PATCH] fix(desktop): pass live backend PID to in-app update so its own dashboard is spared The Python half (#37538) reads HERMES_DESKTOP_CHILD_PID to exclude the desktop-managed backend from _kill_stale_dashboard_processes, but nothing set it. applyUpdatesPosixInApp now passes the live backend PID in the `hermes update` env, completing the #37532 fix end-to-end. --- apps/desktop/electron/main.cjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/desktop/electron/main.cjs b/apps/desktop/electron/main.cjs index 4c6d12b7c..bb148b33d 100644 --- a/apps/desktop/electron/main.cjs +++ b/apps/desktop/electron/main.cjs @@ -1412,6 +1412,18 @@ async function applyUpdatesPosixInApp(opts = {}) { PATH: [extraPath, process.env.PATH].filter(Boolean).join(path.delimiter) } + // `hermes update` reaps stale `hermes dashboard` backends (a code update + // leaves the running process serving old Python against the freshly-updated + // JS bundle). But OUR backend is one of those processes, and killing it + // mid-update produces the boot→kill→crash loop in #37532 — the desktop + // already restarts its own backend via the rebuild+relaunch below, so the + // reap must spare it. Hand the live backend's PID to the update process; + // _kill_stale_dashboard_processes reads HERMES_DESKTOP_CHILD_PID and excludes + // it while still reaping any genuinely-orphaned dashboards. (#37532) + if (hermesProcess && Number.isInteger(hermesProcess.pid)) { + env.HERMES_DESKTOP_CHILD_PID = String(hermesProcess.pid) + } + // Branch-pin so a non-main checkout doesn't get switched to main (and self-heal // to main when the pinned branch no longer exists on origin). let branchArgs = []