fix(desktop): first Windows update attempt no longer fails on the app's own dying backends (#74805, salvage #78037) - #95313
Merged
Conversation
Contributor
૮ >ﻌ< ა ci reviewran on 8a49725 — fix(desktop): first Windows update attempt no longer fails o
|
…ackend processes (#74805) taskkill /T /F returns when termination is INITIATED, not completed, and the pre-handoff unlock gate only probed the venv hermes.exe shim — which the 'python.exe -m hermes_cli.main serve' backend need not hold at all. The gate could therefore pass on its first iteration with zero dwell while the killed pythons were still unmapping .pyd files; the venv-blocker scan (no liveness filter) then reported those dying processes as holders and aborted the hand-off. Every first update attempt from the footbar failed; the manual retry succeeded because the process table had settled by then. The unlock gate now lives in backend-release-gate.ts (dependency-free, backend-child.ts pattern) and requires BOTH the shim unlocked AND every signalled PID to have actually left the process table; stragglers collected per-pass are killed and join the watch set. On deadline the old shim-only criterion survives as the escape hatch — lingering PIDs past 15s are the venv-blocker re-scan's job. applyUpdates additionally re-scans up to 2x with a 1.5s settle before aborting on 'blocked', so untracked grandchildren an AV driver holds in teardown stop failing the update while a REAL holder still aborts on the third scan. Surgical reapply of PR #78037 fix 1 by @3x3xX3N0N onto the post-#87599 code shape (stopBackendTreesForUpdate extraction, stopSafeBlockers re-scan path). The re-scan settle idea was first submitted by @MaheshBhushan (#74831); the killed-PID tracking seam matches @webtecnica's #74956. Co-authored-by: MaheshBhushan <128616744+MaheshBhushan@users.noreply.github.com> Co-authored-by: webtecnica <75556242+webtecnica@users.noreply.github.com> Co-authored-by: Hermes <hermes@nousresearch.com>
teknium1
force-pushed
the
fix/74805-kill-to-scan-race
branch
from
August 26, 2026 06:34
c39ad41 to
8a49725
Compare
This was referenced Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first Windows update attempt from the Desktop no longer fails on the app's own dying backend processes (#74805; salvage of #78037 fix 1 by @3x3xX3N0N, reworked onto current main with his authorship preserved). Fleet relevance (#91277): the Desktop is the fleet's control seat — a first-attempt-always-fails local update poisons every rollout that starts there.
Root cause:
taskkill /T /Freturns when termination is INITIATED, and the pre-handoff unlock gate only probed the venvhermes.exeshim — which thepython.exe -m hermes_cli.main servebackend need not hold at all. The gate passed with zero dwell while killed pythons were still unmapping.pydfiles; the venv-blocker scan (no liveness filter) reported those dying processes as holders and aborted. Every first attempt failed; the manual retry succeeded because the table had settled.Changes
apps/desktop/electron/backend-release-gate.ts(new, dependency-free per thebackend-child.tspattern): the gate now requires BOTH the shim unlocked AND every signalled PID to have actually left the process table; per-pass stragglers are killed and join the watch set; on deadline the old shim-only criterion survives as the escape hatch (lingering residue is the re-scan's job, a REAL holder still fails the shim probe)apps/desktop/electron/main.ts:releaseBackendLockseeds and delegates to the gate;applyUpdatesre-scans up to 2x with a 1.5s settle before aborting onblocked(covers the plain path AND the post-stopSafeBlockerspath)taskkill, realprocess.kill(pid,0)probe)Attribution: @3x3xX3N0N's design (exit-wait + re-scan dwell, #78037 fix 1); re-scan settle first submitted by @MaheshBhushan (#74831); killed-PID tracking seam matches @webtecnica's #74956 — both credited via Co-authored-by.
Validation
tsc -p tsconfig.jsoncleanLive repro: windows-latest — before: with the merge-base shim-only gate the #74805 shape passes the gate at t=0 while a real killed PID is still enumerable (contract tests fail proving it); after: the gate dwells until the PID genuinely leaves the live process table (9/9). Ephemeral single-use lane per the live-repro-gate rule; no workflow files in this diff.
Fixes #74805. Closes out #78037 fix 1; supersedes #74831 and #74956 (credit above).
Infographic