fix(updater): release self-held lock during Windows desktop update - #76071
fix(updater): release self-held lock during Windows desktop update#76071RelaxJonh wants to merge 1 commit into
Conversation
Legacy hermes-setup.exe binaries that predate the HANDOFF_PID_ENV export spawn hermes.exe (the Windows launcher shim) as an intermediate process before python.exe. The Python child's direct parent is hermes.exe, not the lock-owning hermes-setup.exe, so the existing ancestor check that walked all parents with psutil was correct in principle but had two gaps: 1. When psutil was unavailable the check silently returned False with no fallback, leaving the self-lock in place on installs without psutil. 2. The acquire() logic used a flat OR: a present-but-wrong HANDOFF_PID still fell through to the ancestor check, which could accept a marker owned by an unrelated ancestor process. Fixes NousResearch#75879 - _is_ancestor_pid: limit psutil walk to nearest 3 ancestors; add os.getppid() fallback when psutil is not installed. - acquire: separate explicit-handoff and legacy-ancestor paths so a wrong HANDOFF_PID is rejected immediately without falling through.
|
Thanks for the focused Windows compatibility investigation. This is an automated hermes-sweeper review; the reported legacy updater self-lock is already handled on current
Closing as implemented on main. |
|
@teknium1 Thank you for the clarification that the legacy self-lock reported by this PR is already implemented on What happened in this retest
So Why current Desktop preflight still blocks itThe freshly updated install's read-only scanner invocation: & "$env:LOCALAPPDATA\\hermes\\hermes-agent\\venv\\Scripts\\python.exe" -m hermes_cli._scan_venv_blockersreturned: {
"ok": true,
"blocked": true,
"processes": [
{
"pid": 8404,
"name": "python.exe",
"cmdline": "%LOCALAPPDATA%\\hermes\\hermes-agent\\venv\\Scripts\\python.exe F:\\uo\\Stealth_MCP\\server.py"
}
],
"pausable_gateways": 1
}This is useful evidence that the direct The Scope relative to #76071I agree that the legacy Conservative upstream direction requestedCould maintainers confirm whether this helper topology is intended to be covered by the Gateway update work? A safe approach would be to extend Desktop preflight and the updater pause path only for helpers whose ownership is provable, for example:
This would avoid a broad |
Fixes #75879
Windows desktop update self-locks when a legacy
hermes-setup.exe(predating the
HANDOFF_PID_ENVexport) sits behind thehermes.exeWindows launcher shim. The Python child's direct parent is the shim,
not the lock-owning updater, so the ancestor check cannot see the
lock owner through
os.getppid()alone.Changes
hermes_cli/update_lock.py(1 file, +36 −2):_is_ancestor_pid— limit psutil walk to nearest 3 ancestors(covers
hermes-setup.exe → hermes.exe → python.exe); addos.getppid()fallback when psutil is not installed.acquire— separate explicit-handoff and legacy-ancestorpaths so a present-but-wrong
HANDOFF_PIDis rejected immediatelywithout falling through to the ancestor check.
Validation (from issue report)
py_compileof the patched module: ✓hermes-setup.exe → hermes.exe → python.exehandoff: accepted ✓HERMES_UPDATE_HANDOFF_PID: rejected ✓update stage state=Succeeded✓