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.
This commit is contained in:
teknium1
2026-06-03 04:18:25 -07:00
committed by Teknium
parent 192020992d
commit 5fca754ee3

View File

@ -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 = []